parallel_target_flux_t Derived Type

type, public :: parallel_target_flux_t

Datatype for computing and storing points which map into the penalisation volume. NOTE: Indices are stored with respect to the INNER mesh since we require their dirindfun data for computation


Contents


Components

Type Visibility Attributes Name Initial
integer, public, allocatable, dimension(:) :: inds_fwd

Indices of points on inner mesh which map into pen volume in fwd plane

real(kind=GP), public, allocatable, dimension(:) :: weights_fwd

Penalisation values of points mapped into pen volume in fwd plane

integer, public :: n_inds_fwd = 0

Number of fwd points to store

integer, public, allocatable, dimension(:) :: inds_bwd

Indices of points on inner mesh which map into pen volume in bwd plane

real(kind=GP), public, allocatable, dimension(:) :: weights_bwd

Penalisation values of points mapped into pen volume in bwd plane

integer, public :: n_inds_bwd = 0

Number of bwd points to store

logical, public :: is_staggered

Whether stored points are from the canonical or staggered grid


Finalization Procedures

final :: destructor


Type-Bound Procedures

procedure, public :: build => build_target_markers

  • interface

    public module subroutine build_target_markers(self, comm_handler, mesh, map, penalisation, staggered, pen_threshold, dbgout)

    Find target points and construct storage

    Arguments

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

    Instance of class

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

    Communicator

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

    Mesh

    type(parallel_map_t), intent(in) :: map

    Parallel map

    type(penalisation_t), intent(in) :: penalisation

    Penalisation

    logical, intent(in) :: staggered

    Whether to construct target points on staggered or canonical grid Acts on canonical grid if set to .false. Choice must be consistent with input mesh!

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

    Threshold for interpolated penalisation value on mapped point Only points with values above the threshold are stored as target points

    integer, intent(in), optional :: dbgout

    Debug output level

procedure, public :: write_netcdf => write_netcdf_target_markers

  • interface

    public module subroutine write_netcdf_target_markers(self, fgid)

    Writes stored indices and weights to netcdf file

    Arguments

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

    Instance of class

    integer, intent(in) :: fgid

    File or group id

procedure, public :: read_netcdf => read_netcdf_target_markers

  • interface

    public module subroutine read_netcdf_target_markers(self, fgid)

    Reads stored indices and weights from netcdf file

    Arguments

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

    Instance of class

    integer, intent(in) :: fgid

    File or group id

procedure, public :: compute => compute_target_flux

  • interface

    public module subroutine compute_target_flux(self, comm_handler, mesh, penalisation, equi_storage, g, flux_fwd, flux_bwd, mode)

    Compute parallel fluxes into penalisation region flux_fwd is defined as [g * dS] integrated over the set of points which map into the penalisation region in the forward plane. flux_bwd is defined analogously for penalisation in the backward plane. g is a parallel flux, e.g. ne * upar_cano, B the magnetic field, dS the boundary surface Note that input parameters must be consistent with the grid choice when building the marked points, e.g. only staggered or only canonical

    Arguments

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

    Instance of class

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

    Communicator

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

    Mesh

    type(penalisation_t), intent(in) :: penalisation

    Penalisation

    type(equilibrium_storage_t), intent(in) :: equi_storage

    Equilibrium storage

    real(kind=GP), intent(in), dimension(mesh%get_n_points()) :: g

    Parallel flux in plane

    real(kind=GP), intent(out) :: flux_fwd

    Resulting flux into forward plane penalisation

    real(kind=GP), intent(out) :: flux_bwd

    Resulting flux into backward plane penalisation

    character(len=*), intent(in), optional :: mode

    Mode of flux computation, may select between: 'DEFAULT' : Fluxes are NOT weighted by local penalisation value 'WEIGHTED' : Fluxes are weighted by local penalisation value

procedure, public :: compute_single => compute_target_flux_single

  • interface

    public module function compute_target_flux_single(self, mesh, penalisation, equi_storage, i_marker, g, dirind, mode) result(flux_out)

    Compute parallel fluxes into penalisation region for a single flux point

    Arguments

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

    Instance of class

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

    Mesh

    type(penalisation_t), intent(in) :: penalisation

    Penalisation

    type(equilibrium_storage_t), intent(in) :: equi_storage

    Equilibrium storage

    integer, intent(in) :: i_marker

    Index of point in fwd/bwd marker array

    real(kind=GP), intent(in), dimension(mesh%get_n_points()) :: g

    Parallel flux in plane

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

    Field direction indication, either: 'fwd' : Compute forward flux into penalisation 'bwd' : Compute backward flux into penalisation

    character(len=*), intent(in), optional :: mode

    Mode of flux computation, may select between: 'DEFAULT' : Fluxes are NOT weighted by local penalisation value 'WEIGHTED' : Fluxes are weighted by local penalisation value

    Return Value real(kind=GP)

    Resulting flux into into penalisation