Skip to content
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

Thermodynamically consistent temperature #272

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

asnodin
Copy link
Contributor

@asnodin asnodin commented Jun 15, 2021

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 as amrex::Vector<amrex::MultiFab> TempC, outside of the state array and gets updated whenever TfromRho[P|H]() gets called. This is essentially fine for tfromp, 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):

  • When thermal diffusion is used we want to use the correct temperature in grad T to ensure that the diffusion introduces a positive-definite source of entropy. This is done here by simply replacing scal[Temp] with TempC in MakeExplicitThermal() for temp_diffusion_formulation=1.
  • Since any external heating, reactions or thermal diffusion sources are taken to be at the correct temperature they need to be scaled by T_EoS / T so that energy is conserved. This is done here adding a factor scal_arr(i, j, k, Temp) / TempC_arr(i, j, k) to (i) What goes into S_cc_arr in Make_S_cc(), and (ii) s_out_arr in Burner().

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

  • anything SDC specific (but should be straightforward I guess)
  • temp_diffusion_formulation=2; an easy way to to this would be to calculate grad (T - T_EoS) and add it via ApplyThermal().
  • thermal diffusion for entropy; one way to do this would be to multiply all thermal terms by T_EoS / T in MakeExplicitThemal. That would mean thermal would be correctly scaled when it is used elsewhere, such as in MakeRhoHForce(). Here it would also be necessary to remove scaling of thermal in Make_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.

asnodin added 4 commits June 9, 2021 22:59
…t it is assumed that

reactions are done at the correct temperature without any modification. Thermal diffusion is only included in the expansion term and implemented for temp_diffusion_formulation=1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant