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 EoSEOS_ISOTHERMAL
: isothermal EoSEOS_COSMIC_RAY
: cosmic-ray EoSEOS_TAUBMATHEWS
: special relativistic EoSEOS_USER
: user-specified EoS
EOS_GAMMA
An ideal-gas EoS with a constant adiabatic index GAMMA .
EOS_ISOTHERMAL
An isothermal EoS with a constant sound speed set by MOLECULAR_WEIGHT and ISO_TEMP .
EOS_COSMIC_RAY
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 .
EOS_TAUBMATHEWS
A special relativistic EoS with a variable gamma by Taub 1948 and Mathews 1971. Must enable SRHD .
EOS_USER
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
.