Changes
Page history
version 4.1 update
authored
Mar 21, 2022
by
Udo Ziegler
Hide whitespace changes
Inline
Side-by-side
4-CAIVS-user-guide/4.2-User-interfaces.md
View page @
a8fafd94

`4`

`4
.1
`
CONTENTS:
[
Specification of parameters
](
4.2-User-interfaces#specification-of-parameters
)
[
User-defined variables
](
4.2-User-interfaces#user-defined-variables
)
[
User-defined variables
](
4.2-User-interfaces#user-defined-variables
)
[
Modification of input data
](
4.2-User-interfaces#modification-of-input-data
)
There are
two
user interfaces:
There are
3
user interfaces:
-
`caivs.par`
– specification of CAIVS parameters
-
`variablesUser.c`
– definition of user variables
-
`modifyDataUser.c`
- modification of input data
### Specification of parameters
CAIVS requires the parameter file
`caivs.par`
as input. In this file the
...
...
@@ -35,9 +38,11 @@ like
>DATA INPUT --------------------------------------------------------------------
/work2/ziegler/viz/ >data_dir
0001471 000000 >datafile_{number,sequence}
0 >data_modify:{0,1}
There are two parameter lines here containing 1 (
`/work2/ziegler/viz/`
)
respective 2 (
`0001471`
and 000000) parameters.
There are 3 parameter lines here containing, from top to bottom, 1 parameter
(
`/work2/ziegler/viz/`
), 2 parameters (
`0001471`
and 000000) and 1 parameter,
respectively.
A complete list of parameters for each category is presented next.
Parameter lines are marked with a 2-digit running number for a clear
...
...
@@ -58,6 +63,7 @@ uniform grid.
>DATA INPUT --------------------------------------------------------------------
01 /work2/ziegler/viz/ >data_dir
02 0001471 000000 >datafile_{number,sequence}
03 0 >data_modify:{0,1}
-
`01`
(
`_CC.data_dir`
)
...
...
@@ -86,11 +92,19 @@ uniform grid.
`_CC.datafile_sequence` starting with cycle number given by
`_CC.datafile_number`.
-
`03`
(
`_CC.data_modify`
)
- `_CC.data_modify` ({0,1}): option to allow a modification of
NIRVANA input data. If set to 1, the user interface
[modifyDataUser.c](4.2-User-interfaces#modification-of-input-data)
is called prior to data export which permits to manipulate physical
variables.
**DATA EXPORT**
:
>DATA EXPORT -------------------------------------------------------------------
01 /work2/ziegler/viz/ >export_dir
02 NIR 0001471 >format:{NIR,SILO,CSV,HDF},filenumber
02 NIR 0001471 >format:{NIR,SILO,CSV,HDF
,RAW
},filenumber
03 4 >precision:[2,8]
04 0 >vars_files:{0,1}
...
...
@@ -101,7 +115,7 @@ uniform grid.
-
`02`
(
`_CC.format`
,
`_CC.filenumber`
)
- `_CC.format` ({NIR,SILO,CSV,HDF}): output data format. Possible
- `_CC.format` ({NIR,SILO,CSV,HDF
,RAW
}): output data format. Possible
values are
- NIR: CAIVS native format
...
...
@@ -112,6 +126,8 @@ uniform grid.
- HDF: HDF5 format
- RAW: raw arrays format
- `_CC.filenumber`: number of the (first) output file. In case of
a snapshot sequence the output file number is incremented by one
from snapshot to snapshot.
...
...
@@ -140,6 +156,7 @@ uniform grid.
06 0 >cell_centering:{0,1}
07 0 >grid_overlap:{0,1}
08 1 1 >coord_transform:{0,1},vector_transform:{0,1}
09 1 1. >coord_local:{0,1},coord_unit
-
`01`
(
`_CC.max_level`
)
...
...
@@ -223,6 +240,13 @@ uniform grid.
components. By default (value=0), vector components are not
transformed.
-
`09`
(
`_CC.coord_local`
,
`_CC.coord_unit`
)
- `_CC.coord_local` ({0,1}): option to shift the coordinate origin
to the middle of selected spatial domain.
- `_CC.coord_unit`: length scaling factor for coordinates.
**VARIABLES**
:
>VARIABLES ---------------------------------------------------------------------
...
...
@@ -405,6 +429,60 @@ the flow vorticiy ∇ × (**m**/𝜚), one-sided discretization formulas or
extrapolation techniques may be needed to accurately compute derivatives
at
`g`
boundary cells.
*
### Modification of input data
The module
`modifyDataUser.c`
serves as template for a user-controlled
modification of input data before it is exported to one of the CAIVS output
data formats. The function is only called when parameter
`_CC.data_modify`
is set to 1 in the user interface
[
caivs.par
](
4.2-User-interfaces#specification-of-parameters
)
.
In the call of
`modifyDataUser()`
the function argument is a superblock
pointer
`g`
:
modifyDataUser(g);
For comments on
`g`
and the list of available physical variables
see the previous paragragh
[
User-defined variables
](
4.2-User-interfaces#user-defined-variables
)
.
To give an example, the following code fragment adds a background dipole magnetic field
(taken from NIRVANA testproblem
`MHD/problem30`
)
to the imported magnetic field:
int ix,iy,iz;
double B0eq,rE,r,r2,r3;
/* MAGNETIC FIELD INCREASED BY BACKGROUND MAGNETIC FIELD TO VISUALIZE THE
TOTAL FIELD IN NIRVANA TESTPROBLEM MHD/problem30 */
B0eq=-3.12e-05;
rE=6.378e+06;
/* ADD B0 X-COMPONENT */
for(iz=0; iz<=g->nz; iz++)
for(iy=0; iy<=g->ny; iy++)
for(ix=0; ix<=g->nx; ix++)
{
r2=g->x[ix]*g->x[ix]+g->yc[iy]*g->yc[iy]+g->zc[iz]*g->zc[iz];
r=sqrt(r2);
r3=pow(rE/r,3.);
g->bx[iz][iy][ix]+=B0eq*r3*(3.*g->zc[iz]/r2*g->x[ix]);
}
/* ADD B0 Y-COMPONENT */
for(iz=0; iz<=g->nz; iz++)
for(iy=0; iy<=g->ny; iy++)
for(ix=0; ix<=g->nx; ix++)
{
r2=g->xc[ix]*g->xc[ix]+g->y[iy]*g->y[iy]+g->zc[iz]*g->zc[iz];
r=sqrt(r2);
r3=pow(rE/r,3.);
g->by[iz][iy][ix]+=B0eq*r3*(3.*g->zc[iy]/r2*g->y[iy]);
}
PREV:
[
4.1 Purpose
](
https://gitlab.aip.de/ziegler/NIRVANA/-/wikis/4-CAIVS-user-guide/4.1-Purpose
)
NEXT:
[
4.3 Log file
](
https://gitlab.aip.de/ziegler/NIRVANA/-/wikis/4-CAIVS-user-guide/4.3-Log-file
)
\ No newline at end of file
PREV:
[
4.1 Purpose
](
https://gitlab.aip.de/ziegler/NIRVANA/-/wikis/4-CAIVS-user-guide/4.1-Purpose
)
NEXT:
[
4.3 Log file
](
https://gitlab.aip.de/ziegler/NIRVANA/-/wikis/4-CAIVS-user-guide/4.3-Log-file
)