parbnd_taylor_t Derived Type

type, public :: parbnd_taylor_t

Handles setting of boundary conditions at parallel boundaries according to Taylor expansion method


Components

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

Indicates if the magnetic field is directed towards or away the boundary at the closest parallel boundary: - = 1 : if B points toward the boundary - = -1 : if B points away from the boundary) - = 0 : if no boundary is found nearby (e.g., in closed field line region or when the boundary is too far from the point)

real(kind=FP), public, allocatable, dimension(:,:) :: dists_to_bnd

Distances along the magnetic field line to the boundary

For each point l: - dists_to_bnd(l, 1): distance from point l to the boundary - dists_to_bnd(l, 2): distance from the mapped point of point l to the boundary - dists_to_bnd(l, 3): distance from the next-but-one mapped point of point l to the boundary

Sign convention: - Distance is positive if measured in the direction of the magnetic field B - Distance is negative if measured in the opposite direction of B

real(kind=FP), public, allocatable, dimension(:) :: depth_in_bnd

Corresponding toridal angle to boundary in units of dphi - Positive values indicate that point is inside boundary - Negative values indicate that point is outside boundary - A value of zero indicates that boundary is too far away (e.g., in closed field line region)


Finalization Procedures

final :: destructor_parbnd_taylor_t

  • private subroutine destructor_parbnd_taylor_t(self)

    Destructor for parbnd_taylor_t

    Arguments

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

Type-Bound Procedures

procedure, public :: init => init_parbnd_taylor

  • private subroutine init_parbnd_taylor(self, equi, mesh, dphi, filename)

    Initialises parbnd_taylor, by computing distances to boundaries

    Arguments

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

    Instance of type

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

    Equilibrium

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

    Mesh

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

    Toroidal grid distance

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

    Filename, where to read parameters from, if not provided default parameters will be used

procedure, public :: display

  • private subroutine display(self)

    Writes basic information of parbnd_taylor_t to stdout

    Arguments

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

    Instance of class

procedure, public :: write_netcdf => write_netcdf_parbnd_taylor

  • interface

    private module subroutine write_netcdf_parbnd_taylor(self, fgid)

    Writes parbnd_taylor data to NetCDF id

    Arguments

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

    Instance of class

    integer, intent(in) :: fgid

    NetCDF file or group id

procedure, public :: read_netcdf => read_netcdf_parbnd_taylor

  • interface

    private module subroutine read_netcdf_parbnd_taylor(self, fgid)

    Reads parbnd_taylor data from NetCDF id

    Arguments

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

    Instance of class

    integer, intent(in) :: fgid

    NetCDF file or group id

procedure, public :: set_guard_points

  • private subroutine set_guard_points(self, equi, mesh, fac_dir, fac_nmn, bnd_vals, u, u_bwd2, u_bwd1, u_fwd1, u_fwd2, order, uisect)

    Sets boundary condition on guard points according to eq. (B.2) in DOI 10.1088/1361-6587/aaa373, with modifications for deep guard points

    Arguments

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

    Instance of class

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

    Equilibrium

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

    Mesh

    real(kind=FP), intent(in) :: fac_dir

    Factor for Dirichlet boundary condition (beta in DOI 10.1088/1361-6587/aaa373)

    real(kind=FP), intent(in) :: fac_nmn

    Factor for Neumann boundary condition (gamma in DOI 10.1088/1361-6587/aaa373)

    real(kind=FP), intent(in), dimension(mesh%get_n_points()) :: bnd_vals

    Boundary values at intersection point of field line with boundary (alpha in DOI 10.1088/1361-6587/aaa373)

    real(kind=FP), intent(inout), dimension(mesh%get_n_points()) :: u

    Field on which guard points are set according to boundary condition

    real(kind=FP), intent(in), dimension(mesh%get_n_points()) :: u_bwd2

    Map points up to two backward and two forward planes

    real(kind=FP), intent(in), dimension(mesh%get_n_points()) :: u_bwd1

    Map points up to two backward and two forward planes

    real(kind=FP), intent(in), dimension(mesh%get_n_points()) :: u_fwd1

    Map points up to two backward and two forward planes

    real(kind=FP), intent(in), dimension(mesh%get_n_points()) :: u_fwd2

    Map points up to two backward and two forward planes

    integer, intent(in), optional :: order

    Specifies the order of the method (1 or 2, default 2)

    real(kind=FP), intent(out), optional, dimension(mesh%get_n_points()) :: uisect

    Values of field at intersection point of field line with boundary

procedure, public :: extrapolate_guard_points

  • private subroutine extrapolate_guard_points(self, equi, mesh, u, u_bwd2, u_bwd1, u_fwd1, u_fwd2, uisect)

    Extrapolates field into parallel guard points region. Method is based on prescribing second parallel derivative along field lines to zero.

    Arguments

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

    Instance of class

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

    Equilibrium

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

    Mesh

    real(kind=FP), intent(inout), dimension(mesh%get_n_points()) :: u

    Field on which guard points are set according to boundary condition

    real(kind=FP), intent(in), dimension(mesh%get_n_points()) :: u_bwd2

    Map points up to two backward and two forward planes

    real(kind=FP), intent(in), dimension(mesh%get_n_points()) :: u_bwd1

    Map points up to two backward and two forward planes

    real(kind=FP), intent(in), dimension(mesh%get_n_points()) :: u_fwd1

    Map points up to two backward and two forward planes

    real(kind=FP), intent(in), dimension(mesh%get_n_points()) :: u_fwd2

    Map points up to two backward and two forward planes

    real(kind=FP), intent(out), optional, dimension(mesh%get_n_points()) :: uisect

    Values of field at intersection point of field line with boundary