Changes
Page history
version 4.2
authored
Oct 30, 2025
by
Udo Ziegler
Hide whitespace changes
Inline
Side-by-side
3-NIRVANA-user-guide/3.2-User-interfaces.md
View page @
436d2856
...
...
@@ -1574,16 +1574,16 @@ by definition of the following macros:
|
`TUSR(rho,eth)`
| temperature |
|
`ETUSR(rho,eth)`
| thermal energy density |
The macros are in general functions of the mass density
$
\v
arrho$
(
`rho`
)
and thermal energy density
$
\v
arepsilon$
(
`eth`
). It are
The macros are in general functions of the mass density
𝜚 (
`rho`
)
and thermal energy density
*ε*
(
`eth`
). It are
declared in the header file
`nirvanaUser.h`
. In order to give an
example, the following code fragment (taken from
`nirvanaUser.h`
in
testproblem
`/nirvana/testproblems/GRAVITY/problem4`
) illustrates the
definition of a barotropic EOS of the form
$p(
\v
arrho)=a^2
\v
arrho
\l
eft[1+(
\v
arrho/
\v
arrho_0)^{4/3}
\r
ight]^{1/2}$
*p*
(𝜚) =
*a*
<sup>
2
</sup>
𝜚
\[
1+(𝜚/𝜚
<sub>
0
</sub>
)
<sup>
4/3
</sup>
\]
<sup>
1/2
</sup>
with
$a
=200
$
and
$
\v
arrho_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 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}$.
#define TUSR(rho,eth) (MOK*_C.mean_molecular_weight*PUSR(rho,eth)/rho)
#define ETUSR(rho,eth) (PUSR(rho,eth)/(_C.gamma-1.))
Since
$p$
solely depends on
$
\v
arrho$
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
prior definition of
`PUSR`
and assumes the usual caloric EOS with ratio
of specific heats
$
\g
amma$
(code variable
`_C.gamma`
). A barotropic EOS
of specific heats
*γ*
(code variable
`_C.gamma`
). A barotropic EOS
is consistent with solving no energy equation.
**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
NIRVANA also permits the implementation of a tabulated EOS. However, the
procedure is more involved and requires the creation of look-up tables
for the logarithm of pressure,
$
\
l
og
p$
, and logarithm of temperature,
$
\
l
og
T$
, both as functions of the logarithm of mass density
$
\v
arrho$
and the logarithm of thermal energy density
$
\v
arepsilon$. The look-up
tables for a prescribed
$(
\l
og
\v
arrho,
\l
og
\v
arepsilon)$
-range
are
generated by cubic interpolation from user-specified data
$
\
{
(
\
l
og
p)_{ij}
\}
$
and
$
\
{
(
\
l
og
T)_{ij}
\}
$ on an rectilinear mesh
$
\{
(
\l
og
\v
arrho)_i
\}\t
i
mes
\
{
(
\
l
og
\v
arepsilon)_j
\}
$, $i=0,{
\t
t n1}-1$ and
$j=0,{
\t
t
n2
}
-1
$
with
`
n1
`
$
\t
imes$
`
n2
`
the number of mesh points.
for the logarithm of pressure, log
*p*
, and logarithm of temperature,
log
*T*
, both as functions of the logarithm of mass density
log 𝜚
and the logarithm of thermal energy density
*ε*
.
The look-up
tables for a prescribed
(log 𝜚, log
*ε*
)
-range
are
generated by cubic interpolation from user-specified data
{(log
*p*
)
<sub>
*ij*
</sub>
}
and
(
{(log
*T*
)
<sub>
*ij*
</sub>
})
on an rectilinear
mes
h
{(log
𝜚)
<sub>
*i*
</sub>
} × {(log
*ε*
)
<sub>
*j*
</sub>
},
*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
`eosTabPressureUser()`
in module
`eosTabPressureUser.c`
for
$
\
l
og
p$
,
`eosTabPressureUser()`
in module
`eosTabPressureUser.c`
for log
*p*
,
and in the function
`eosTabTemperatureUser()`
in module
`eosTabTemperatureUser.c`
for
$
\
l
og
T$
.
`eosTabTemperatureUser.c`
for log
*T*
.
In both,
`eosTabPressureUser()`
and
`eosTabTemperatureUser()`
, the user
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
Here is an example how to code
`eosTabPressureUser()`
taken from
testproblem
`/nirvana/testproblem/MHD/problem1B`
which provides data for
the standard EOS of caloric type,
$p=(
\g
amma -1)
\v
arepsilon$
, in
the standard EOS of caloric type,
*p*
=(
*γ*
− 1)
*ε*
, in
tabulated form:
UTAB eosTabPressureUser(void)
...
...
@@ -1713,14 +1713,14 @@ tabulated form:
First, the number of mesh points,
`ut.n1`
and
`ut.n2`
, in
$
\l
og
\v
arrho$-direction and $
\l
og
\v
arepsilon$-direction is set. It
follows the range
\[
`ut.u1_lo`
,
`ut.u1_up`
\]
for
$
\
l
og
\v
arrho$
and
\[
`ut.u2_lo`
,
`ut.u2_up`
\]
for
$
\
l
og
\v
arepsilon$
, respectively. Then, the
2D array
`ut.dt2`
is allocated and
$
\
{
(
\
l
og
p)_{ij}
\}
$ data is assigned.
`ut`
is returned and used by the code to finally create
the look-up
table
`_TABLP`
. Actually,
`_TABLP`
is a (global) pointer of
struct type
`TAB`
(declared in the header file
`tabular.h`
) and represents
the
tabulated EOS
$
\
l
og
p(
\l
og
\v
arrho,
\l
og
\v
arepsilon)$
. Correspondingly,
coding
`eosTabTemperatureUser()`
for
$
\
l
og
T$
would provide the input
follows the range
\[
`ut.u1_lo`
,
`ut.u1_up`
\]
for log
𝜚
and
\[
`ut.u2_lo`
,
`ut.u2_up`
\]
for
log
*ε*
, respectively. Then, the
2D array
`ut.dt2`
is allocated and {(log
*p*
)
<sub>
*ij*
</sub>
}
data is assigned.
`ut`
is returned and used by the code to finally create
the look-up
table
`_TABLP`
. Actually,
`_TABLP`
is a (global) pointer of
struct type
`TAB`
(declared in the header file
`tabular.h`
) and represents
the
tabulated EOS log
*p*
(log 𝜚, log
*ε*
)
. Correspondingly,
coding
`eosTabTemperatureUser()`
for log
*T*
would provide the input
for the look-up table
`_TABLT`
.
`_TABLP`
and
`_TABLT`
are used in the
code function
`TDeos()`
in module
`utilTD.c`
.
...
...
...
...