equation of state - hyschive/gamer-fork GitHub Wiki
This page describes various equation of states (EoS) supported by the compilation option --eos.
-
EOS_GAMMA
: constant-gamma EoS -
EOS_ISOTHERMAL
: isothermal EoS -
EOS_COSMIC_RAY
: cosmic-ray EoS -
EOS_TAUBMATHEWS
: special relativistic EoS -
EOS_USER
: user-specified EoS
An ideal-gas EoS with a constant adiabatic index GAMMA.
An isothermal EoS with a constant sound speed set by MOLECULAR_WEIGHT and ISO_TEMP.
A cosmic-ray EoS with an adiabatic index for fluid GAMMA and an effective adiabatic index for cosmic rays GAMMA_CR. Must enable --cosmic_ray.
A special relativistic EoS with a variable gamma by Taub 1948 and Mathews 1971. Must enable --srhd.
Follow the steps below to define your EoS when
adding a new simulation named NewProblem
.
-
Go to the new test problem folder and copy the EoS template.
cd src/TestProblem/Hydro/NewProblem cp ../../../EoS/User_Template/CPU_EoS_User_Template.cpp CPU_EoS_NewProblem.cpp ln -s CPU_EoS_NewProblem.cpp GPU_EoS_NewProblem.cu # CPU/GPU share the same source file
-
Edit the EoS source file
CPU_EoS_NewProblem.cpp
.-
Rename
User_Template
asNewProblem
. For example, with thevim
editor you can do%s/User_Template/NewProblem/g
in the command line mode. -
[Optional] Set the auxiliary array
AuxArray[]
invoid EoS_SetAuxArray_NewProblem()
. This array must be constant across the simulation period and domain and will be passed to all EoS conversion functions (see below) automatically. The array size is set byEOS_NAUX_MAX
ininclude/Macro.h
(default is 10). -
Implement the following EoS conversion functions.
-
EoS_DensEint2Pres_NewProblem()
: convert gas mass density and internal energy density to gas pressure. -
EoS_DensPres2Eint_NewProblem()
: convert gas mass density and pressure to gas internal energy density. -
EoS_DensPres2CSqr_NewProblem()
: convert gas mass density and pressure to sound speed squared. -
EoS_DensEint2Temp_NewProblem()
: convert gas mass density and internal energy to gas temperature [OPTIONAL]. -
EoS_DensTemp2Pres_NewProblem()
: convert gas mass density and temperature to gas pressure [OPTIONAL]. -
EoS_General_NewProblem()
: general conversion between user-specified input and output variables [OPTIONAL].
-
-
Caution
- All conversion functions must be thread-safe and not use any global variable.
- When a conversion function fails, it is recommended to return
NAN
in order to trigger auto-corrections such as OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT.
-
Edit the problem source file
Init_TestProb_Hydro_NewProblem.cpp
to enable this new EoS.-
Put the following function prototype on the top of this file.
void EoS_Init_NewProblem();
-
Set the EoS function pointer in
Init_TestProb_Hydro_NewProblem()
.
EoS_Init_Ptr = EoS_Init_NewProblem;
-
-
Make sure to set
EOS=EOS_USER
in theMakefile
.