Improved phase internal energy computation#1846
Conversation
| "ViscosityFun", | ||
| "EnthalpyFun", | ||
| "InternalEnergyFun" ); | ||
| "EnthalpyFun" ); |
There was a problem hiding this comment.
I would encourage you to build the same tests that I did in #1778 so future refactorings will be safer.
There was a problem hiding this comment.
Hmm, I missed these in the PR where they were introduced. We definitely shouldn't be redeclaring these strings 4 times - the enumeration type must be made non-dependent on template parameters of CO2BrineFluid in one of the following ways:
- moving the enum definition out of class into the namespace
geosx::constitutive(I'd prefer not to) - making a non-template class
CO2BrineFluidBasecontaining the enum and everything else that does not depend on the template parameters - or moving the enum definition entirely into
.cppfile - it is not used anywhere else. Or maybe get rid if enum entirely? It's not actually used anywhere, except for getting strings (once per value). Or at least it needs to be used as an enum - by converting the input string to it, then switching on the value, instead of branching on string comparisons.
This is a future TODO item, not something to address in current PR, which is ready to be merged.
There was a problem hiding this comment.
Ok sounds good, I did not know. I am going to merge this PR now since I realize now that it is at the top of the queue, and I will remove these enums immediately in the main thermal PR. Thanks!
In the CO2-brine multifluid package, we currently compute the phase internal energy
u_pusing a very crude formula here (same for both phases):with which we cannot match published internal energy values for CO2 and brine phases and cannot produce valid temperature fronts in the thermal solver.
I propose to change this to the standard formula (used in other simulators)
where
h_pis the phase enthalpy, and\rho_pis the phase mass density. With this formula, we get a good match with published internal energy values for CO2 and brine.Since this formula is general and can be used by other fluid models (including
CompositionalMultiphaseFluidat some point), I moved the computation of internal energy toMultiFluidBase, and removed theINT_ENERGYtemplate from theCO2BrineFluidclass.No need for rebaseline, this only affects the results in #1225