fields Module

FIXME : Add documentation Made public for unit tests



Contents


Variables

Type Visibility Attributes Name Initial
integer, public :: fieldopt_switch
logical, public :: remove_zonal_flows_switch
logical, public :: force_maxwell_reinit
integer, public, parameter :: fieldopt_implicit = 1
integer, public, parameter :: fieldopt_test = 2
integer, public, parameter :: fieldopt_local = 3
integer, public, parameter :: fieldopt_gf_local = 4
logical, private :: dump_response
logical, private :: read_response
logical, private :: initialized = .false.
logical, private :: parameters_read = .false.
logical, private :: exist
type(text_option), private, parameter, dimension (6) :: fieldopts = (/text_option('default', fieldopt_implicit), text_option('implicit', fieldopt_implicit), text_option('test', fieldopt_test), text_option('local', fieldopt_local), text_option('gf_local', fieldopt_gf_local), text_option('implicit_local', fieldopt_local)/)
type(fields_config_type), private :: fields_config

Derived Types

type, public, extends(abstract_config_type) ::  fields_config_type

Used to represent the input configuration of fields

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?

logical, public :: do_smart_update = .false.

Used with field_option='local'. If true and x/y are distributed then in time advance only update local part of field in operations like phinew=phinew+phi etc.

logical, public :: dump_response = .false.

Writes files containing the field response matrix after initialisation. This currently works for field_option='implicit' or 'local'. We write to netcdf files by default but fall back to fortran unformatted (binary) files (which are not really portable) in the absence of netcdf.

logical, public :: field_local_allreduce = .false.

Set to true to use an allreduce (on mp_comm) in field calculation (field_option='local' only) rather than a reduction on a sub-communicator followed by a global broadcast. Typically a little faster than default performance but may depend on MPI implementation.

logical, public :: field_local_allreduce_sub = .false.

Set to true, along with field_local_allreduce and intspec_sub , to replace the allreduce used in the field calculation with an allreduce on a sub-communicator followed by a reduction on a "perpendicular" communicator. Typically a bit faster than default and scales slightly more efficiently. Note if this option is active only proc0 has knowledge of the full field arrays. Other processors know the full field for any supercell (connected x-y domains) for which it has any of the xy indices local in the g_lo layout.

logical, public :: field_local_nonblocking_collectives = .false.

If true then use nonblocking collective operations in the fields_local field calculation. This may or may not improve performance.

logical, public :: field_local_tuneminnrow = .false.

Set to true when using field_option='local' to automatically tune and select the best performing minimum block size (in a single supercell) assigned to a single processor. This can improve performance, but is not guaranteed to.

character(len=20), public :: field_option = 'default'

The field_option variable controls which time-advance algorithm is used for the linear terms. Allowed values are:

Read more…
logical, public :: field_subgath = .false.

Set to true to use allgatherv to fetch parts of the field update vector calculated on other procs. When false uses a sum_allreduce instead. This doesn't rely on sub-communicators so should work for any layout and processor count. Note: This only impacts field_option='implicit'

logical, public :: force_maxwell_reinit = .true.

If true then recalculate the fields from the distribution function using get_init_field when restarting a simulation rather than using the values in the restart file.

Read more…
integer, public :: minnrow = 16

Used with field_option='local' to set the minimum block size (in a single supercell) assigned to a single processor. Tuning this parameter changes the balance between work parallelisation and communication. As this value is lowered, more communication needs to be done, but more processors get assigned work. This may reduce the time spent in computation at the cost of time spent in communication. The optimal value is likely to depend upon the size of the problem and the number of processors being used. Furthermore it will affect intialisation and advance in different ways. Can be automatically tuned using field_local_tuneminnrow.

logical, public :: read_response = .false.

Reads files containing the field response matrix and uses to initialise GS2s response matrix rather than using the usual initialisation process.

logical, public :: remove_zonal_flows_switch = .false.

Delete zonal flows at every timestep.

character(len=256), public :: response_dir = ''

Sets location in which to store/look for response dump files. We don't currently check that this location exists before attempting to use it, which could cause problems. The default is to save them in the working directory.

character(len=256), public :: response_file = ''

Allows customisation of the base filename to be used for response files. If not set then we use run_name derived from the input file name.

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_fields_config Subroutine
procedure , public :: write => write_fields_config Subroutine
procedure , public :: reset => reset_fields_config Subroutine
procedure , public :: broadcast => broadcast_fields_config Subroutine
procedure , public , nopass :: get_default_name => get_default_name_fields_config Function
procedure , public , nopass :: get_default_requires_index => get_default_requires_index_fields_config Function

Functions

public function get_fields_config()

Get the module level config instance

Arguments

None

Return Value type(fields_config_type)

private function get_default_name_fields_config()

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 check_fields(report_unit)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: report_unit

public subroutine wnml_fields(unit)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: unit

public subroutine set_overrides(opt_ov)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(optimisations_overrides_type), intent(in) :: opt_ov

public subroutine fields_pre_init(fields_config_in)

Calls all initialisations required for init_fields_implicit/local, reads parameters and allocates field arrays

Arguments

Type IntentOptional Attributes Name
type(fields_config_type), intent(in), optional :: fields_config_in

public subroutine init_fields_parameters(fields_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(fields_config_type), intent(in), optional :: fields_config_in

public subroutine finish_fields_parameters()

FIXME : Add documentation

Arguments

None

public subroutine init_fields_level_1()

FIXME : Add documentation

Arguments

None

public subroutine finish_fields_level_1()

FIXME : Add documentation

Arguments

None

public subroutine init_fields_level_2()

FIXME : Add documentation

Arguments

None

public subroutine finish_fields_level_2()

FIXME : Add documentation

Arguments

None

public subroutine fields_init_response()

FIXME : Add documentation

Arguments

None

public subroutine init_fields(fields_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(fields_config_type), intent(in), optional :: fields_config_in

public subroutine dump_response_to_file(suffix)

Force the current response matrices to be written to file

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in), optional :: suffix

public subroutine set_init_fields()

FIXME : Add documentation

Arguments

None

public subroutine read_parameters(fields_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(fields_config_type), intent(in), optional :: fields_config_in

public subroutine set_dump_and_read_response(dump_flag, read_flag)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: dump_flag
logical, intent(in) :: read_flag

private subroutine allocate_arrays()

FIXME : Add documentation

Arguments

None

public subroutine advance(istep)

FIXME : Add documentation

Arguments

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

public subroutine reset_init()

FIXME : Add documentation

Arguments

None

public subroutine finish_fields()

FIXME : Add documentation

Arguments

None

public subroutine set_fields_config(fields_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(fields_config_type), intent(in), optional :: fields_config_in

private subroutine read_fields_config(self)

Reads in the fields_knobs namelist and populates the member variables

Arguments

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

private subroutine write_fields_config(self, unit)

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

Arguments

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

private subroutine reset_fields_config(self)

Resets the config object to the initial empty state

Arguments

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

private subroutine broadcast_fields_config(self)

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

Arguments

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