-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create minimum energy modifier #375
base: main
Are you sure you want to change the base?
Conversation
Wow it compiled first time!? The modifier isn't compiled yet, but the default minimum energy stuff should be compiling, which might mean what I wrote works? I'd still like to make an explicit unit test something along the lines of asserting that the energy is the zero temperature energy. |
Would this play nicely with the options that @annapiegra added for eospac @jhp-lanl ? It sounds similar though I don't recall the details. I assume it matters which order an energy shift is applied so that will need to be taken into account when constructing the modifier list. |
This is the exact function that @annapiegra added, but when it was added it was basically disabled (would throw an error) for any EOS other than EOSPAC. This basically changes that so that every EOS will have some notion of minimum energy by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clean how this came out. I wonder if we should make this more "monolithic" and just provide bounds on all independent variables.
template <typename Indexer_t = Real *> | ||
PORTABLE_FUNCTION Real InternalEnergyFromDensityTemperature( | ||
const Real rho, const Real temperature, Indexer_t &&lambda = nullptr) const { | ||
return t_.InternalEnergyFromDensityTemperature(rho, temperature, lambda); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may wish to compute t of emin or something for rho e based EOS's. Not sure that's worth thinking about here though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you talking about maxing the input temperature before outputting the energy?
I think more generally though if the energy output here violates the minimum given by the MinInternalEnergyFromDensity()
function, then it's a reflection of an unphysical EOS (i.e. a negative heat capacity). As a result, I'm not sure we want to guard against this.
That said, it's certainly possible to have a negative heat capacity in some fringe cases, but I'm not sure if this is the appropriate way to guard against this. But then again, maybe it's better to guarantee that the output is always bounded by the minimum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you talking about maxing the input temperature before outputting the energy?
That was what I was thinking but actually it probably makes more sense to max it after. Either way it may not be worth worrying about here.
using namespace eos_base; | ||
|
||
template <typename T> | ||
class MinimumEnergy : public EosBase<MinimumEnergy<T>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to renaming this if someone has a more descriptive name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe FlooredEnergy
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that better. I'll change it when I get back
I assume that would mean expanding this to enforce a minimum density and temperature as well? That seems pretty straight-foward and might be pretty easy to implement. I don't know if I'd want to do anything with upper bounds though. I feel that an extrapolation approach might be a superior way to handle upper-bounds. Speaking of extrapolation, I suppose that if a table has a non-zero lower temperature bound we might want to apply an extrapolation layer first that extends the minimum energy/temperature to 0 K first and then this would lie on top of it. |
I think it might be nice to impose energy and temperature floors together, yeah. 👍
That's fair... but is that always going to be valid going forward? What about an EOS that is for, e.g., a single phase as @aematts is planning to use?
True! I actually think what you've implemented here is a nice template for that kind of thing. |
That's a good point, but I think there's an important difference: I'm constraining the input to be on the EOS surface whereas I think @aematts is going to want to constrain the output such that it's clear when a phase EOS isn't valid. From my limited understanding of kinetic phase transitions, you might want to set a domain of validity for a phase EOS and not constrain yourself to that domain, but instead maybe provide a flag to indicate that you're not in the range of validity anymore. For example, you could return an infinite Gibbs free energy (or equivalent) when you're outside the domain of validity (which is basically a constant extrapolation). That way the rate at which that phase is created can be set to identically zero. Either way, I anticipate that we'll have to create additional modifiers to handle these use scenarios. |
Yeah fair enough. I may be over-engineering here. |
PR Summary
Creates a minimum energy modifier and unifies EOS behind a default behavior of returning the zero K isotherm as the minimum possible internal energy.
Some notes:
Fixes #318
PR Checklist
make format
command after configuring withcmake
.If preparing for a new release, in addition please check the following: