Simulation parameters#
All Struphy simulation parameters can be set in the .yml parameter file. For each model,
a default file can be created via:
struphy params MODEL
The file is saved in the current input path (struphy -p, under /inp)
and can be modified and renamed. An example of such a file is given
here.
Struphy simulation parameters fall into three classes, addressed by
up to 8 different keys in the .yml file:
Discretization parameters:
Space grid parameters (under the key
grid)Time stepping parameters (under the key
time)
Physics parameters:
Units (under the key
units)Geometry (under the key
geometry)Fluid background (under the key
fluid_background)
Species parameters:
Electromagnetic fields (under the key
em_fields)Fluid variables (under the key
fluid)Kinetic variables (under the key
kinetic)
The .yml parameter file has a generic structure for all Struphy models.
The keys grid, time, units and geometry are present
in every model; moreover, at least one of the three
species types em_fields, fluid and kinetic must be present
in each model, relating to the model variable(s). An fluid_background
is not mandatory.
The structure of the dictionaries under each of the 8 top-level keys is discussed below. Special information is available on how to set Initial conditions and Boundary conditions.
Some hints for editing a parameter file:
Strings can either be set as e.g.
'Cuboid'orCuboid, i.e. with or without quotes - both works.The parameter
nullwill be transformed to Python’sNonetype.Available geometries can be found in Geometry
Available fluid equilibria can be found in Fluid backgrounds
Available kinetic backgrounds can be found in kinetic_backgrounds
Available fluid backgrounds can be found in Available fluid equilibria
Available perturbations can be found in Perturbations
Space grid parameters#
Struphy uses a tensor-product grid in three dimensions for space discretization.
Example:
grid :
Nel : [12, 14, 4]
p : [3, 4, 2]
spl_kind : [False, True, True]
dirichlet_bc : [[False, False], [False, False], [False, False]]
dims_mask : [True, True, True]
nq_el : [2, 2, 2]
nq_pr : [2, 2, 2]
polar_ck : -1
Parameters:
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Number of elements (grid cells) in each direction. |
3-list[int] |
|
|
Spline degree in each direction. |
3-list[int] |
|
|
Kind of spline in each direction (see Uni-variate spline spaces). |
3-list[bool] |
|
|
Homogeneous Dirichlet boundary conditions at left and/or right boundary in each direction. |
3-list[2-list[int]] |
|
|
Allow domain decomposition of direction. |
3-ist[bool] |
|
|
Number of quadrature points per element (e.g. for L2-projections) in each direction. |
List[int] |
|
|
Quadrature points between Greville points (for commuting projectors) in each direction. |
List[int] |
|
|
\(C^k\) smoothness of B-splines at polar singularity \(\eta_1=0\) for polar geometries. |
int |
|
These paramters are primarily used to instantiate struphy.feec.psydac_derham.Derham.
Time stepping parameters#
Example:
time :
dt : 0.005
Tend : 0.015
split_algo : LieTrotter
Parameters:
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Time step in units given by a model’s Normalization (inspect via |
float |
|
|
End time in same units as |
float |
|
|
Time splitting algorithm |
str |
|
Units#
Example:
units :
x : 1.
B : 1.
n : 1.
kBT : 1.
Parameters:
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Length scale unit in Meter (m). |
float |
|
|
Magnetic field unit in Tesla (T). |
float |
|
|
Number density unit in \(10^{20}\ m^{-3}\). |
float |
|
|
Thermal energy unit in keV (optional). |
float |
Theses base units are used to derive all other units via struphy.io.setup.derive_units().
See also Normalization for details.
Geometry#
Example:
geometry :
type : Cuboid
Cuboid : {}
Parameters:
Fluid background#
Example:
fluid_background :
HomogenSlab : {}
Parameters:
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Class name and parameters for the equilibrium. If empty, the defaults are taken. |
dict |
Electromagnetic fields#
Initial conditions are the sum of background + perturbation, see Initial conditions.
Example:
em_fields :
background:
phi :
LogicalConst :
values : 1.3
A :
LogicalConst :
values : [.3, .15, null]
perturbation :
phi:
TorusModesCos :
given_in_basis : '0'
A :
ms : [1]
A:
TorusModesCos :
given_in_basis : [null, 'v', null]
ms : [null, [1, 3], null]
Parameters:
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Name of variable to be initialized. |
dict |
Contains class name and parameters for the static background, see Available fluid equilibria. If empty, the defaults are taken. |
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Name of variable to be initialized. |
dict |
Contains class name and parameters for the perturbation, see Perturbations. If empty, the defaults are taken. |
Fluid variables#
There can be multiple fluid species in a Struphy model,
each of which has its paramaters under a key <species_name>.
For each species, there are
physical parameters
phys_params,initial conditions as the sum of
background+perturbation, see Initial conditions.
Example (one fluid species):
fluid :
<species_name> :
phys_params:
A : 1
Z : 1
background :
velocity :
LogicalConst :
values : [null, 1.5, null]
density :
LogicalConst :
values : 2.3
perturbation :
density :
TorusModesCos :
given_in_basis : '0'
ms : [1, 3]
Parameters:
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Mass number in units of proton mass. |
float |
\(A=1/1836\) for electrons. |
|
Signed charge number in units of elementary charge. |
int |
\(Z=-1\) for electrons. |
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Name of variable to be initialized. |
dict |
Contains class name and parameters for the static background, see Available fluid equilibria. If empty, the defaults are taken. |
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Name of variable to be initialized. |
dict |
Contains class name and parameters for the perturbation, see Perturbations. If empty, the defaults are taken. |
Kinetic variables#
There can be multiple kinetic species in a Struphy model,
each of which has its paramaters under a key <species_name>.
For each species, there are
physical parameters
phys_params,information on the
markers,parameters for saving kinetic data
save_data,initial conditions as the sum of
background+perturbation, see Initial conditions.
For kinetic species, the background is mandatory.
Example (one kinetic species):
kinetic :
<species_name> :
phys_params :
A : 1
Z : 1
markers :
type : full_f
ppc : null
Np : 1000
bufsize : .25
bc :
type : [remove, periodic, periodic]
remove : boundary_transfer
loading :
type : pseudo_random
seed : 1234
moments : [0., 0., 0., 1., 1., 1.]
spatial : uniform
dir_external : 'path_to_particles'
dir_particles : 'path_to_particles'
dir_particles_abs : 'path_to_particles'
save_data :
n_markers : 3
f :
slices : [v1, e1_v1]
n_bins : [[32], [32, 32]]
ranges : [[[-3., 3.]], [[0., 1.], [-5., 5.]]]
background :
Maxwellian3D :
n : 0.05
u2 : 2.5
perturbation :
n :
TorusModesCos :
given_in_basis : '0'
ms : [1, 3]
Parameters:
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Mass number in units of proton mass. |
float |
\(A=1/1836\) for electrons. |
|
Signed charge number in units of elementary charge. |
int |
\(Z=-1\) for electrons. |
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Total number of markers. |
int |
|
|
Number of markers per grid cell. |
int |
Takes effect only if |
|
Number of markers per sorting box. |
int |
Takes effect only if both |
|
Size of MPI-buffer in markers array as fraction of markers per process. |
float |
|
|
Marker boundary conditions. See |
dict |
|
|
How to load random markers. |
dict |
|
|
Whether to use a Control variate method for noise reduction (only if |
bool |
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Number of markers to be saved during simulation. Markers with an ID less than |
int |
|
|
Binning plots of the distribution function in phase space. |
dict |
|
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Class name and parameters for the static kinetic background. If empty, the defaults are taken. |
dict |
See kinetic_backgrounds. |
Name |
Description |
Format |
Choices |
|---|---|---|---|
|
Name of moment to be initialized. |
dict |
Contains class name and parameters for the perturbation, see Perturbations. If empty, the defaults are taken. |