antenna Module

Provides random forcing for Alfven wave problem Originally by Hammett, Dorland and Quataert, Dec. 5, 2001

init_antenna should be called once per run antenna_amplitudes provides the necessary info per time step

added terms needed to calculate heating by antenna (apar_new)

two kinds of namelists should be added to the input file:

driver:

amplitude : RMS amplitude of | apar_antenna | w_antenna : frequency of driving, normalized to kpar v_Alfven Note: the imaginary part is the decorrelation rate nk_stir : Number of k modes that should be driven write_antenna: .true. for direct antenna output to runname.antenna default is .false.

stir: (stir_1, stir_2, stir_3, etc., one for each k we want to drive)

kx, ky, kz : each of size nk_stir (not larger!) : list of k components that are to be driven; integers travel : logical; choose false to make a standing wave : default value is .true.



Contents


Variables

Type Visibility Attributes Name Initial
complex, private :: w_antenna
complex, private, dimension(:), allocatable :: w_stir
complex, private, dimension(:,:,:), allocatable :: apar_new
complex, private, dimension(:,:,:), allocatable :: apar_old
integer, private, dimension(:), allocatable :: kx_stir
integer, private, dimension(:), allocatable :: ky_stir
integer, private, dimension(:), allocatable :: kz_stir
real, private :: amplitude
real, private :: t0
real, private :: w_dot
integer, private :: nk_stir
integer, private :: out_unit
logical, private :: restarting = .false.
logical, public :: no_driver = .false.
logical, private :: write_antenna = .false.
logical, private, dimension (:), allocatable :: trav
real, private :: beta_s
complex, private :: wtmp
logical, private :: initialized = .false.
type(driver_config_type), private :: driver_config
type(stir_config_type), private, dimension(:), allocatable :: stir_config

Derived Types

type, public, extends(abstract_config_type) ::  driver_config_type

Used to represent the input configuration of driver. See the documentation of the antenna module for more details.

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

Amplitude of Langevin antenna.

logical, public :: ant_off = .false.

Overrides all other options and turns off antenna if true.

integer, public :: nk_stir = 1

Number of independent Fourier modes driven by antenna.

logical, public :: restarting = .false.

If true then try to get initial antenna amplitudes from the restart file. If not found in restart file then will be set to 0.

real, public :: t0 = -1.0

Sets the time at which the antenna frequency changes from constant w_antenna to linearly varying, with linear piece proprtional to w_dot multiplied by time - t0.

complex, public :: w_antenna = (1.0, 0.0)

Frequency of Langevin antenna. Sets the constant part of the complex antenna frequency.

real, public :: w_dot = 0.0

Sets the coefficient in front of the time varying antenna frequency (real) component activated when time > t0.

logical, public :: write_antenna = .false.

Write antenna amplitudes to ASCII file for debugging.

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_driver_config Subroutine
procedure , public :: write => write_driver_config Subroutine
procedure , public :: reset => reset_driver_config Subroutine
procedure , public :: broadcast => broadcast_driver_config Subroutine
procedure , public , nopass :: get_default_name => get_default_name_driver_config Function
procedure , public , nopass :: get_default_requires_index => get_default_requires_index_driver_config Function

type, public, extends(abstract_config_type) ::  stir_config_type

Used to represent the input configuration of stir. See the documentation of the antenna module for more details.

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 :: a = -1.0

Initial amplitude of right-moving component. It is not necessary to set a and b unless you are doing restarts, which are rather clunky at the moment with the antenna included.

real, public :: b = -1.0

Initial amplitude of left-moving component. It is not necessary to set a and b unless you are doing restarts, which are rather clunky at the moment with the antenna included.

integer, public :: kx = 1

Mode number for stirring.

integer, public :: ky = 1

Mode number for stirring.

integer, public :: kz = 1

Mode number for stirring.

logical, public :: travel = .true.

Launches traveling wave if true (default) or standing wave if false.

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_stir_config Subroutine
procedure , public :: write => write_stir_config Subroutine
procedure , public :: reset => reset_stir_config Subroutine
procedure , public :: broadcast => broadcast_stir_config Subroutine
procedure , public , nopass :: get_default_name => get_default_name_stir_config Function
procedure , public , nopass :: get_default_requires_index => get_default_requires_index_stir_config Function

Functions

public pure function antenna_w()

FIXME : Add documentation

Arguments

None

Return Value complex

private function get_default_name_driver_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

public pure function get_driver_config()

Get the module level config instance

Arguments

None

Return Value type(driver_config_type)

private function get_default_name_stir_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

public pure function get_stir_config()

Get the array of module level config instances. If it isn't allocated, then return a zero-length array

Arguments

None

Return Value type(stir_config_type), allocatable, dimension(:)


Subroutines

public subroutine check_antenna(report_unit)

FIXME : Add documentation

Arguments

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

public subroutine wnml_antenna(unit)

FIXME : Add documentation

Arguments

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

public subroutine init_antenna(driver_config_in, stir_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(driver_config_type), intent(in), optional :: driver_config_in
type(stir_config_type), intent(in), optional, dimension(:), allocatable :: stir_config_in

private subroutine read_parameters(driver_config_in, stir_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(driver_config_type), intent(in), optional :: driver_config_in
type(stir_config_type), intent(in), optional, dimension(:), allocatable :: stir_config_in

public subroutine finish_antenna()

FIXME : Add documentation

Arguments

None

public subroutine antenna_amplitudes(apar)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
complex, intent(out), dimension (-ntgrid:,:,:) :: apar

public subroutine antenna_apar(kperp2, j_ext)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension (-ntgrid:,:,:) :: kperp2
complex, intent(out), dimension (-ntgrid:,:,:) :: j_ext

public subroutine get_jext(j_ext)

Calculate the external current in the antenna

Arguments

Type IntentOptional Attributes Name
real, intent(inout), dimension(:,:) :: j_ext

public subroutine a_ext_data(A_ext_old, A_ext_new)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
complex, intent(out), dimension (-ntgrid:,:,:) :: A_ext_old
complex, intent(out), dimension (-ntgrid:,:,:) :: A_ext_new

public subroutine dump_ant_amp()

Write antenna amplitudes to out_unit

Read more…

Arguments

None

public subroutine reset_init()

FIXME : Add documentation

Arguments

None

public subroutine set_antenna_config(driver_config_in, stir_config_in)

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

Arguments

Type IntentOptional Attributes Name
type(driver_config_type), intent(in), optional :: driver_config_in
type(stir_config_type), intent(in), optional, dimension(:), allocatable :: stir_config_in

private subroutine read_driver_config(self)

Reads in the driver namelist and populates the member variables

Arguments

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

private subroutine write_driver_config(self, unit)

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

Arguments

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

private subroutine reset_driver_config(self)

Resets the config object to the initial empty state

Arguments

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

private subroutine broadcast_driver_config(self)

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

Arguments

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

private subroutine read_stir_config(self)

Reads in the stir namelist and populates the member variables

Arguments

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

private subroutine write_stir_config(self, unit)

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

Arguments

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

private subroutine reset_stir_config(self)

Resets the config object to the initial empty state

Arguments

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

private subroutine broadcast_stir_config(self)

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

Arguments

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