penalisation_m Module

Penalisation


Uses


Contents


Interfaces

interface

  • public module function func_hermite_aux(this, t, iuser, ruser)

    Wrapper function for zero-finding routine

    Arguments

    Type IntentOptional Attributes Name
    class(func_1d_charfun_t), intent(in) :: this

    Instance of test function class

    real(kind=GP), intent(in) :: t
    integer, intent(in), dimension(:) :: iuser

    Integer inputs, (1) sets hermite_order

    real(kind=GP), intent(in), dimension(:) :: ruser

    Float inputs, (1) sets charfun_at_target (2) sets charfun_parwidth

    Return Value real(kind=gp)

interface

  • public module subroutine set_parameters_penalisation(self, dphi, filename, pen_method_in, penfuns_type_in, hermite_order_in, charfun_parwidth_in, charfun_radlimwidth_in, dirindfun_parwidth_in, dphi_max_in, charfun_at_target_in, max_step_size_in, rho_min_in)

    Sets parameters for penalisation, either via namelist from file, or setting explicitly

    Arguments

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

    Instance of the type

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

    Toroidal grid distance

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

    Filename where parameter are read from

    integer, intent(in), optional :: pen_method_in

    Method of penalisation

    integer, intent(in), optional :: penfuns_type_in

    Type of penalisation function

    integer, intent(in), optional :: hermite_order_in

    Order of Hermite polynomial used as penalisation function

    real(kind=GP), intent(in), optional :: charfun_parwidth_in

    Parallel decay length of characteristic penalisation function

    real(kind=GP), intent(in), optional :: charfun_radlimwidth_in

    Radial decay length (only for limiter geometry)

    real(kind=GP), intent(in), optional :: dirindfun_parwidth_in

    Parallel decay length of direction indicator function

    real(kind=GP), intent(in), optional :: dphi_max_in

    Parallel decay length of direction indicator function

    real(kind=GP), intent(in), optional :: charfun_at_target_in

    Contourvalue of characteristic function at location of target plate

    real(kind=GP), intent(in), optional :: max_step_size_in

    Maximum step size for the tracing

    real(kind=GP), intent(in), optional :: rho_min_in

    For the build VIA_STABLE_TRACE: grid points that have smaller rho values than this, all penalization functions are automatically zero

interface

  • public module subroutine build_penalisation(self, comm_handler, equi, mesh, multigrid, dbgout)

    Builds penalisation functions

    Arguments

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

    Instance of the type

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

    Comunication handler

    class(equilibrium_t) :: equi

    Equilibrium (not changed)

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

    Mesh

    type(multigrid_t), intent(inout) :: multigrid

    Multigrid

    integer, intent(in), optional :: dbgout

    Debug output level

interface

  • public module subroutine build_via_trace(self, comm_handler, equi, mesh, dbgout)

    Builds penalisation functions based on field line tracing with smooth transition

    Arguments

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

    Instance of the type

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

    Comunication handler

    class(equilibrium_t) :: equi

    Equilibrium (not changed)

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

    Mesh

    integer, intent(in), optional :: dbgout

    Debug output level

interface

  • public module subroutine build_via_subtrace(self, comm_handler, equi, mesh, multigrid, dbgout)

    Builds penalisation functions based on sub-field line tracing subsequently from plane to plane with smooth transition

    Arguments

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

    Instance of the type

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

    Comunication handler

    class(equilibrium_t) :: equi

    Equilibrium (not changed)

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

    Mesh

    type(multigrid_t), intent(inout) :: multigrid

    Multigrid

    integer, intent(in), optional :: dbgout

    Debug output level

interface

  • public module subroutine build_via_in_vessel(self, comm_handler, equi, mesh, dbgout)

    Builds penalisation functions based on equilibrium's in_vessel function (hard transition)

    Arguments

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

    Instance of the type

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

    Comunication handler

    class(equilibrium_t) :: equi

    Equilibrium (not changed)

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

    Mesh

    integer, intent(in), optional :: dbgout

    Debug output level

interface

  • public module subroutine build_via_stable_trace(self, comm_handler, equi, mesh, dbgout)

    Builds penalisation functions based on field line tracing that can handle every target shape, with smooth transition

    Arguments

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

    Instance of the type

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

    Comunication handler

    class(equilibrium_t) :: equi

    Equilibrium (not changed)

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

    Mesh

    integer, intent(in), optional :: dbgout

    Debug output level

interface

  • public module subroutine build_via_rho(self, comm_handler, filepath, equi, mesh, dbgout)

    Builds penalisation functions based on equilibrium's rho flux surface label

    Arguments

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

    Instance of the type

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

    Comunication handler

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

    Path to file where to read parameters specific for rho penalisation from

    class(equilibrium_t) :: equi

    Equilibrium (not changed)

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

    Mesh

    integer, intent(in), optional :: dbgout

    Debug output level

interface

  • public module subroutine build_pen_inds(self, mesh, dbgout)

    Build storage of indices in penalisation/bordering penalisation region Note that index is w.r.t full mesh, but points must be from inner mesh

    Arguments

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

    Instance of class

    type(mesh_cart_t) :: mesh

    Mesh

    integer, intent(in), optional :: dbgout

    Debug output level

interface

  • public module subroutine display_penalisation(self)

    Displays information on penalisation

    Arguments

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

    Instance of the type

interface

  • public module subroutine write_netcdf_penalisation(self, fgid)

    Writes penalisation to netcdf file

    Arguments

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

    Instance of the type

    integer, intent(in) :: fgid

    netcdf file or group id

interface

  • public module subroutine read_netcdf_penalisation(self, fgid)

    Reads penalisation from netcdf file

    Arguments

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

    Instance of the type

    integer, intent(in) :: fgid

    netcdf file or group id

interface

  • public module subroutine destructor(self)

    Frees memory associated with penalisation

    Arguments

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

    Instance of the type

interface

  • public module subroutine build_wip3d_penalisation(pen_cano, pen_stag, comm_handler, equi, equi_on_cano, equi_on_stag, mesh_cano, mesh_stag, multigrid_cano, multigrid_stag, map, dbgout)

    Builds penalisation functions for 3d equilibria based on parallel diffusion equation This is yet an experimental feature

    Arguments

    Type IntentOptional Attributes Name
    class(penalisation_t), intent(inout) :: pen_cano

    Penalisation for canonical mesh

    class(penalisation_t), intent(inout) :: pen_stag

    Penalisation for staggered mesh

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

    Comunication handler

    class(equilibrium_t) :: equi

    Equilibrium (not changed)

    class(equilibrium_storage_t), intent(inout) :: equi_on_cano

    Equilibrim quantities on canonical mesh

    class(equilibrium_storage_t), intent(inout) :: equi_on_stag

    Equilibrim quantities on staggered mesh

    type(mesh_cart_t), intent(inout) :: mesh_cano

    Mesh (canonical)

    type(mesh_cart_t), intent(inout) :: mesh_stag

    Mesh (staggered)

    type(multigrid_t), intent(inout) :: multigrid_cano

    Multigrid (canonical)

    type(multigrid_t), intent(inout) :: multigrid_stag

    Multigrid (staggered)

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

    Map

    integer, intent(in), optional :: dbgout

    Debug output level


Derived Types

type, public ::  penalisation_t

Datatype for penalisation

Components

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

Characteristic function of penalisation Formerly known as chi

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

Function indicating direction of magnetic field (towards/away from target) Formerly known as xi or zeta

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

Indices on full mesh which lie in penalisation region

integer, public :: n_p_inds

Size of p_inds

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

Indices on full mesh with charfun value 0 that have direct neighbors in the penalisation region

integer, public :: n_pb_inds

Size of pb_inds

Finalizations Procedures

final :: destructor

Type-Bound Procedures

procedure , public :: set_parameters => set_parameters_penalisation Interface
procedure , public :: build => build_penalisation Interface
procedure , public :: build_wip3d => build_wip3d_penalisation Interface
procedure , public :: write_netcdf => write_netcdf_penalisation Interface
procedure , public :: read_netcdf => read_netcdf_penalisation Interface
procedure , public :: display => display_penalisation Interface
procedure , public :: get_dphi Function
procedure , public :: get_dphi_max Function
procedure , public :: get_penfuns_type Function
procedure , public :: get_hermite_order Function
procedure , public :: get_charfun_parwidth Function
procedure , public :: get_charfun_radlimwidth Function
procedure , public :: get_dirindfun_parwidth Function
procedure , public :: get_charfun_at_target Function
procedure , public :: get_charfun_val Function
procedure , public :: get_dirindfun_val Function

Functions

public pure function get_penfuns_type(self)

Returns type of penalisation function

Arguments

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

Instance of the type

Return Value integer

public pure function get_hermite_order(self)

Returns order of Hermite polynomial used as penalisation function

Arguments

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

Instance of the type

Return Value integer

public pure function get_charfun_parwidth(self)

Returns parallel decay length of characteristic penalisation function

Arguments

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

Instance of the type

Return Value real(kind=gp)

public pure function get_charfun_radlimwidth(self)

Radial radial decay length (only for limiter geometry)

Arguments

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

Instance of the type

Return Value real(kind=gp)

public pure function get_dirindfun_parwidth(self)

Returns parallel decay length of direction indicator function

Arguments

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

Instance of the type

Return Value real(kind=gp)

public pure function get_dphi(self)

Toroidal grid distance

Arguments

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

Instance of the type

Return Value real(kind=gp)

public pure function get_dphi_max(self)

Maximum angle to be traced for building penalisation

Arguments

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

Instance of the type

Return Value real(kind=gp)

public pure function get_charfun_at_target(self)

Contourvalue of characteristic function at target plate

Arguments

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

Instance of the type

Return Value real(kind=gp)

public pure function get_charfun_val(self, ki)

Returns value of characteristic function

Arguments

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

Instance of the type

integer, intent(in) :: ki

Running index for inner grid

Return Value real(kind=gp)

public pure function get_dirindfun_val(self, ki)

Returns value of direction indicator function

Arguments

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

Instance of the type

integer, intent(in) :: ki

Running index for inner grid

Return Value real(kind=gp)