map_factory_m Module

Creates the parallel mapping matrices. These matrices are needed for the construction of parallel operators.


Used by


Interfaces

interface

  • public module subroutine create_map_matrix(map_matrix, comm, equi, mesh_base, mesh_target, phi_direction, intorder, xorder, flux_box_surface_integral, use_fixed_stencil, use_gauss_quadrature, only_first_field_period, n_turns, dbgout, arclength_array, only_inner_points)

    Creates map matrix for the parallel operators mapping from mesh_base to mesh_target. The resulting map_matrix can be used to compute umap = u(x_target, y_target, phi_target), where [x,y,phi]_target is map point in mesh_target.

    Arguments

    Type IntentOptional Attributes Name
    type(csrmat_t), intent(out) :: map_matrix

    Created map matrix

    integer, intent(in) :: comm

    MPI communicator used for parallel creation of the map matrix

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

    Equilibrium

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

    Base mesh where mapping starts

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

    Target mesh where map matrix ends

    integer, intent(in) :: phi_direction

    Option whose sign determines whether the mapping should procede from base to target in the positive or negative phi direction

    integer, intent(in) :: intorder

    Interpolation order of the map matrix

    integer, intent(in), optional :: xorder

    Subcell splitting for flux-box integration 2^(xorder) Default xorder = 0 Advanced topic, see: GRILLIX documentation, section 7.1.4

    logical, intent(in), optional :: flux_box_surface_integral

    Indicates if ... point interpolation (default = false) ... or flux box surface integral is used (true) Advanced topic, see: GRILLIX documentation, section 7.1.4

    logical, intent(in), optional :: use_fixed_stencil

    Indicates interpolation method for the mapped quadrature points: ... if false (default), the interpolation stencil is chosen individually for each mapped quadrature point ... if true, the interpolation stencil is fixed as the mapped midpoint's stencil

    logical, intent(in), optional :: use_gauss_quadrature

    Indicates quadrature formula for mapped integral ... if false (default), uniform mapped midpoint quadrature ... if true, mapped tensor Gauss-Legendre quadrature

    logical, intent(in), optional :: only_first_field_period

    Create a map matrix for simulations in only the first field period of a 3D equilibrium

    integer, intent(in), optional :: n_turns

    Add additional turns to the difference in toroidal angle between mesh_base and mesh_target, default 0. Note that the sign is determined by phi_direction, and only the absolute value of n_turns is used.

    integer, intent(in), optional :: dbgout

    Specifies the number of information printed on screen. 0 represents no output, 1 minimal output, 2 debug output and 3 debug output by every MPI process

    real(kind=FP), intent(out), optional, dimension(mesh_base%get_n_points()) :: arclength_array

    Length of the field lines traced from the points of mesh_base to mesh_target. Only valid if xorder = 0, i.e. if the trace starts from the mesh points themselves and not from subcells.

    logical, intent(in), optional :: only_inner_points

    Compute the mapping only on inner mesh_base points. The map matrix (and the arclength array, if given) for boundary and ghost points will return zero.


Functions

public pure function calc_dphi(phi_base, phi_target, phi_direction, dphi_max, n_turns) result(dphi)

Calculates the difference in toroidal angle dphi between phi_base and phi_target, in the direction phi_direction. The maximum dphi is set by dphi_max, and extra turns can be added with n_turns.

Arguments

Type IntentOptional Attributes Name
real(kind=FP), intent(in) :: phi_base

Initial toroidal angle

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

Final toroidal angle

integer, intent(in) :: phi_direction

The sign of this argument determines whether the difference in phi should be taken from base to target in the positive or negative phi direction

real(kind=FP), intent(in), optional :: dphi_max

Maximum difference in toroidal angle, default 2pi. This option can also be thought of as setting where the periodic boundary is in phi.

integer, intent(in), optional :: n_turns

Add additional full turns +/- dphi_max to dphi, default zero. Note that the sign is determined by phi_direction, and only the absolute value of n_turns is used.

Return Value real(kind=fp)