Changes
Page history
version 4.2
authored
Oct 28, 2025
by
Udo Ziegler
Show whitespace changes
Inline
Side-by-side
3-NIRVANA-user-guide/3.1-Code-basics.md
View page @
45559e08
...
...
@@ -118,7 +118,7 @@ density only contains the residual magnetic field part. More details:
[
Physics
guide
](
https://gitlab.aip.de/ziegler/NIRVANA/-/tree/master/doc/pdf/PhysicsGuide.pdf
)
.
Use of the magnetic field splitting scheme is controlled in the header
file
[
`nirvanaUser.h`
](
#user-controllable-macros
)
and definition of the
file
[
`nirvanaUser.h`
](
3.2-User-interfaces
#user-controllable-macros
)
and definition of the
background magnetic field in module
[
`sourceB0User.c`
](
3.2-User-interfaces#user-defined-background-magnetic-field
)
.
...
...
@@ -152,21 +152,21 @@ arrays are essential in code usage. The code fragment
demonstrates how to create, for instance,
-
\(
i
\)
a vector
`v[ix]`
,
\
.
..
`nx`
, of
`int`
type with
`nx`
+1 elements
-
\(
i
\)
a vector
`v[ix]`
,
0
...
`nx`
, of
`int`
type with
`nx`
+1 elements
using the function
`Arrayi()`
,
-
\(
ii
\)
a 2D array
`A2[iy][ix]`
,
\
.
..
`nx`
,
\
.
..
`ny`
, of
`double`
type
-
\(
ii
\)
a 2D array
`A2[iy][ix]`
,
0
...
`nx`
,
0
...
`ny`
, of
`double`
type
with (
`nx`
+1)$
\t
imes$(
`ny`
+1) elements using the function
`Array2()`
,
-
\(
iii
\)
a 3D array
`A3[iz][iy][ix]`
,
\
.
..
`nx`
,
\
.
..
`ny`
,
\
.
..
`nz`
, of
-
\(
iii
\)
a 3D array
`A3[iz][iy][ix]`
,
0
...
`nx`
,
0
...
`ny`
,
0
...
`nz`
, of
`double`
type with (
`nx`
+1)$
\t
imes$(
`ny`
+1)$
\t
imes$(
`nz`
+1) elements
using the function
`Array3()`
and its subsequent deallocation. Note that in multi-d arrays the fastest
index representing the $x$-direction is rightmost.
**Important
.
**
Allocation of an array must always be followed by its
**Important
:
**
Allocation of an array must always be followed by its
deallocation when it is no longer used in order to free memory
resources.
...
...
@@ -184,8 +184,8 @@ struct type `GRD`, i.e. `*GRD`. The `GRD` struct type is declared in the
header file
`nirvana.h`
and contains all grid information (attributes,
coordinates, variables arrays, etc.). Dereferencing
`gm`
to
`gm[l]`
,
gives the first superblock in a linked list collecting all superblocks
belonging to mesh refinement level
$l$
.
`gm[l]`
, like any superblock, is
of
`GRD`
type, i.e., a pointer to struct
`GRD`
. The base level,
$l
=0$,
belonging to mesh refinement level
`l`
.
`gm[l]`
, like any superblock, is
of
`GRD`
type, i.e., a pointer to struct
`GRD`
. The base level,
`l`
=0$,
spanning the computational domain starts with pointer
`gm[0]`
. In
uniform grid simulations that is the only list existing. The superblocks
of a refinement level $l$ are obtained by running through the
...
...
...
...