A module for calculating and writing the main GS2 outputs.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real, | public | :: | omegatol | ||||
real, | public | :: | omegatinst | ||||
logical, | public | :: | print_line | ||||
logical, | public | :: | print_flux_line | ||||
logical, | public | :: | print_summary | ||||
logical, | public | :: | write_line | ||||
logical, | public | :: | write_flux_line | ||||
logical, | public | :: | write_omega | ||||
logical, | public | :: | write_omavg | ||||
logical, | public | :: | write_ascii | ||||
logical, | public | :: | write_gs | ||||
logical, | public | :: | write_ql_metric | ||||
logical, | public | :: | write_g | ||||
logical, | public | :: | write_gyx | ||||
logical, | public | :: | write_eigenfunc | ||||
logical, | public | :: | write_fields | ||||
logical, | public | :: | write_final_fields | ||||
logical, | public | :: | write_final_antot | ||||
logical, | public | :: | write_final_moments | ||||
logical, | public | :: | write_avg_moments | ||||
logical, | public | :: | write_parity | ||||
logical, | public | :: | write_moments | ||||
logical, | public | :: | ob_midplane | ||||
logical, | public | :: | write_final_db | ||||
logical, | public | :: | write_full_moments_notgc | ||||
logical, | public | :: | write_cross_phase | = | .false. | ||
logical, | public | :: | write_final_epar | ||||
logical, | public | :: | write_kpar | ||||
logical, | public | :: | write_heating | ||||
logical, | public | :: | write_lorentzian | ||||
logical, | public | :: | write_fluxes | ||||
logical, | public | :: | write_fluxes_by_mode | ||||
logical, | public | :: | write_verr | ||||
logical, | public | :: | write_cerr | ||||
logical, | public | :: | write_max_verr | ||||
logical, | public | :: | exit_when_converged | ||||
logical, | public | :: | use_nonlin_convergence | ||||
logical, | public | :: | dump_check1 | ||||
logical, | public | :: | dump_check2 | ||||
logical, | public | :: | dump_fields_periodically | ||||
logical, | public | :: | make_movie | ||||
logical, | public | :: | save_for_restart | ||||
logical, | public | :: | save_distfn | ||||
logical, | public | :: | save_glo_info_and_grids | ||||
logical, | public | :: | save_velocities | ||||
logical, | public | :: | write_symmetry | ||||
logical, | public | :: | write_correlation_extend | ||||
logical, | public | :: | write_correlation | ||||
logical, | public | :: | write_pflux_sym | ||||
logical, | public | :: | write_nl_flux_dist | ||||
logical, | public | :: | write_pflux_tormom | ||||
logical, | private | :: | file_safety_check | ||||
integer, | public | :: | nwrite | ||||
integer, | public | :: | igomega | ||||
integer, | public | :: | nmovie | ||||
integer, | public | :: | navg | ||||
integer, | public | :: | nsave | ||||
integer, | public | :: | nwrite_mult | ||||
integer, | public | :: | nc_sync_freq | ||||
logical, | public | :: | write_phi_over_time | ||||
logical, | public | :: | write_apar_over_time | ||||
logical, | public | :: | write_bpar_over_time | ||||
logical, | private | :: | append_old | ||||
logical, | private | :: | write_jext | = | .true. | ||
integer, | private | :: | trin_istep | = | 0 |
Variables for convergence condition testing |
|
integer, | private | :: | conv_isteps_converged | = | 0 | ||
real, | private, | allocatable, dimension(:) | :: | conv_heat | |||
real, | private | :: | heat_sum_av | = | 0 | ||
real, | private | :: | heat_av | = | 0 | ||
real, | private | :: | heat_av_test | = | 0 | ||
logical, | private | :: | write_any | ||||
logical, | private | :: | write_any_fluxes | ||||
logical, | private | :: | dump_any | ||||
logical, | private | :: | initialized | = | .false. | ||
complex, | private, | allocatable, dimension (:,:,:) | :: | domega | |||
complex, | private, | dimension (:, :), allocatable | :: | omega |
Complex frequency, and time-averaged complex frequency |
||
complex, | private, | dimension (:, :), allocatable | :: | omegaavg |
Complex frequency, and time-averaged complex frequency |
||
integer, | private | :: | out_unit | ||||
integer, | private | :: | heat_unit | ||||
integer, | private | :: | heat_unit2 | ||||
integer, | private | :: | lpc_unit | ||||
integer, | private | :: | jext_unit | ||||
integer, | private | :: | phase_unit | ||||
integer, | private | :: | dump_check1_unit | ||||
integer, | private | :: | dump_check2_unit | ||||
integer, | private | :: | res_unit | ||||
integer, | private | :: | res_unit2 | ||||
integer, | private | :: | parity_unit | ||||
integer, | private | :: | conv_nstep_av | ||||
integer, | private | :: | conv_min_step | ||||
integer, | private | :: | conv_max_step | ||||
integer, | private | :: | conv_nsteps_converged | ||||
complex, | private, | dimension (:,:,:), allocatable | :: | omegahist |
Frequency time history, size |
||
type(heating_diagnostics), | private | :: | h |
Heating diagnostics summed over space at the current timestep |
|||
type(heating_diagnostics), | private, | dimension(:), save, allocatable | :: | h_hist |
Heating diagnostics summed over space over the last navg timesteps |
||
type(heating_diagnostics), | private, | dimension(:,:), save, allocatable | :: | hk |
Heating diagnostics as a function of at the current timestep |
||
type(heating_diagnostics), | private, | dimension(:,:,:), save, allocatable | :: | hk_hist |
Heating diagnostics as a function of over the last navg timesteps |
||
real, | private, | dimension(:,:,:), allocatable | :: | j_ext_hist | |||
real, | private, | dimension (:,:,:), allocatable | :: | pflux_tormom | |||
real, | public | :: | start_time | = | 0.0 | ||
real, | public, | dimension (:), allocatable | :: | pflux_avg | |||
real, | public, | dimension (:), allocatable | :: | qflux_avg | |||
real, | public, | dimension (:), allocatable | :: | heat_avg | |||
real, | public, | dimension (:), allocatable | :: | vflux_avg | |||
real, | private | :: | conv_test_multiplier | ||||
integer, | private | :: | ntg_extend | ||||
integer, | private | :: | nth0_extend | ||||
integer, | private | :: | nout | = | 1 | ||
integer, | private | :: | nout_movie | = | 1 | ||
integer, | private | :: | nout_big | = | 1 | ||
complex, | private | :: | wtmp_old | = | 0. | ||
logical, | private | :: | exist |
Does the |
|||
type(gs2_diagnostics_config_type), | private | :: | gs2_diagnostics_config |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (:,:) | :: | a | ||
complex, | intent(in), | dimension (:,:) | :: | b | ||
real, | intent(out) | :: | axb | |||
real, | intent(out), | dimension (:,:) | :: | axb_by_mode |
FIXME : Add documentation
Here we calculate the correction factors for each possible kperp
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (-ntgrid:,:,:) | :: | a | ||
complex, | intent(in), | dimension (-ntgrid:,:,:) | :: | b | ||
real, | intent(out) | :: | axb | |||
real, | intent(out), | dimension (:,:) | :: | axb_by_mode |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (:,:) | :: | a | ||
complex, | intent(in), | dimension (:,:) | :: | b | ||
complex, | intent(out) | :: | axb | |||
complex, | intent(out), | dimension (:,:) | :: | axb_by_mode |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (-ntgrid:,:,:) | :: | a | ||
complex, | intent(in), | dimension (-ntgrid:,:,:) | :: | b | ||
complex, | intent(out) | :: | axb | |||
complex, | intent(out), | dimension (:,:) | :: | axb_by_mode |
Calculate the field-line average
Calculate the field-line average (real values)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | dimension (-ntgrid:) | :: | fld_in | ||
real, | intent(out) | :: | fld_out |
Calculate the field-line average (complex values)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (-ntgrid:) | :: | fld_in | ||
complex, | intent(out) | :: | fld_out |
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? |
|
logical, | public | :: | append_old | = | .false. |
Append output data to a previous output file |
|
integer, | public | :: | conv_max_step | = | 80000 |
Used for Trinity nonlinear convergence (use_nonlin_convergence). The maximum number of Trinity steps, after which consider the run converged regardless |
|
integer, | public | :: | conv_min_step | = | 4000 |
Used for the Trinity nonlinear convergence check (use_nonlin_convergence). The minimum number of Trinity steps before checking convergence condition |
|
integer, | public | :: | conv_nstep_av | = | 4000 |
Used for the Trinity nonlinear convergence check (use_nonlin_convergence). The number of timesteps the convergence condition averages over |
|
integer, | public | :: | conv_nsteps_converged | = | 10000 |
Used for the Trinity nonlinear convergence check (use_nonlin_convergence). The number of steps where convergence is true before convergence is accepted |
|
real, | public | :: | conv_test_multiplier | = | 4e-1 |
Used for the Trinity nonlinear convergence check (use_nonlin_convergence). Multiplier for the cumulative average of the heat flux |
|
logical, | public | :: | dump_check1 | = | .false. |
Write out the field-line average of to |
|
logical, | public | :: | dump_check2 | = | .false. |
Write out at |
|
logical, | public | :: | dump_fields_periodically | = | .false. |
Write out to |
|
logical, | public | :: | enable_parallel | = | .false. |
Enable parallel IO in the .out.nc file. Currently disabled by default and doesn't activate feature when set to true as we hard code that parallel IO isn't supported for the .out.nc file. |
|
logical, | public | :: | exit_when_converged | = | .true. |
Exit when the run has reached convergence |
|
logical, | public | :: | file_safety_check | = | .true. |
Verify that the restart file(s) can be written before starting the run |
|
integer, | public | :: | igomega | = | 0 |
Index in to measure various diagnostics at. By default, this is the outboard midplane , but it may be useful to set this to a non-zero value for tearing parity modes. |
|
logical, | public | :: | make_movie | = | .false. |
Write out in real space over time, suitable for creating animations. Timestep period is controlled with nmovie |
|
integer, | public | :: | navg | = | 10 |
Number of timesteps to average over for time-averaged diagnostics |
|
integer, | public | :: | ncheck | = | 10 |
correction by varying collisionality. But doesn't happen on timesteps when diagnostics are written. |
|
integer, | public | :: | nc_sync_freq | = | 10 |
Sets the number of output steps between syncing the netcdf file. Higher values may reduce disk overheads but increase the risk of data loss on unclean exit. |
|
integer, | public | :: | nmovie | = | -1 |
Timestep period to write real space fields |
|
integer, | public | :: | nsave | = | -1 |
Timestep period for writing restart data if
save_for_restart is |
|
integer, | public | :: | nwrite | = | 10 |
Timestep period for writing outputs |
|
integer, | public | :: | nwrite_mult | = | 10 |
Timestep period multiplier for certain "large" diagnostics, which are
written every |
|
logical, | public | :: | ob_midplane | = | .false. |
If |
|
real, | public | :: | omegatinst | = | 1.0e6 |
Threshold complex frequency () for detecting a numerical
instability. If averaged over
navg timesteps is greater than |
|
real, | public | :: | omegatol | = | 1e-3 |
Frequency () convergence tolerance. Consider the simulation
converged and finish the run if has changed by less than
|
|
logical, | public | :: | print_flux_line | = | .false. |
Print the instantaneous fluxes to screen/stdout every nwrite timesteps |
|
logical, | public | :: | print_line | = | .false. |
Print estimated frequencies and growth rates to screen/stdout every nwrite timesteps |
|
logical, | public | :: | save_distfn | = | .false. |
Write the distribution function to |
|
logical, | public | :: | save_for_restart | = | .false. |
Write restart files at the end of the simulation. If
nsave is positive, then also enable
checkpoints by writing restart files every |
|
logical, | public | :: | save_glo_info_and_grids | = | .false. |
Save some layout and distribution information in restart files |
|
logical, | public | :: | save_many | = | .false. |
If |
|
logical, | public | :: | save_velocities | = | .false. |
Save parallel and perpendicular velocities in final restart and/or distribution function files |
|
logical, | public | :: | serial_netcdf4 | = | .false. |
|
|
logical, | public | :: | use_nonlin_convergence | = | .false. |
For nonlinear runs, stop the run when the averaged differential of the summed averaged heat flux drops below a threshold for a period of time, controlled by conv_test_multiplier, conv_nsteps_converged, gs2_diagnostics_knobs, conv_max_step, and conv_min_step. |
|
logical, | public | :: | write_any | = | .true. |
If |
|
logical, | public | :: | write_apar_over_time | = | .false. |
Write the entire field every nwrite timesteps |
|
logical, | public | :: | write_ascii | = | .true. |
Write diagnostics to text files. Generally this creates a different text file for each diagnostic. Note that this independent of whether or not netCDF files are used. |
|
logical, | public | :: | write_avg_moments | = | .false. |
Write flux surface averaged low-order moments of every nwrite timesteps |
|
logical, | public | :: | write_bpar_over_time | = | .false. |
Write the entire field every nwrite timesteps |
|
logical, | public | :: | write_cerr | = | .false. |
Write the collision error every nwrite
timesteps to text file with suffix |
|
logical, | public | :: | write_collisional | = | .false. |
Write collisional heating (collisional and hyper viscous rate of loss of free energy for each mode) every nwrite timesteps |
|
logical, | public | :: | write_correlation | = | .true. |
Write two point parallel correlation function calculated from the electric potential as a function of and parallel separation every nwrite timesteps |
|
logical, | public | :: | write_correlation_extend | = | .false. |
Write two point parallel correlation function calculated from the electric potential as a function of and parallel separation, time averaged and calculated along the extended domain every nwrite timesteps once istep > nstep/4. |
|
logical, | public | :: | write_cross_phase | = | .false. |
Write the cross phase between electron density and perpendicular electron temperature every nwrite timesteps. Calculated at both the outboard midplane, averaged across and ; and averaged across all space |
|
logical, | public | :: | write_density_over_time | = | .false. |
Write the whole non-adiabatic part of the density moment every nwrite timesteps |
|
logical, | public | :: | write_eigenfunc | = | .false. |
Write normalised to the value of at the outboard midplane every nwrite timesteps. |
|
logical, | public | :: | write_fields | = | .true. |
Enable writing every nwrite timesteps |
|
logical, | public | :: | write_final_antot | = | .false. |
Write the right-hand sides of the field equations at the final
timestep. If write_ascii is enabled, the file
suffix is |
|
logical, | public | :: | write_final_db | = | .false. |
Write at the final timestep. If
write_ascii is enabled, the file suffix is
|
|
logical, | public | :: | write_final_epar | = | .false. |
Write at the final timestep. If
write_ascii is enabled, the file suffix is
|
|
logical, | public | :: | write_final_fields | = | .false. |
Write at the final timestep. If
write_ascii is enabled, the file suffix is
|
|
logical, | public | :: | write_final_moments | = | .false. |
Write various moments (densities, parallel and perpendicular
velocities and temperatures, and heat and momentum fluxes) at
the final timestep. If write_ascii
is enabled, the file suffix is |
|
logical, | public | :: | write_flux_line | = | .false. |
Write instantaneous fluxes to output file every nwrite timesteps |
|
logical, | public | :: | write_fluxes | = | .false. |
Write fluxes (heat, momentum and particle; total and per-species) every nwrite timesteps. |
|
logical, | public | :: | write_fluxes_by_mode | = | .false. |
Write fluxes (heat, momentum and particle; total and per-species) as a function of Fourier mode every nwrite timesteps. |
|
logical, | public | :: | write_full_moments_notgc | = | .false. |
Write moments (density, parallel flow, and parallel and perpendicular temperatures) in non-guiding centre coordinates every nwrite timesteps |
|
logical, | public | :: | write_g | = | .false. |
Write at |
|
logical, | public | :: | write_gs | = | .false. |
|
|
logical, | public | :: | write_gyx | = | .false. |
Write as a function of real space every
nmovie timesteps to text file
" |
|
logical, | public | :: | write_heating | = | .false. |
Write out various heating, free energy and energy injection
diagnostics. Text file extension is |
|
logical, | public | :: | write_jext | = | .false. |
Write time averaged external current in the antenna,
, as a function of
. File suffix is |
|
logical, | public | :: | write_kpar | = | .false. |
Write the parallel spectrum of at final timestep. File suffix is |
|
logical, | public | :: | write_line | = | .true. |
Print estimated frequencies and growth rates to text file every nwrite timesteps |
|
logical, | public | :: | write_lorentzian | = | .false. |
Write |
|
logical, | public | :: | write_max_verr | = | .false. |
Write the estimated maximum error from velocity space integrals for various quantities |
|
logical, | public | :: | write_moments | = | .true. |
Write various moments (total and non-adiabatic part of perturbed species density, perturbed parallel flow, perturbed parallel and perpendicular temperatures, parallel heat flux, particule flux and heat flux) every nwrite timesteps |
|
logical, | public | :: | write_nl_flux_dist | = | .false. |
Write the poloidal distributions of the fluxes of particles, parallel momentum, perpendicular momentum, and energy every nwrite timesteps. |
|
logical, | public | :: | write_ntot_over_time | = | .false. |
Write the whole total density moment every nwrite timesteps |
|
logical, | public | :: | write_omavg | = | .true. |
Write time-averaged growth rate and frequency to the output text file every nwrite timesteps. Time average is rolling window over the previous navg timesteps |
|
logical, | public | :: | write_omega | = | .true. |
Write instantaneous growth rate and frequency every nwrite timesteps |
|
logical, | public | :: | write_parity | = | .false. |
Write parities in distribution and particle fluxes to text file with the
suffix |
|
logical, | public | :: | write_pflux_sym | = | .false. |
Write particle flux density as a function of and velocity space every nwrite timesteps. Used for looking at the effect of asymmetry. See Parra et al POP 18 062501 2011 and ask Jung-Pyo Lee |
|
logical, | public | :: | write_pflux_tormom | = | .false. |
Write toroidal angular momentum flux carried by particle flux every
nwrite timesteps. Only calculated if |
|
logical, | public | :: | write_phi_over_time | = | .false. |
Write the entire field every nwrite timesteps |
|
logical, | public | :: | write_ql_metric | = | .true. |
Write a simple quasi-linear metric to netcdf. |
|
logical, | public | :: | write_symmetry | = | .false. |
Write the particle and momentum flux as a function of and velocity space. See write_pflux_sym and write_pflux_tormom |
|
logical, | public | :: | write_tperp_over_time | = | .false. |
Write the whole perturbed perpendicular temperature moment every nwrite timesteps |
|
logical, | public | :: | write_upar_over_time | = | .false. |
Write the whole perturbed parallel velocity moment every nwrite timesteps |
|
logical, | public | :: | write_verr | = | .false. |
Write estimates of error resulting from velocity space integrals in the calculation of various quantities every nwrite timesteps. |
|
logical, | public | :: | write_zonal_transfer | = | .false. |
Write the transfer of free energy, , as a function of , averaged over , every nwrite timesteps |
A linear estimate of the diffusivity, used for Trinity testing
Calculates <|field|2 kperp2>_theta / <|field|2>_theta. Useful for simple quasilinear metric
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension(-ntgrid:ntgrid, ntheta0, naky) | :: | field |
Calculates a simple gamma/kperp2 QL flux metric
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | dimension(ntheta0, naky) | :: | growth_rates |
Calculates the instantaneous omega from chinew = chi * exp(-i * omega * dt) with chi = phi + apar + bpar. This gives omega = log(chinew/chi) * i / dt.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | optional | :: | ig | ||
real, | intent(in), | optional | :: | tolerance |
Write the diagnostics namelist to file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | unit |
Unit of an open file to write to |
Perform some basic checking of the diagnostic input parameters, and write the results to file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | report_unit |
Unit of an open file to write to |
Initialise this module and all its dependencies, including defining NetCDF vars, call real_init, which calls read_parameters; broadcast all the different write flags.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | list |
If true, this is a "list-mode run" and so turn off print_flux_line and print_line if set |
||
integer, | intent(in) | :: | nstep |
Maximum number of steps to take |
||
type(gs2_diagnostics_config_type), | intent(in), | optional | :: | gs2_diagnostics_config_in |
Input parameters for this module |
|
type(standard_header_type), | intent(in), | optional | :: | header |
Header for files with build and run information |
Check if we can write the restart files
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | check_writable |
Has the user requested this check |
||
logical, | intent(in) | :: | need_restart |
Has the user requested restart files |
||
logical, | intent(inout) | :: | extra_files |
Has the user requested distribution function to be written |
Read the input parameters; open the various text output files according to the relevant input flags; allocate and zero the module-level flux arrays, gs2_diagnostics_knobs and gs2_diagnostics_knobs
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | is_list_run |
If true, this is a "list-mode run" and so turn off print_flux_line and print_line if set |
||
type(gs2_diagnostics_config_type), | intent(in), | optional | :: | gs2_diagnostics_config_in |
Input parameters for this module |
|
type(standard_header_type), | intent(in), | optional | :: | header |
Header for files with build and run information |
Set values according to the old diagnostics defaults.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(gs2_diagnostics_config_type), | intent(inout) | :: | gs2_diagnostics_config_in |
Read the input parameters for the diagnostics module
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | is_list_run |
If true, this is a "list-mode run" and so turn off print_flux_line and print_line if set |
||
type(gs2_diagnostics_config_type), | intent(in), | optional | :: | gs2_diagnostics_config_in |
Configuration for this module, can be used to set new default values or avoid reading the input file |
Finalise the diagnostics module, writing final timestep diagnostics and closing any open files
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | istep |
The current (final) timestep |
Save some extra information in final restart files
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | save_for_restart |
See save_for_restart |
||
logical, | intent(in) | :: | save_distfn |
See save_distfn |
||
logical, | intent(in) | :: | save_glo_info_and_grids | |||
logical, | intent(in) | :: | save_velocities |
See save_velocities |
||
real, | intent(in) | :: | user_time |
Current simulation time |
||
character(len=*), | intent(in), | optional | :: | fileopt_base |
Optional string to add to file name |
Deallocate the gs2_diagnostics module-level arrays
Close various text output files
Calculate and write the various diagnostic quantities.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | istep |
Current timestep |
||
logical, | intent(out) | :: | exit |
If true, simulation should stop (for example, because it has converged) |
||
logical, | intent(in), | optional | :: | debopt |
If true, turn on some debug prints |
|
logical, | intent(in), | optional | :: | force |
Calculate gs2_diagnostics_knobs for linear simulations or if run_parameters_knobs is on; otherwise set gs2_diagnostics_knobs and gs2_diagnostics_knobs to zero
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | istep |
The current timestep |
||
logical, | intent(in) | :: | debug |
Turn on some debug messages |
||
logical, | intent(inout) | :: | exit |
Returns true if the simulation has converged (see omegatol) or if a numerical instability has occurred (see gs2_diagnostics_knobs). |
Compute volume averages of the fields and write the fields, field averages, heating and frequency to the netCDF files
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | time |
Simulation time |
||
integer, | intent(in) | :: | istep |
Current timestep |
||
real, | intent(out) | :: | phi2 |
Fields squared |
||
real, | intent(out) | :: | apar2 |
Fields squared |
||
real, | intent(out) | :: | bpar2 |
Fields squared |
||
real, | intent(out), | dimension (:, :) | :: | phitot |
FIXME: add documentation. Needs phinorm documenting |
Broadcast one of the input parameters according to target_parameter_switch
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(inout), | dimension(:) | :: | scan_hflux | ||
real, | intent(inout), | dimension(:) | :: | scan_momflux | ||
real, | intent(inout), | dimension(:) | :: | scan_phi2 |
Write normalised to the value of at the outboard midplane
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | file_id |
NetCDF ID of the file to write to |
||
logical, | intent(in) | :: | write_text |
If true, write text file |
||
complex, | intent(inout), | dimension (:,:) | :: | phi0 |
The normalising factor for the fields that is actually used. See write_eigenfunc for more details |
Write some geometry information to text file <runname>.g
Transform to real space, then write to netCDF
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | time |
Current simulation time |
Print estimated frequencies and growth rates to screen/stdout
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | dimension (:, :) | :: | phitot |
Total magnitude of all the fields |
Calculate and write the time-averaged antenna current to jext_unit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | time |
Current simulation time |
||
integer, | intent(in) | :: | istep |
Current timestep |
Write various moments to netCDF
Calculate the cross-phase (see get_cross_phase) and write to the phase_unit file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | time |
Current simulation time |
Write estimated frequency and growth rates to out_unit for an individual point
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | time |
Simulation time |
||
integer, | intent(in) | :: | it |
- and -indices |
||
integer, | intent(in) | :: | ik |
- and -indices |
||
real, | intent(in) | :: | phitot |
Simulation time |
Write instantaneous growth rate and frequency to out_unit for an individual point
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | it |
- and -indices |
||
integer, | intent(in) | :: | ik |
- and -indices |
Write time-averaged growth rate and frequency to out_unit for an individual point
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | it | |||
integer, | intent(in) | :: | ik |
Write the (total) heating diagnostics to heat_unit and heat_unit2 (per-species)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | t | |||
integer, | intent(in) | :: | file_unit | |||
integer, | intent(in) | :: | file_unit2 | |||
type(heating_diagnostics), | intent(in) | :: | h |
Heating diagnostics |
Calculate the momentum flux as a function of and write to netCDF
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | file_id |
NetCDF ID of the file to write to |
||
integer, | intent(in) | :: | nout |
Current timestep |
Calculate the poloidal distributions of the fluxes of particles, parallel momentum, perpendicular momentum, and energy (see section 3.1 and appendix A of Ball et al. PPCF 58 (2016) 045023 as well as section 5 of "GS2 analytic geometry specification")
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | file_id |
NetCDF ID of the file to write to |
||
integer, | intent(in) | :: | nout |
Current timestep |
Calculate the particle flux contribution to toroidal momentum flux and write to netCDF
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | file_id |
NetCDF ID of the file to write to |
||
integer, | intent(in) | :: | nout |
Current timestep |
Calculate the correlation function over the physical domain and write to netCDF
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | file_id |
NetCDF ID of the file to write to |
||
integer, | intent(in) | :: | nout |
Current timestep |
Calculate the correlation function over the extended domain and write to netCDF
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | file_id |
NetCDF ID of the file to write to |
||
real, | intent(in) | :: | time |
Current and previous simulation times |
||
real, | intent(in) | :: | time_old |
Current and previous simulation times |
Calculate average parity of distribution function under , and write to parity_unit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | t | |||
integer, | intent(in) | :: | file_unit |
Open formatted file to write text to |
||
logical, | intent(in) | :: | write_text |
If false, don't calculate or write parity |
Calculate flux surfgace averaged low-order moments of and write to netCDF
Calculate moments (density, parallel flow, and parallel and perpendicular temperatures) in non-guiding centre coordinates and write to netCDF
Calculate the field-line average of and write to dump_check1_unit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | t |
Calculate at igomega
and write to dump_check2_unit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | t |
Write out to text file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | t |
Flush text files (only out_unit, res_unit, lpc_unit, and parity_unit)
Trinity convergence condition - simple and experimental look for the averaged differential of the summed averaged heat flux to drop below a threshold
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | istep | |||
real, | intent(in) | :: | heat_flux | |||
logical, | intent(inout) | :: | exit |
Calculate some heating diagnostics, and update their time history
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | istep | |||
type(heating_diagnostics), | intent(inout) | :: | h |
Heating diagnostics summed over space at the current timestep |
||
type(heating_diagnostics), | intent(inout), | dimension(:,:) | :: | hk |
Heating diagnostics as a function of at the current timestep |
Calculate the time-averaged antenna current
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | istep |
Current simulation timestep |
||
real, | intent(inout), | dimension(:,:) | :: | j_ext |
Calculate the time-averaged complex frequency, check convergence criterion, and numerical instability criterion.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | istep |
The current timestep |
||
logical, | intent(inout) | :: | exit |
Should the simulation exit?
FIXME: This could be |
||
complex, | intent(out), | dimension (:,:) | :: | omegaavg |
The time-averaged complex frequency |
|
logical, | intent(in), | optional | :: | debopt |
If true, write some debug messages |
Summed magnitude of all the fields
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(out), | dimension (:,:) | :: | phitot |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (-ntgrid:,:,:) | :: | a | ||
complex, | intent(in), | dimension (-ntgrid:,:,:) | :: | b | ||
real, | intent(out) | :: | axb | |||
real, | intent(out), | dimension (:,:) | :: | axb_by_mode |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (:,:) | :: | a | ||
complex, | intent(in), | dimension (:,:) | :: | b | ||
real, | intent(out) | :: | axb | |||
real, | intent(out), | dimension (:,:) | :: | axb_by_mode |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | dimension (:,:) | :: | f | ||
real, | intent(out) | :: | favg |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | dimension (:,:) | :: | f | ||
real, | intent(out), | dimension (:) | :: | favg |
FIXME : Add documentation
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | nensembles | |||
real, | intent(out) | :: | time_int |
Calculate the field-line average (real values)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | dimension (-ntgrid:) | :: | fld_in | ||
real, | intent(out) | :: | fld_out |
Calculate the field-line average (complex values)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (-ntgrid:) | :: | fld_in | ||
complex, | intent(out) | :: | fld_out |
This is a highly simplified synthetic diagnostic which
calculates the cross phase between the electron density and the
perpendicular electron temperature for comparisons with DIII-D.
Returns the value of the cross-phase at the outboard midplane and
integrated over all v and x. We can generalize this routine to
other fields at some point, but for now this is just a skeleton for
a more realistic synthetic diagnostic.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(out) | :: | phase_tot | |||
real, | intent(out) | :: | phase_theta |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (-ntgrid:,:,:) | :: | a | ||
complex, | intent(in), | dimension (-ntgrid:,:,:) | :: | b | ||
complex, | intent(out) | :: | axb | |||
complex, | intent(out), | dimension (:,:) | :: | axb_by_mode |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (:,:) | :: | a | ||
complex, | intent(in), | dimension (:,:) | :: | b | ||
complex, | intent(out) | :: | axb | |||
complex, | intent(out), | dimension (:,:) | :: | axb_by_mode |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (:,:) | :: | f | ||
complex, | intent(out) | :: | favg |
Calculate the correlation function over the extended domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(out), | dimension (:,:,:) | :: | cfnc | ||
real, | intent(out), | dimension (:,:,:) | :: | phi2extend |
Calculate the correlation function on the physical domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(out), | dimension (-ntgrid:,:) | :: | cfnc_2pi |
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension (:) | :: | unord | ||
complex, | intent(out), | dimension (:) | :: | ord |
Set the module level config type Will abort if the module has already been initialised to avoid inconsistencies.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(gs2_diagnostics_config_type), | intent(in), | optional | :: | gs2_diagnostics_config_in |