A small module used to calculate ideal ballooning stability. Based on the original ball program in geo/ball.f90 of GS2 but tweaked to integrate closer to full GS2 runs etc.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | private | :: | make_salpha | ||||
integer, | private | :: | n_shat | ||||
integer, | private | :: | n_beta | ||||
real, | private | :: | shat_min | ||||
real, | private | :: | shat_max | ||||
real, | private | :: | theta0 | ||||
real, | private | :: | beta_mul | ||||
real, | private | :: | beta_div | ||||
real, | private, | dimension(:), allocatable | :: | shat_arr | |||
real, | private, | dimension(:), allocatable | :: | beta_arr | |||
real, | private, | dimension(:), allocatable | :: | dbdrho_arr | |||
integer, | public, | dimension(:,:), allocatable | :: | stability | |||
real, | private | :: | diff | ||||
logical, | private | :: | initialised | = | .false. | ||
character(len=14), | private | :: | namelist_name | = | "ballstab_knobs" | ||
type(ballstab_config_type), | private | :: | ballstab_config |
Used to represent the input configuration of ballstab
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 | :: | beta_div | = | 1.0 |
The minimum in scans is
|
|
real, | public | :: | beta_mul | = | 1.0 |
The maximum in scans is
|
|
real, | public | :: | diff | = | 0.0 |
Controls decentring used in the numerical integration used for solving the ballooning equation. Recommended values are either 0 (default) or 1/3. |
|
logical, | public | :: | make_salpha | = | .false. |
Not currently used for anything. |
|
integer, | public | :: | n_beta | = | 1 |
How many values should be used in s-alpha type scans. |
|
integer, | public | :: | n_shat | = | 1 |
How many values should be used in s-alpha type scans. |
|
real, | public | :: | shat_max | = | 0.0 |
The maximum value of to use in s-alpha type scans. |
|
real, | public | :: | shat_min | = | 0.0 |
The minimum value of to use in s-alpha type scans. |
|
real, | public | :: | theta0 | = | 0.0 |
The theta0 value to use in solving the ideal ballooning problem. We don't currently provide a means to study multiple theta0 in a single run. This may change in the future. |
Test stability of current system for passed theta0 and geometry -- return integer
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | ntgrid | |||
real, | intent(in), | dimension(-ntgrid:ntgrid) | :: | theta | ||
real, | intent(in), | dimension(-ntgrid:ntgrid) | :: | bmag | ||
real, | intent(in) | :: | dbetadrho | |||
real, | intent(in), | dimension(-ntgrid:ntgrid) | :: | gradpar | ||
real, | intent(in), | dimension(-ntgrid:ntgrid) | :: | gds2 | ||
real, | intent(in), | dimension(-ntgrid:ntgrid) | :: | gds21 | ||
real, | intent(in), | dimension(-ntgrid:ntgrid) | :: | gds22 | ||
real, | intent(in), | dimension(-ntgrid:ntgrid) | :: | cvdrift | ||
real, | intent(in), | dimension(-ntgrid:ntgrid) | :: | cvdrift0 | ||
real, | intent(in), | optional | :: | theta0_in |
DD> NEED TO IMPROVE VARIABLE NAMES |
Gets the default name for this namelist
Gets the default requires index for this namelist
Initialise grids, other modules etc.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ballstab_config_type), | intent(in), | optional | :: | ballstab_config_in |
Finalise this module Deallocate
Initialise this module
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ballstab_config_type), | intent(in), | optional | :: | ballstab_config_in |
Read parameters
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ballstab_config_type), | intent(in), | optional | :: | ballstab_config_in |
Check parameters are consistent etc.
Allocate+populate arrays
Deallocate arrays
Write a namelist based on current values
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | unit |
Gets the current value of shat
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(out) | :: | shat_out |
Sets the value of shat
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | shat_in |
Gets the current value of beta_prime (or equivalent var) Really just gets the variable that we can use to control the pressure gradient.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(out) | :: | bp_out |
Sets the current value of beta_prime (or equivalent var) Really just sets the variable that we can use to control the pressure gradient.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | bp_in |
Runs the stability check scan for the module level shat/beta array values
Routine to write out stability data to 1D ascii file
Routine to write out stability data to 2D ascii file + 1d axis data
Test if given shat/beta is unstable
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | shat_in | |||
real, | intent(in) | :: | beta_prime_in | |||
real, | intent(out) | :: | dbetadrho_out | |||
integer, | intent(out) | :: | iunstable | |||
real, | intent(in), | optional | :: | theta0 | ||
logical, | intent(in), | optional | :: | restore |
Set the module level config type Will abort if the module has already been initialised to avoid inconsistencies.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ballstab_config_type), | intent(in), | optional | :: | ballstab_config_in |
Reads in the ballstab_knobs namelist and populates the member variables
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ballstab_config_type), | intent(inout) | :: | self |
Writes out a namelist representing the current state of the config object
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ballstab_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(ballstab_config_type), | intent(inout) | :: | self |
Broadcasts all config parameters so object is populated identically on all processors
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ballstab_config_type), | intent(inout) | :: | self |