| ... | @@ -1574,16 +1574,16 @@ by definition of the following macros: |
... | @@ -1574,16 +1574,16 @@ by definition of the following macros: |
|
|
| `TUSR(rho,eth)` | temperature |
|
|
| `TUSR(rho,eth)` | temperature |
|
|
|
| `ETUSR(rho,eth)` | thermal energy density |
|
|
| `ETUSR(rho,eth)` | thermal energy density |
|
|
|
|
|
|
|
|
The macros are in general functions of the mass density $\varrho$
|
|
The macros are in general functions of the mass density 𝜚 (`rho`)
|
|
|
(`rho`) and thermal energy density $\varepsilon$ (`eth`). It are
|
|
and thermal energy density *ε* (`eth`). It are
|
|
|
declared in the header file `nirvanaUser.h`. In order to give an
|
|
declared in the header file `nirvanaUser.h`. In order to give an
|
|
|
example, the following code fragment (taken from `nirvanaUser.h` in
|
|
example, the following code fragment (taken from `nirvanaUser.h` in
|
|
|
testproblem `/nirvana/testproblems/GRAVITY/problem4`) illustrates the
|
|
testproblem `/nirvana/testproblems/GRAVITY/problem4`) illustrates the
|
|
|
definition of a barotropic EOS of the form
|
|
definition of a barotropic EOS of the form
|
|
|
|
|
|
|
|
$p(\varrho)=a^2\varrho \left[1+(\varrho/\varrho_0)^{4/3}\right]^{1/2}$
|
|
*p*(𝜚) = *a*<sup>2</sup>𝜚\[1+(𝜚/𝜚<sub>0</sub>)<sup>4/3</sup>\]<sup>1/2</sup>
|
|
|
|
|
|
|
|
with $a=200$ and $\varrho_0=10^{-10}$.
|
|
with *a*=200 and 𝜚<sub>0</sub>=10<sup>−10</sup>.
|
|
|
|
|
|
|
|
#define PUSR(rho,eth) (40000.*(rho)*sqrt(1.+pow((rho)/1.e-10,4./3.))+0*(eth))
|
|
#define PUSR(rho,eth) (40000.*(rho)*sqrt(1.+pow((rho)/1.e-10,4./3.))+0*(eth))
|
|
|
#define CS2USR(rho,eth) (40000.*sqrt(1.+pow((rho)/1.e-10,4./3.)) \
|
|
#define CS2USR(rho,eth) (40000.*sqrt(1.+pow((rho)/1.e-10,4./3.)) \
|
| ... | @@ -1592,10 +1592,10 @@ with $a=200$ and $\varrho_0=10^{-10}$. |
... | @@ -1592,10 +1592,10 @@ with $a=200$ and $\varrho_0=10^{-10}$. |
|
|
#define TUSR(rho,eth) (MOK*_C.mean_molecular_weight*PUSR(rho,eth)/rho)
|
|
#define TUSR(rho,eth) (MOK*_C.mean_molecular_weight*PUSR(rho,eth)/rho)
|
|
|
#define ETUSR(rho,eth) (PUSR(rho,eth)/(_C.gamma-1.))
|
|
#define ETUSR(rho,eth) (PUSR(rho,eth)/(_C.gamma-1.))
|
|
|
|
|
|
|
|
Since $p$ solely depends on $\varrho$ the energy density parameter `eth`
|
|
Since *p* solely depends on 𝜚 the energy density parameter `eth`
|
|
|
is irrelevant is this case. The `ETUSR` definition makes use of the
|
|
is irrelevant is this case. The `ETUSR` definition makes use of the
|
|
|
prior definition of `PUSR` and assumes the usual caloric EOS with ratio
|
|
prior definition of `PUSR` and assumes the usual caloric EOS with ratio
|
|
|
of specific heats $\gamma$ (code variable `_C.gamma`). A barotropic EOS
|
|
of specific heats *γ* (code variable `_C.gamma`). A barotropic EOS
|
|
|
is consistent with solving no energy equation.
|
|
is consistent with solving no energy equation.
|
|
|
|
|
|
|
|
**Important:** If an energy equation is solved together with an analytic
|
|
**Important:** If an energy equation is solved together with an analytic
|
| ... | @@ -1616,19 +1616,19 @@ An analytic EOS is enabled by appropriately choosing the parameter |
... | @@ -1616,19 +1616,19 @@ An analytic EOS is enabled by appropriately choosing the parameter |
|
|
|
|
|
|
|
NIRVANA also permits the implementation of a tabulated EOS. However, the
|
|
NIRVANA also permits the implementation of a tabulated EOS. However, the
|
|
|
procedure is more involved and requires the creation of look-up tables
|
|
procedure is more involved and requires the creation of look-up tables
|
|
|
for the logarithm of pressure, $\log p$, and logarithm of temperature,
|
|
for the logarithm of pressure, log *p*, and logarithm of temperature,
|
|
|
$\log T$, both as functions of the logarithm of mass density $\varrho$
|
|
log *T*, both as functions of the logarithm of mass density log 𝜚
|
|
|
and the logarithm of thermal energy density $\varepsilon$. The look-up
|
|
and the logarithm of thermal energy density *ε*.
|
|
|
tables for a prescribed $(\log\varrho, \log\varepsilon)$-range are
|
|
The look-up tables for a prescribed (log 𝜚, log *ε*)-range
|
|
|
generated by cubic interpolation from user-specified data
|
|
are generated by cubic interpolation from user-specified data
|
|
|
$\{(\log p)_{ij}\}$ and $\{(\log T)_{ij}\}$ on an rectilinear mesh
|
|
{(log *p*)<sub>*ij*</sub>} and ({(log *T*)<sub>*ij*</sub>})
|
|
|
$\{(\log\varrho)_i\}\times\{(\log\varepsilon)_j\}$, $i=0,{\tt n1}-1$ and
|
|
on an rectilinear mesh {(log 𝜚)<sub>*i*</sub>} × {(log *ε*)<sub>*j*</sub>},
|
|
|
$j=0,{\tt n2}-1$ with `n1`$\times$`n2` the number of mesh points.
|
|
*i*=0,n1-1 and *j*=0,n2-1, with n1 × n2 the number of mesh points.
|
|
|
|
|
|
|
|
Data for the look-up tables has to be defined in the function
|
|
Data for the look-up tables has to be defined in the function
|
|
|
`eosTabPressureUser()` in module `eosTabPressureUser.c` for $\log p$,
|
|
`eosTabPressureUser()` in module `eosTabPressureUser.c` for log *p*,
|
|
|
and in the function `eosTabTemperatureUser()` in module
|
|
and in the function `eosTabTemperatureUser()` in module
|
|
|
`eosTabTemperatureUser.c` for $\log T$.
|
|
`eosTabTemperatureUser.c` for log *T*.
|
|
|
|
|
|
|
|
In both, `eosTabPressureUser()` and `eosTabTemperatureUser()`, the user
|
|
In both, `eosTabPressureUser()` and `eosTabTemperatureUser()`, the user
|
|
|
must assign and return a structure of type `UTAB` (declared in header
|
|
must assign and return a structure of type `UTAB` (declared in header
|
| ... | @@ -1646,7 +1646,7 @@ Denoting by `ut` an instance of `UTAB` the structure is accessed by |
... | @@ -1646,7 +1646,7 @@ Denoting by `ut` an instance of `UTAB` the structure is accessed by |
|
|
|
|
|
|
|
Here is an example how to code `eosTabPressureUser()` taken from
|
|
Here is an example how to code `eosTabPressureUser()` taken from
|
|
|
testproblem `/nirvana/testproblem/MHD/problem1B` which provides data for
|
|
testproblem `/nirvana/testproblem/MHD/problem1B` which provides data for
|
|
|
the standard EOS of caloric type, $p=(\gamma -1)\varepsilon$, in
|
|
the standard EOS of caloric type, *p*=(*γ* − 1)*ε*, in
|
|
|
tabulated form:
|
|
tabulated form:
|
|
|
|
|
|
|
|
UTAB eosTabPressureUser(void)
|
|
UTAB eosTabPressureUser(void)
|
| ... | @@ -1713,14 +1713,14 @@ tabulated form: |
... | @@ -1713,14 +1713,14 @@ tabulated form: |
|
|
|
|
|
|
|
First, the number of mesh points, `ut.n1` and `ut.n2`, in
|
|
First, the number of mesh points, `ut.n1` and `ut.n2`, in
|
|
|
$\log\varrho$-direction and $\log\varepsilon$-direction is set. It
|
|
$\log\varrho$-direction and $\log\varepsilon$-direction is set. It
|
|
|
follows the range \[`ut.u1_lo`,`ut.u1_up`\] for $\log\varrho$ and
|
|
follows the range \[`ut.u1_lo`,`ut.u1_up`\] for log 𝜚 and
|
|
|
\[`ut.u2_lo`,`ut.u2_up`\] for $\log\varepsilon$, respectively. Then, the
|
|
\[`ut.u2_lo`,`ut.u2_up`\] for log *ε*, respectively. Then, the
|
|
|
2D array `ut.dt2` is allocated and $\{(\log p)_{ij}\}$ data is assigned.
|
|
2D array `ut.dt2` is allocated and {(log *p*)<sub>*ij*</sub>}
|
|
|
`ut` is returned and used by the code to finally create the look-up
|
|
data is assigned. `ut` is returned and used by the code to finally create
|
|
|
table `_TABLP`. Actually, `_TABLP` is a (global) pointer of struct type
|
|
the look-up table `_TABLP`. Actually, `_TABLP` is a (global) pointer of
|
|
|
`TAB` (declared in the header file `tabular.h`) and represents the
|
|
struct type `TAB` (declared in the header file `tabular.h`) and represents
|
|
|
tabulated EOS $\log p(\log\varrho,\log\varepsilon)$. Correspondingly,
|
|
the tabulated EOS log *p*(log 𝜚, log *ε*). Correspondingly,
|
|
|
coding `eosTabTemperatureUser()` for $\log T$ would provide the input
|
|
coding `eosTabTemperatureUser()` for log *T* would provide the input
|
|
|
for the look-up table `_TABLT`. `_TABLP` and `_TABLT` are used in the
|
|
for the look-up table `_TABLT`. `_TABLP` and `_TABLT` are used in the
|
|
|
code function `TDeos()` in module `utilTD.c`.
|
|
code function `TDeos()` in module `utilTD.c`.
|
|
|
|
|
|
| ... | | ... | |