This module contains the subroutines which set the initial value of the fields and the distribution function.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | private | :: | ginitopt_switch | ||||
integer, | private, | parameter | :: | ginitopt_default | = | 1 | |
integer, | private, | parameter | :: | ginitopt_xi | = | 3 | |
integer, | private, | parameter | :: | ginitopt_xi2 | = | 4 | |
integer, | private, | parameter | :: | ginitopt_rh | = | 5 | |
integer, | private, | parameter | :: | ginitopt_zero | = | 6 | |
integer, | private, | parameter | :: | ginitopt_test3 | = | 7 | |
integer, | private, | parameter | :: | ginitopt_convect | = | 8 | |
integer, | private, | parameter | :: | ginitopt_noise | = | 10 | |
integer, | public, | parameter | :: | ginitopt_restart_many | = | 11 | |
integer, | private, | parameter | :: | ginitopt_continue | = | 12 | |
integer, | private, | parameter | :: | ginitopt_nl | = | 13 | |
integer, | private, | parameter | :: | ginitopt_kz0 | = | 14 | |
integer, | private, | parameter | :: | ginitopt_restart_small | = | 15 | |
integer, | private, | parameter | :: | ginitopt_nl2 | = | 16 | |
integer, | private, | parameter | :: | ginitopt_nl3 | = | 17 | |
integer, | private, | parameter | :: | ginitopt_nl4 | = | 18 | |
integer, | private, | parameter | :: | ginitopt_nl5 | = | 19 | |
integer, | private, | parameter | :: | ginitopt_alf | = | 20 | |
integer, | private, | parameter | :: | ginitopt_kpar | = | 21 | |
integer, | private, | parameter | :: | ginitopt_nl6 | = | 22 | |
integer, | private, | parameter | :: | ginitopt_nl7 | = | 23 | |
integer, | private, | parameter | :: | ginitopt_gs | = | 24 | |
integer, | private, | parameter | :: | ginitopt_recon | = | 25 | |
integer, | private, | parameter | :: | ginitopt_nl3r | = | 26 | |
integer, | private, | parameter | :: | ginitopt_smallflat | = | 27 | |
integer, | private, | parameter | :: | ginitopt_harris | = | 28 | |
integer, | private, | parameter | :: | ginitopt_recon3 | = | 29 | |
integer, | private, | parameter | :: | ginitopt_ot | = | 30 | |
integer, | private, | parameter | :: | ginitopt_zonal_only | = | 31 | |
integer, | private, | parameter | :: | ginitopt_single_parallel_mode | = | 32 | |
integer, | private, | parameter | :: | ginitopt_all_modes_equal | = | 33 | |
integer, | private, | parameter | :: | ginitopt_default_odd | = | 34 | |
integer, | private, | parameter | :: | ginitopt_restart_eig | = | 35 | |
integer, | private, | parameter | :: | ginitopt_no_zonal | = | 36 | |
integer, | private, | parameter | :: | ginitopt_stationary_mode | = | 37 | |
integer, | private, | parameter | :: | ginitopt_cgyro | = | 38 | |
integer, | private, | parameter | :: | ginitopt_random_sine | = | 39 | |
integer, | private, | parameter | :: | ginitopt_constant | = | 40 | |
real, | private | :: | width0 | ||||
real, | private | :: | dphiinit | ||||
real, | private | :: | phiinit | ||||
real, | private | :: | imfac | ||||
real, | private | :: | refac | ||||
real, | private | :: | zf_init | ||||
real, | private | :: | phifrac | ||||
real, | private | :: | init_spec_pow | ||||
real, | private | :: | den0 | ||||
real, | private | :: | upar0 | ||||
real, | private | :: | tpar0 | ||||
real, | private | :: | tperp0 | ||||
real, | private | :: | den1 | ||||
real, | private | :: | upar1 | ||||
real, | private | :: | tpar1 | ||||
real, | private | :: | tperp1 | ||||
real, | private | :: | den2 | ||||
real, | private | :: | upar2 | ||||
real, | private | :: | tpar2 | ||||
real, | private | :: | tperp2 | ||||
real, | public | :: | tstart | ||||
real, | private | :: | scale | ||||
real, | private | :: | apar0 | ||||
logical, | private | :: | chop_side | ||||
logical, | private | :: | clean_init | ||||
logical, | private | :: | left | ||||
logical, | private | :: | even | ||||
logical, | public | :: | new_field_init | ||||
logical, | public | :: | initial_condition_is_nonadiabatic_dfn | ||||
character(len=run_name_size), | public | :: | restart_file | ||||
character(len=150), | private | :: | restart_dir | ||||
integer, | private, | dimension(2) | :: | ikk | |||
integer, | private, | dimension(2) | :: | itt | |||
integer, | private, | dimension(3) | :: | ikkk | |||
integer, | private, | dimension(3) | :: | ittt | |||
complex, | private, | dimension(3) | :: | phiamp | |||
complex, | private, | dimension(3) | :: | aparamp | |||
integer, | private | :: | restart_eig_id | ||||
integer, | private | :: | max_mode | ||||
integer, | private | :: | ikpar_init | ||||
real, | private | :: | kpar_init | ||||
integer, | private | :: | ikx_init |
This is used in linear runs with flow shear in order to track the evolution of a single Lagrangian mode. |
|||
real, | private | :: | phiinit0 | ||||
real, | private | :: | phiinit_rand | ||||
real, | private | :: | a0 | ||||
real, | private | :: | b0 | ||||
logical, | private | :: | null_phi | ||||
logical, | private | :: | null_bpar | ||||
logical, | private | :: | null_apar | ||||
integer, | private | :: | adj_spec | ||||
character(len=20), | private | :: | eq_type | = | '' | ||
real, | private | :: | prof_width | = | -.05 | ||
integer, | private | :: | eq_mode_n | = | 0 | ||
integer, | private | :: | eq_mode_u | = | 1 | ||
logical, | private | :: | input_check_recon | = | .false. | ||
complex, | private | :: | ukxy_pt(3) | ||||
logical, | private | :: | constant_random_flag |
Whether to use the constant_random number generator, which always gives the same random numbers. Used for testing. |
|||
logical, | private, | parameter | :: | debug | = | .false. | |
logical, | private | :: | initialized | = | .false. | ||
type(init_g_config_type), | private | :: | init_g_config |
Used to represent the input configuration of init_g
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | public | :: | exist | = | .false. |
Does the related namelist exist in the target input file? |
|
integer, | public | :: | index | = | 0 |
Used to hold the specific index of numbered namelists |
|
logical, | public | :: | skip_read | = | .false. |
Do we want to skip the read step in init? |
|
logical, | public | :: | skip_broadcast | = | .false. |
Do we want to skip the broadcast step in init? |
|
real, | public | :: | a0 | = | 0.0 |
Amplitude of equilibrium |
|
integer, | public | :: | adj_spec | = | 0 |
Used by ginit_option |
|
real, | public | :: | apar0 | = | 0.0 |
Used by ginit_option |
|
complex, | public, | dimension(3) | :: | aparamp | = | cmplx(0.0, 0.0) |
Used in initialization for the Orszag-Tang 2D vortex problem
(ginit_option |
real, | public | :: | b0 | = | 0.0 |
Amplitude of equilibrium |
|
logical, | public | :: | chop_side | = | .true. |
Rarely needed. Forces asymmetry into initial condition. Warning: This does not behave as one may expect in flux tube simulations (see clean_init), this can be important as the default is to use chop_side |
|
logical, | public | :: | clean_init | = | .true. |
Used with ginit_option |
|
logical, | public | :: | constant_random_flag | = | .false. |
Use the constant_random number generator, which always gives the same random numbers. Useful for testing. |
|
real, | public | :: | den0 | = | 1.0 |
Amplitude of zeroth density perturbation for ginit_option options: |
|
real, | public | :: | den1 | = | 0.0 |
Amplitude of first density perturbation for ginit_option options: |
|
real, | public | :: | den2 | = | 0.0 |
Amplitude of second density perturbation for ginit_option options: |
|
real, | public | :: | dphiinit | = | 1.0 |
Amplitude of for |
|
integer, | public | :: | eq_mode_n | = | 0 |
Mode number in for the sinusoidal equilbrium option of
ginit_option |
|
integer, | public | :: | eq_mode_u | = | 1 |
Mode number in for the sinusoidal equilbrium option of
ginit_option |
|
character(len=20), | public | :: | eq_type | = | 'sinusoidal' |
Equilbrium choice for ginit_option |
|
logical, | public | :: | even | = | .true. |
Sometimes initial conditions have definite parity; this picks the parity in those cases. Affects the following choices of ginit_option: |
|
character(len=20), | public | :: | ginit_option | = | "default" |
Method for initialising |
|
integer, | public, | dimension(2) | :: | ikk | = | [1, 2] |
indices of two modes to initialise for certain options |
integer, | public, | dimension(3) | :: | ikkk | = | [1, 2, 2] |
indices of three modes to initialise for certain options |
integer, | public | :: | ikpar_init | = | 0 |
Parallel mode number to initialise for ginit_option
|
|
integer, | public | :: | ikx_init | = | -1 |
If greater than zero, initialise only the given with
ginit_option |
|
real, | public | :: | imfac | = | 0.0 |
Amplitude of imaginary part of for various ginit_option options |
|
real, | public | :: | init_spec_pow | = | 0.0 |
Initial spectrum power index. with
ginit_option |
|
logical, | public | :: | include_explicit_source_in_restart | = | .true. |
Do we want to include the explicit source terms and related timesteps when saving/restoring from the restart file. |
|
logical, | public | :: | initial_condition_is_nonadiabatic_dfn | = | .false. |
If true then the initial condition is used to set the non-adiabatic
distribution function rather than the |
|
logical, | public | :: | input_check_recon | = | .false. |
Print some debug information for ginit_option |
|
integer, | public, | dimension(2) | :: | itt | = | [1, 2] |
indices of two modes to initialise for certain options |
integer, | public, | dimension(3) | :: | ittt | = | [1, 2, 2] |
indices of three modes to initialise for certain options |
real, | public | :: | kpar_init | = | 0.0 |
Parallel mode number to initialise for ginit_option
|
|
logical, | public | :: | left | = | .true. |
If chop_side is true, chop out left side in theta if true, right side if false. Applies to: FIXME: list of initial conditions |
|
integer, | public | :: | max_mode | = | 128 |
The maximum mode number to initialise for ginit_option
|
|
logical, | public | :: | new_field_init | = | .true. |
Change fields implicit initialisation somehow |
|
logical, | public | :: | null_apar | = | .false. |
"Nullify fields". Used by ginit_option |
|
logical, | public | :: | null_bpar | = | .false. |
"Nullify fields". Used by ginit_option |
|
logical, | public | :: | null_phi | = | .false. |
"Nullify fields". Used by ginit_option |
|
complex, | public, | dimension(3) | :: | phiamp | = | cmplx(0.0, 0.0) |
Used in initialization for the Orszag-Tang 2D vortex problem. |
real, | public | :: | phifrac | = | 0.1 |
If doing multiple flux tube calculations, multiply
phiinit by |
|
real, | public | :: | phiinit | = | 1.0 |
Average amplitude of initial perturbation of each Fourier mode. Used by most ginit_option options |
|
real, | public | :: | phiinit0 | = | 0.0 |
Amplitude of equilibrium. Used by ginit_option |
|
real, | public | :: | phiinit_rand | = | 0.0 |
Amplitude of random perturbation. Used by ginit_option |
|
integer, | public | :: | proc_to_save_fields | = | 0 |
Which processor is responsible for saving/reading potentials to/from restart files. If <0 then all procs write to restart files. If >= nproc then set to proc_to_save_fields = mod(proc_to_save_fields, nproc) |
|
real, | public | :: | prof_width | = | -0.1 |
Width of "porcelli", "doubleharris" profiles in
ginit_option |
|
logical, | public | :: | read_many | = | .false. |
Restart from many restart files. If false, use a single restart file: this requires GS2 to have been built with parallel netCDF. |
|
real, | public | :: | refac | = | 1.0 |
Amplitude of real part of for various ginit_option options |
|
character(len=150), | public | :: | restart_dir | = | "./" |
Directory to read/write restart files to/from. Make sure this exists before running (see file_safety_check) |
|
integer, | public | :: | restart_eig_id | = | 0 |
Used to select with eigensolver generated restart file to load. Sets
|
|
character(len=run_name_size), | public | :: | restart_file | = | "restart_file_not_set.nc" |
Basename of restart files |
|
real, | public | :: | scale | = | 1.0 |
Rescale amplitudes of fields for restart ginit_option
options such as |
|
real, | public | :: | tpar0 | = | 0.0 |
Amplitude of zeroth parallel temperature perturbation for ginit_option options: |
|
real, | public | :: | tpar1 | = | 0.0 |
Amplitude of first parallel temperature perturbation for ginit_option options: |
|
real, | public | :: | tpar2 | = | 0.0 |
Amplitude of second parallel temperature perturbation for ginit_option options: |
|
real, | public | :: | tperp0 | = | 0.0 |
Amplitude of zeroth perpendicular temperature perturbation for ginit_option options: |
|
real, | public | :: | tperp1 | = | 0.0 |
Amplitude of first perpendicular temperature perturbation for ginit_option options: |
|
real, | public | :: | tperp2 | = | 0.0 |
Amplitude of second perpendicular temperature perturbation for ginit_option options: |
|
real, | public | :: | tstart | = | 0.0 |
Force |
|
complex, | public, | dimension(3) | :: | ukxy_pt | = | cmplx(0., 0.) |
Perturbation amplitude of parallel velocity? Used by
ginit_option |
real, | public | :: | upar0 | = | 0.0 |
Amplitude of zeroth parallel velocity perturbation for ginit_option options: |
|
real, | public | :: | upar1 | = | 0.0 |
Amplitude of first parallel velocity perturbation for ginit_option options: |
|
real, | public | :: | upar2 | = | 0.0 |
Amplitude of second parallel velocity perturbation for ginit_option options: |
|
real, | public | :: | width0 | = | -3.5 |
Width of initial perturbation Gaussian envelope in |
|
real, | public | :: | zf_init | = | 1.0 |
Amplitude of initial zonal flow perturbations relative to other modes |
Gets the default name for this namelist
Gets the default requires index for this namelist
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | unit |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | report_unit |
FIXME : Add documentation
DD>Only let proc0 do this and then broadcast as other procs don't know phiinit,phifrac etc.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(init_g_config_type), | intent(in), | optional | :: | init_g_config_in |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(out) | :: | restarted | |||
integer, | intent(in), | optional | :: | override_ginitopt_switch |
Take the existing gnew value and, assuming it is the nonadiabatic dfn, calculate the consistent potentials to set the true gnew value.
Set the smart defaults for the init_g_config_type instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(init_g_config_type), | intent(inout) | :: | self |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(init_g_config_type), | intent(in), | optional | :: | init_g_config_in |
Initialise with only the kparallel = 0 mode.
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(inout), | dimension (-ntgrid:ntgrid,ntheta0,naky) | :: | phi |
Initialise the distribution function with random noise. This is the recommended initialisation option. Each different mode is given a random amplitude between zero and one.
Initialise only with a single parallel mode specified by either ikpar_init for periodic boundary conditions or kpar_init for linked boundary conditions. Only makes sense for linear calculations. doc> reality condition for ky = 0 component:
Initialize with every parallel and perpendicular mode having equal amplitude. Only makes sense in a linear calculation. k_parallel is specified with kpar_init or with ikpar_init when periodic boundary conditions are used. EGH doc> reality condition for ky = 0 component:
"nl3": Two modes with a Gaussian envelope, and perturbation in fields of form , except for parallel velocity which uses is 90 degrees out of phase and uses . Density, parallel velocity, and perpendicular and parallel temperatures can all be controlled independently. Controlled by:
FIXME : Add documentation
FIXME : Add documentation
FIXME : Add documentation
FIXME : Add documentation
FIXME : Add documentation
FIXME : Add documentation
Orszag-Tang 2D vortex problem phi, jpar are local !! $ phi(:,1,2) = phiinit * cmplx(2.0, 0.0) ! 2 cos(y) $ phi(:,2,1) = phiinit * cmplx(1.0, 0.0) ! 2 cos(x) $ jpar(:,1,2) = apar0 * cmplx(2.0, 0.0) ! 2 cos(y) $ jpar(:,3,1) = apar0 * cmplx(2.0, 0.0) ! 4 cos(2x)
FIXME : Add documentation
FIXME : Add documentation
DD>Should this be triggered for kt_grids::reality=.true. only?
FIXME : Add documentation
FIXME : Add documentation
FIXME : Add documentation
FIXME : Add documentation
FIXME : Add documentation
FIXME : Add documentation
FIXME : Add documentation
FIXME : Add documentation
! adjust input parameters to kill initial field if wanted
Restore g
from restart files. Note that the timestep and simulation time
are restored by read_t0_from_restart_file
Uses the restart files written by the eigensolver. File to read is set by restart_eig_id
Similar to "small"
, restores fields from restart files on top of a
random background.
Restart but set all non-zonal components of the potential and the distribution function to 0. Noise can be added to these other components by setting phiinit > 0. The size of the zonal flows can be adjusted using zf_init.
The stationary mode test case is a method of testing the geometry implementation by initializing the distribution function in a particular way For collisionless runs with ky=0, we expect the solution to be time-independent (see section 3.3.1 of Ball MIT Masters thesis)
Sets g to a constant value everywhere except zonal component which is 0 Default initial conditions for CGYRO
Construct the initial condition from a sum of sine waves scaled with random amplitude up to phiinit (ky > 0) or zf_init (ky == 0). Use mode numbers up to minimum of max_mode or last resolved wave (i.e. ntheta/8).
Initialise the distribution function to a constant but satisfying forbidden regions. Can scale the zonal component separately as usual.
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (-ntgrid:,:,g_lo%llim_proc:) | :: | g | ||
complex, | intent(out), | dimension (-ntgrid:,:,g_lo%llim_proc:) | :: | gavg |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(inout), | dimension (2) | :: | vnm |
FIXME : Add documentation
Set the module level config type Will abort if the module has already been initialised to avoid inconsistencies.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(init_g_config_type), | intent(in), | optional | :: | init_g_config_in |
Reads in the init_g_knobs namelist and populates the member variables
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(init_g_config_type), | intent(inout) | :: | self |
Writes out a namelist representing the current state of the config object
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(init_g_config_type), | intent(in) | :: | self | |||
integer, | intent(in), | optional | :: | unit |
Resets the config object to the initial empty state
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(init_g_config_type), | intent(inout) | :: | self |
Broadcasts all config parameters so object is populated identically on all processors
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(init_g_config_type), | intent(inout) | :: | self |