variable_m Module

Definition of variable


Uses


Contents


Interfaces

interface

  • public pure module function get_ndim(self)

    Returns dimension of variable

    Arguments

    Type IntentOptional Attributes Name
    class(variable_t), intent(in) :: self

    Instance of the type

    Return Value integer

interface

  • public module function get_halo(self, comm_handler, ihalo) result(res)

    Returns pointer to halo field located at plane=plane+ihalo

    Arguments

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

    Instance of the type

    type(comm_handler_t), intent(in) :: comm_handler

    Communicators

    integer, intent(in) :: ihalo

    Displacement to plane, where information is fetched from

    Return Value real(kind=GP), dimension(:), pointer

    Pointer to halo field

interface

  • public module subroutine init_variable(self, comm_handler, ndim, staggered, init_vals)

    Initialises variable

    Arguments

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

    Instance of the type

    type(comm_handler_t), intent(in) :: comm_handler

    Communicators

    integer, intent(in) :: ndim

    Dimension of variable

    logical, intent(in) :: staggered

    Indicates if variable is defined on staggered or canonical grid WILL BE REMOVED

    real(kind=GP), intent(in), optional, dimension(ndim) :: init_vals

    Values for initialisation if present, otherwise will be initialised with zeros

interface

  • public module subroutine create_halos(self, comm_handler, nhalo_fwd, nhalo_bwd)

    Allocates halo fields

    Arguments

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

    Instance of the type

    type(comm_handler_t), intent(in) :: comm_handler

    Communicators

    integer, intent(in) :: nhalo_fwd

    Number of halo planes in the forward direction

    integer, intent(in) :: nhalo_bwd

    Number of halo planes in the backward direction

interface

  • public module subroutine start_comm_halos(self, comm_handler, step)

    Starts communication of halo fields

    Arguments

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

    Instance of the type

    type(comm_handler_t), intent(in) :: comm_handler

    Communicators

    integer, intent(in), optional :: step

    Only starts communication to get data from plane+step If not present, communication over all halos is performed

interface

  • public module subroutine finalize_comm_halos(self, comm_handler, step)

    Finalizes communication of halos

    Arguments

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

    Instance of the type

    type(comm_handler_t), intent(in) :: comm_handler

    Communicators

    integer, intent(in), optional :: step

    Only finalizes communication that gets data from plane+step If not present, communication over all halos is finalized

interface

  • public module subroutine set_blob_toroidal(self, mesh, x0, y0, phi0, wx, wy, wphi, amp)

    Sets Gaussian in (R, phi, Z) for variable data

    Arguments

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

    Instance of the type

    type(mesh_cart_t), intent(in) :: mesh

    Mesh within poloidal plane (canonical or staggered)

    real(kind=GP), intent(in) :: x0

    x-coordinate of center of blob

    real(kind=GP), intent(in) :: y0

    y-coordinate of center of blob

    real(kind=GP), intent(in) :: phi0

    phi-coordinate of center of blob

    real(kind=GP), intent(in) :: wx

    Gaussian width of blob in x-direction

    real(kind=GP), intent(in) :: wy

    Gaussian width of blob in y-direction

    real(kind=GP), intent(in) :: wphi

    Gaussian width of blob in toroidal phi-direction A delta peak on first plane is assumed if width is set to zero

    real(kind=GP), intent(in) :: amp

    Amplitude of blob

interface

  • public module subroutine set_blob_aligned(self, equi, mesh, x0, y0, phi0, wx, wy, wpar, amp)

    Sets Gaussian in (R, parallel, Z) for variable data, aligned along magnetic field

    Arguments

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

    Instance of the type

    class(equilibrium_t), intent(inout) :: equi

    Equilibrium

    type(mesh_cart_t), intent(in) :: mesh

    Mesh within poloidal plane (canonical or staggered)

    real(kind=GP), intent(in) :: x0

    x-coordinate of center of blob

    real(kind=GP), intent(in) :: y0

    y-coordinate of center of blob

    real(kind=GP), intent(in) :: phi0

    phi-coordinate of center of blob

    real(kind=GP), intent(in) :: wx

    Gaussian width of blob in x-direction

    real(kind=GP), intent(in) :: wy

    Gaussian width of blob in y-direction

    real(kind=GP), intent(in) :: wpar

    Gaussian width of blob in toroidal phi-direction A delta peak is assumed if width is set to zero

    real(kind=GP), intent(in) :: amp

    Amplitude of blob

interface

  • public module subroutine write_netcdf_variable(self, comm_handler, fgid, varname)

    Writes variable to NETCDF file

    Arguments

    Type IntentOptional Attributes Name
    class(variable_t), intent(in) :: self

    Instance of the type

    type(comm_handler_t), intent(in) :: comm_handler

    MPI communication handler

    integer, intent(in) :: fgid

    NETCDF file or group id

    character(len=*), intent(in) :: varname

    Name for variable for identification in NETCDF file

interface

  • public module subroutine read_netcdf_variable(self, comm_handler, fgid, varname)

    Reads variable from NETCDF file Note: This routine only works yet for axisymmetric conditions, but not for 3D geometries

    Arguments

    Type IntentOptional Attributes Name
    class(variable_t), intent(out) :: self

    Instance of the type

    type(comm_handler_t), intent(in) :: comm_handler

    MPI communication handler

    integer, intent(in) :: fgid

    NETCDF file or group id

    character(len=*), intent(in) :: varname

    Name for variable for identification in NETCDF file

interface

  • public module subroutine destructor(self)

    Frees memory associated with variable

    Arguments

    Type IntentOptional Attributes Name
    type(variable_t), intent(inout) :: self

    Instance of the type


Derived Types

type, public ::  variable_t

Datatype for variable_t

Components

Type Visibility Attributes Name Initial
real(kind=GP), public, allocatable, dimension(:) :: vals

Values of variable

real(kind=GP), public, dimension(:), pointer :: hfwd => null()

Pointer to halos_fwd(:,1), simplifies call of parallel operators

real(kind=GP), public, dimension(:), pointer :: hbwd => null()

Pointer to halos_bwd(:,1), simplifies call of parallel operators

Finalizations Procedures

final :: destructor

Type-Bound Procedures

procedure , public :: get_ndim Interface
procedure , public :: init => init_variable Interface
procedure , public :: create_halos Interface
procedure , public :: get_halo Interface
procedure , public :: start_comm_halos Interface
procedure , public :: finalize_comm_halos Interface
procedure , public :: set_blob_toroidal Interface
procedure , public :: set_blob_aligned Interface
procedure , public :: write_netcdf => write_netcdf_variable Interface
procedure , public :: read_netcdf => read_netcdf_variable Interface