parameter_scan Module

A module which allows multiple values of certain parameters to be considered within a single simulation.

In its simplest form, it starts with a given value of the parameter in question, runs for a given number of timesteps, and then changes the parameter by a given increment, until a lower limit is reached. In a more advanced scenario, the parameter scan continues until a different condition is satisfied: for example, zero heat flux. In a third scenario, the parameter is varied using a root finding algorithm. In addition, the condition for changing the parameter may be changed from a simple number of time steps to, for example, reaching a saturated state.



Contents


Variables

Type Visibility Attributes Name Initial
logical, public :: scan_restarted
integer, private :: scan_parameter_switch
integer, private, parameter :: scan_parameter_tprim = 1
integer, private, parameter :: scan_parameter_g_exb = 2
integer, public :: target_parameter_switch
integer, public :: scan_type_switch
integer, private :: increment_condition_switch
integer, public, parameter :: scan_type_none = 1
integer, private, parameter :: scan_type_range = 2
integer, private, parameter :: scan_type_target = 3
integer, private, parameter :: scan_type_root_finding = 4
integer, public, parameter :: target_parameter_hflux_tot = 1
integer, public, parameter :: target_parameter_momflux_tot = 2
integer, public, parameter :: target_parameter_phi2_tot = 3
integer, private, parameter :: increment_condition_n_timesteps = 1
integer, private, parameter :: increment_condition_delta_t = 2
integer, private, parameter :: increment_condition_saturated = 3
real, private :: par_start
real, private :: par_end
real, private :: par_inc
integer, private :: nstep_init
integer, private :: nstep_inc
integer, private :: scan_spec
real, private :: delta_t_init
real, private :: delta_t_inc
real, private :: target_val
integer, private :: scan_output_file
real, private :: current_target_value = 0.0
logical, public :: scanning = .false.
logical, private :: initialized = .false.
type(parameter_scan_config_type), private :: parameter_scan_config

Derived Types

type, public, extends(abstract_config_type) ::  parameter_scan_config_type

Used to represent the input configuration of parameter_scan

Components

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 :: delta_t_inc = 0.0

When the increment condition is "delta_t", the parameter will be changed every time delta_t_inc time has elapsed.

real, public :: delta_t_init = 0.0

When the increment condition is "delta_t", the parameter will not be changed until delta_t_init time has elapsed from the beginning of the simulation. Note, that if the simulation is restarted, this parameter will measure from beginning of original simulation.

character(len=20), public :: inc_con = 'delta_t'

Specifies the condition for incrementing the parameter. Possible values are:

Read more…
integer, public :: nstep_inc = 0

When the increment condition is 'n_timesteps', the parameter will be changed every nstep_inc.

integer, public :: nstep_init = 0

When the increment condition is 'n_timesteps' or 'saturated', the parameter will not be changed until nstep_init have elapsed from the beginning of the simulation. Note that if the simulation is restarted, this parameter will measure from the restart.

real, public :: par_end = 0.0

If the scan is being run in 'range' mode, specifies the value of the parameter that will be reached.

real, public :: par_inc = 0.0

If the parameter scan is being run in 'range' or 'target' modes, specifies the amount by which the parameter is varied at one go.

real, public :: par_start = 0.0

Specifies the starting value for the parameter scan.

character(len=20), public :: scan_par = 'tprim'

Specify the parameter to be varied. If the parameter pertains to a species, the scan_spec must be specified as well.

logical, public :: scan_restarted = .false.

Specify the parameter to be varied. If the parameter pertains to a species, the scan_spec must be specified as well.

integer, public :: scan_spec = 1

When parameter pertains to a species, specifies the index of the species.

character(len=20), public :: scan_type = 'none'

Specifies the way that the parameter scan is conducted. Possible values are:

Read more…
character(len=20), public :: target_par = 'hflux_tot'

If the scan is being run in 'target' or 'root_finding' mode, specifies the target parameter. Possible values are:

Read more…
real, public :: target_val = 0.0

Type-Bound Procedures

procedure , public , :: is_initialised => is_initialised_generic Function
procedure , public , :: init => init_generic Subroutine
procedure , public , :: setup => setup_generic Subroutine
procedure , public , :: write_namelist_header Subroutine
procedure , public , :: get_name => get_name_generic Function
procedure , public , :: get_requires_index => get_requires_index_generic Function
procedure , public , nopass :: write_namelist_footer Subroutine
generic, public , :: write_key_val => write_key_val_string, write_key_val_real, write_key_val_complex, write_key_val_integer, write_key_val_logical, write_key_val_real_array, write_key_val_complex_array, write_key_val_integer_array
procedure , public :: read => read_parameter_scan_config Subroutine
procedure , public :: write => write_parameter_scan_config Subroutine
procedure , public :: reset => reset_parameter_scan_config Subroutine
procedure , public :: broadcast => broadcast_parameter_scan_config Subroutine
procedure , public , nopass :: get_default_name => get_default_name_parameter_scan_config Function
procedure , public , nopass :: get_default_requires_index => get_default_requires_index_parameter_scan_config Function

Functions

public function get_parameter_scan_config()

Get the module level config instance

Arguments

None

Return Value type(parameter_scan_config_type)

Gets the default name for this namelist

Arguments

None

Return Value character(len=CONFIG_MAX_NAME_LEN)

Gets the default requires index for this namelist

Arguments

None

Return Value logical


Subroutines

public subroutine init_parameter_scan(parameter_scan_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(parameter_scan_config_type), intent(in), optional :: parameter_scan_config_in

public subroutine allocate_target_arrays(nwrite, write_fluxes)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nwrite
logical, intent(in) :: write_fluxes

public subroutine deallocate_target_arrays()

FIXME : Add documentation

Arguments

None

public subroutine finish_parameter_scan()

FIXME : Add documentation

Arguments

None

public subroutine update_scan_parameter_value(istep, reset, exit)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: istep
logical, intent(inout) :: reset
logical, intent(inout) :: exit

private subroutine check_target_reached(target_reached)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
logical, intent(out) :: target_reached

private subroutine increment_scan_parameter(increment, reset)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: increment
logical, intent(inout) :: reset

private subroutine set_scan_parameter(reset)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
logical, intent(inout) :: reset

private subroutine check_increment_condition_satisfied(istep, increment_condition_satisfied)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: istep
logical, intent(out) :: increment_condition_satisfied

private subroutine read_parameters(parameter_scan_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(parameter_scan_config_type), intent(in), optional :: parameter_scan_config_in

public subroutine set_parameter_scan_config(parameter_scan_config_in)

Set the module level config type Will abort if the module has already been initialised to avoid inconsistencies.

Arguments

Type IntentOptional Attributes Name
type(parameter_scan_config_type), intent(in), optional :: parameter_scan_config_in

private subroutine read_parameter_scan_config(self)

Reads in the parameter_scan_knobs namelist and populates the member variables

Arguments

Type IntentOptional Attributes Name
class(parameter_scan_config_type), intent(inout) :: self

private subroutine write_parameter_scan_config(self, unit)

Writes out a namelist representing the current state of the config object

Arguments

Type IntentOptional Attributes Name
class(parameter_scan_config_type), intent(in) :: self
integer, intent(in), optional :: unit

private subroutine reset_parameter_scan_config(self)

Resets the config object to the initial empty state

Arguments

Type IntentOptional Attributes Name
class(parameter_scan_config_type), intent(inout) :: self

private subroutine broadcast_parameter_scan_config(self)

Broadcasts all config parameters so object is populated identically on all processors

Arguments

Type IntentOptional Attributes Name
class(parameter_scan_config_type), intent(inout) :: self