Changes
Page history
version 4.2
authored
Oct 28, 2025
by
Udo Ziegler
Hide whitespace changes
Inline
Side-by-side
3-NIRVANA-user-guide/3.1-Code-basics.md
View page @
91dc49b4
...
@@ -389,9 +389,9 @@ The mesh refinement algorithm relies on the oct-tree data structure of
...
@@ -389,9 +389,9 @@ The mesh refinement algorithm relies on the oct-tree data structure of
generic blocks (fixed size of 4 cells per direction) represented by the
generic blocks (fixed size of 4 cells per direction) represented by the
master mesh pointer
`_G0`
(of type
`*GRD`
). A generic block of
master mesh pointer
`_G0`
(of type
`*GRD`
). A generic block of
refinement level $l$ has cell spacings
refinement level $l$ has cell spacings
$(
\d
x^{(l)},
\d
y^{(l)},
\d
z^{(l)})=
$(
\d
elta
x^{(l)},
\d
elta
y^{(l)},
\d
elta
z^{(l)})=
(
\d
x^{(0)},
\d
y^{(0)},
\d
z^{(0)})/2^l$ where
(
\d
elta
x^{(0)},
\d
elta
y^{(0)},
\d
elta
z^{(0)})/2^l$ where
$(
\d
x^{(0)},
\d
y^{(0)},
\d
z^{(0)})$ is the cell spacing of the base
$(
\d
elta
x^{(0)},
\d
elta
y^{(0)},
\d
elta
z^{(0)})$ is the cell spacing of the base
level, i.e., resolution doubles each time when refined.
level, i.e., resolution doubles each time when refined.
Starting on the base level ($l=0$) mesh refinements are realized by
Starting on the base level ($l=0$) mesh refinements are realized by
...
@@ -405,24 +405,24 @@ individually selected by the user. The standard implementation covers
...
@@ -405,24 +405,24 @@ individually selected by the user. The standard implementation covers
the following criteria:
the following criteria:
-
derivatives-based (most important in practice):
-
derivatives-based (most important in practice):
$
\l
eft[
\a
lpha
\f
rac{|
\d
U|}{|U|+U_
\m
athrm{ref}}+(1-
\a
lpha)
$
$
\l
eft[
\a
lpha
\f
rac{|
\d
elta
U|}{|U|+U_
\m
athrm{ref}}+(1-
\a
lpha)
\f
rac{|
\d
^2U|}{|
\d
U|+{
\r
m FILTER}
\c
dot(|U|+U_
\m
athrm{ref})}
\r
ight]
\f
rac{|
\d
elta
^2U|}{|
\d
elta
U|+{
\r
m FILTER}
\c
dot(|U|+U_
\m
athrm{ref})}
\r
ight]
\l
eft(
\f
rac{
\d
x^{(l)}}{
\d
x^{(0)}}
\r
ight)^{
\x
i}
\l
eft(
\f
rac{
\d
elta
x^{(l)}}{
\d
elta
x^{(0)}}
\r
ight)^{
\x
i}
\l
eft
\{\b
egin{array}{ll}
\l
eft
\{\b
egin{array}{ll}
>\mathcal{E}_{U} &\exists U \quad\hbox{refinement}\\
>\mathcal{E}_{U} &\exists U \quad\hbox{refinement}\\
<0.8
\m
athcal{E}_{U} &
\f
orall U
\q
uad
\h
box{derefinement}
\\
<0.8
\m
athcal{E}_{U} &
\f
orall U
\q
uad
\h
box{derefinement}
\\
\e
nd{array}
\r
ight.$
\e
nd{array}
\r
ight.$
$
The criterion is applied to physical variables $U$
The criterion is applied to physical variables $U$
($=\{\varrho,\mathbf{m},e,\mathbf{B},C_\mathrm{c}\}$). Undivided
($=\{\varrho,\mathbf{m},e,\mathbf{B},C_\mathrm{c}\}$). Undivided
first ($\d U$) and second ($\d^2U$) differences are computed along
first ($\d
elta
U$) and second ($\d
elta
^2U$) differences are computed along
various spatial directions. The switch $\alpha\in [0,1]$ (code
various spatial directions. The switch $\alpha\in [0,1]$ (code
parameter: `_C.amr_d1`) selects between a purely gradient-based
parameter: `_C.amr_d1`) selects between a purely gradient-based
criterion ($\alpha =1$) and a purely second-derivatives-based
criterion ($\alpha =1$) and a purely second-derivatives-based
criterion ($\alpha =0$). $U_\mathrm{ref}$ are reference values to
criterion ($\alpha =0$). $U_\mathrm{ref}$ are reference values to
avoid division by zero for indefinite variables. The exponent
avoid division by zero for indefinite variables. The exponent
$\xi\in [0,2]$ (code parameter: `_C.amr_exp`) introduces a power law
$\xi\in [0,2]$ (code parameter: `_C.amr_exp`) introduces a power law
functional on the grid spacing ratio $\d x^{(l)}/\d x^{(0)}$ which
functional on the grid spacing ratio $\d
elta
x^{(l)}/\d
elta
x^{(0)}$ which
allows to tune the behavior with progressive mesh refinement. The
allows to tune the behavior with progressive mesh refinement. The
macro `FILTER` (preset to $10^{-2}$) is a filter to suppress
macro `FILTER` (preset to $10^{-2}$) is a filter to suppress
refinement at small-scale solution wiggles. The individual
refinement at small-scale solution wiggles. The individual
...
@@ -439,11 +439,11 @@ the following criteria:
...
@@ -439,11 +439,11 @@ the following criteria:
-
Jeans-length-based (important in simulations involving selfgravity):
-
Jeans-length-based (important in simulations involving selfgravity):
$$
\l
eft(
\f
rac{
\p
i}{G}
\f
rac{c_s^2}{
\v
arrho}
\r
ight)^{1/2}
$$
\l
eft(
\f
rac{
\p
i}{G}
\f
rac{c_s^2}{
\v
arrho}
\r
ight)^{1/2}
\c
dot
\m
athcal{E}_
\m
athrm{Jeans}
\l
eft
\{\b
egin{array}{ll}
\c
dot
\m
athcal{E}_
\m
athrm{Jeans}
\l
eft
\{\b
egin{array}{ll}
<
\d
s &
\m
box{refinement}
\\
<
\d
elta
s &
\m
box{refinement}
\\
>1.25\d s & \mbox{derefinement}\\
>1.25\d
elta
s & \mbox{derefinement}\\
\e
nd{array}
\r
ight.$$ where the first factor is the local Jeans
\e
nd{array}
\r
ight.$$ where the first factor is the local Jeans
length with $c_s$ the sound speed and $G$ the gravitational
length with $c_s$ the sound speed and $G$ the gravitational
constant, and where $
\d
s=
\m
in
\{\d
x,h_y
\d
y, h_z
\d
z
\}
$.
constant, and where $
\d
elta
s=
\m
in
\{\d
elta
x,h_y
\d
elta
y, h_z
\d
elta
z
\}
$.
$
\m
athcal{E}_
\m
athrm{Jeans}$ is a user-specific threshold giving the
$
\m
athcal{E}_
\m
athrm{Jeans}$ is a user-specific threshold giving the
fraction of the local Jeans length to be resolved by at least 1 grid
fraction of the local Jeans length to be resolved by at least 1 grid
cell.
cell.
...
@@ -453,8 +453,8 @@ the following criteria:
...
@@ -453,8 +453,8 @@ the following criteria:
$$2
\p
i
\l
eft(
\f
rac{
\k
appa T}{
\m
ax
\l
eft
\{
T
\l
eft(
\f
rac{
\p
artial L}{
\p
artial T}
\r
ight)_{
\v
arrho}
$$2
\p
i
\l
eft(
\f
rac{
\k
appa T}{
\m
ax
\l
eft
\{
T
\l
eft(
\f
rac{
\p
artial L}{
\p
artial T}
\r
ight)_{
\v
arrho}
-
\v
arrho
\l
eft(
\f
rac{
\p
artial L}{
\p
artial
\v
arrho}
\r
ight)_{T},EPS
\r
ight
\}
}
-
\v
arrho
\l
eft(
\f
rac{
\p
artial L}{
\p
artial
\v
arrho}
\r
ight)_{T},EPS
\r
ight
\}
}
\r
ight)^{1/2}
\c
dot
\m
athcal{E}_
\m
athrm{Field}
\l
eft
\{\b
egin{array}{ll}
\r
ight)^{1/2}
\c
dot
\m
athcal{E}_
\m
athrm{Field}
\l
eft
\{\b
egin{array}{ll}
<
\d
s &
\m
box{refinement}
\\
<
\d
elta
s &
\m
box{refinement}
\\
>1.25\d s & \mbox{derefinement}\\
>1.25\d
elta
s & \mbox{derefinement}\\
\e
nd{array}
\r
ight.$$ where the first factor is the Field length with
\e
nd{array}
\r
ight.$$ where the first factor is the Field length with
$L(
\v
arrho, T)$ the density- and temperature-dependent heatloss
$L(
\v
arrho, T)$ the density- and temperature-dependent heatloss
function and $
\k
appa$ the thermal conduction coefficient.
function and $
\k
appa$ the thermal conduction coefficient.
...
...
...
...