Thermodynamically consistent temperature #272
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the option to use a thermodynamically consistent temperature by setting
use_correct_temp = true
. Two options have also been added to include the corrected tfrom[p|h] in the plotfile. At present the corrected temperature is stored asamrex::Vector<amrex::MultiFab> TempC
, outside of the state array and gets updated wheneverTfromRho[P|H]()
gets called. This is essentially fine fortfromp
, but is a problem for example if one depends on the thermal diffusion in the enthalpy evolution, which is not implemented here (in that case it would be more convenient to store the corrected temperature in the state array because the corrected temperature is required at two times and it must be consistent with the EoS temperature being used).It is assumed for now that reactions and conductivity already have the correct temperature given by T_EoS. Then the temperature correction is used in two contexts to ensure thermodynamical consistency (and that energy is conserved):
scal[Temp]
withTempC
inMakeExplicitThermal()
fortemp_diffusion_formulation=1
.scal_arr(i, j, k, Temp) / TempC_arr(i, j, k)
to (i) What goes intoS_cc_arr
inMake_S_cc()
, and (ii)s_out_arr
inBurner()
.I have added an input for
test_convect
with the correction turned on. When we depend on the temperature from enthalpy this scales the external/reaction heating and has a small effect (the hybrid lambdabar correction is not used though).what is not implemented
temp_diffusion_formulation=2
; an easy way to to this would be to calculate grad (T - T_EoS) and add it viaApplyThermal()
.MakeExplicitThemal
. That would meanthermal
would be correctly scaled when it is used elsewhere, such as inMakeRhoHForce()
. Here it would also be necessary to remove scaling ofthermal
inMake_S_cc()
. To make this work cleanly it would likely be necessary to have the temperature correction in the state array, so that two corrections can be used in the Crank–Nicolson scheme.