multigrid_t Derived Type

type, public :: multigrid_t

Object which contains the multigrid meshes for solving Helmholtz problems. This includes nlvl number of meshes of increasing coarseness, restriction and prolongation matrices.


Finalization Procedures

final :: destructor_multigrid

  • public subroutine destructor_multigrid(self)

    Frees memory associated with multigrid

    Arguments

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

    Instance of the type


Type-Bound Procedures

procedure, public :: init => initialize_multigrid

  • interface

    public module subroutine initialize_multigrid(self, equi, phi, nlvls, spacing_f, size_neighbor, size_ghost_layer, mesh_finest, reorder_size, extend_beyond_wall, dbgout)

    Sets up multigrids, i.e. - creates meshes on all levels - creates prolongation and restriction operators

    Arguments

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

    Instance of the type

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

    Equilibrium (not changed)

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

    Toroidal angle

    integer, intent(in) :: nlvls

    Number of multigrid levels

    real(kind=FP), intent(inout) :: spacing_f

    Grid spacing on finest level (only adapted possibly for slab geometry)

    integer, intent(in) :: size_neighbor

    Number of neighbor points determined in each direction (for finest level, on coarser levels always 1)

    integer, intent(in) :: size_ghost_layer

    Depth of ghost point layer (for finest level, on coarser levels always 0)

    type(mesh_cart_t), intent(out), target :: mesh_finest

    Finest mesh (lvl=1) that was created

    integer, intent(in), optional, dimension(nlvls) :: reorder_size

    Grid reordering for each level

    logical, intent(in) :: extend_beyond_wall

    If true, meshes are extend beyond the wall

    integer, intent(in), optional :: dbgout

    Debug output level, default = 0, none

procedure, public :: write_netcdf => multigrid_write_netcdf

  • interface

    public module subroutine multigrid_write_netcdf(self, fgid)

    Writes information of multigrid to netcdf file

    Arguments

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

    Instance of the type

    integer, intent(in) :: fgid

    File or group id number of existing Netcdf4 file

procedure, public :: read_netcdf => multigrid_read_netcdf

  • interface

    public module subroutine multigrid_read_netcdf(self, fgid, mesh_finest)

    Reads information of multigrid from netcdf file

    Arguments

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

    Instance of the type

    integer, intent(in) :: fgid

    File or group id number of existing Netcdf4 file

    type(mesh_cart_t), intent(out), target :: mesh_finest

    Finest mesh (lvl=1) that was read from file

procedure, public :: set_phi_coarse

  • public subroutine set_phi_coarse(self, new_phi)

    Sets phi value on coarse meshes to a new value On finest mesh that is pointed to, needs to be set separately

    Arguments

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

    Instance of the type

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

    New phi value

procedure, public :: copy

  • public subroutine copy(self, multigrid_copy, mesh_finest)

    Copies the type to multigrid_copy, setting the internal pointer to mesh_finest

    Arguments

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

    Instance of the type

    type(multigrid_t), intent(out) :: multigrid_copy

    Copied multigrid

    type(mesh_cart_t), intent(in), target :: mesh_finest

    Finest (lvl=1) mesh to point to

procedure, public :: get_nlvls

  • public pure function get_nlvls(self)

    Returns nlvls

    Arguments

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

    Instance of the type

    Return Value integer

procedure, public :: get_np

  • public pure function get_np(self, lvl)

    Returns the number of total mesh points at the given level

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl

    Desired multigrid level

    Return Value integer

procedure, public :: get_np_boundary

  • public pure function get_np_boundary(self, lvl)

    Returns the number of boundary mesh points at the given level

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl

    Desired multigrid level

    Return Value integer

procedure, public :: get_np_inner

  • public pure function get_np_inner(self, lvl)

    Returns the number of inner mesh points at the given level

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl

    Desired multigrid level

    Return Value integer

procedure, public :: get_mesh_pointer

  • public function get_mesh_pointer(self, lvl) result(ptr)

    Returns mesh on desired level

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl

    Multigrid level of desired mesh

    Return Value type(mesh_cart_t), pointer

    Pointer to desired mesh

procedure, public :: get_first_idx_lvl_pointer

  • public function get_first_idx_lvl_pointer(self) result(ptr)

    Returns a pointer to the first_idx_lvl array

    Arguments

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

    Instance of the type

    Return Value integer, pointer, dimension(:)

procedure, public :: get_first_idx

  • public pure function get_first_idx(self, lvl) result(res)

    Returns first_idx at lvl

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl

    Level (up to nlvl+1)

    Return Value integer

procedure, public :: get_first_idx_boundary_lvl_pointer

  • public function get_first_idx_boundary_lvl_pointer(self) result(ptr)

    Returns a pointer to the first_idx_boundary_lvl array

    Arguments

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

    Instance of the type

    Return Value integer, pointer, dimension(:)

procedure, public :: get_first_idx_boundary

  • public pure function get_first_idx_boundary(self, lvl) result(res)

    Returns first_idx_boundary at lvl

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl

    Level (up to nlvl+1)

    Return Value integer

procedure, public :: get_first_idx_inner_lvl_pointer

  • public function get_first_idx_inner_lvl_pointer(self) result(ptr)

    Returns a pointer to the first_idx_inner_lvl array

    Arguments

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

    Instance of the type

    Return Value integer, pointer, dimension(:)

procedure, public :: get_first_idx_inner

  • public pure function get_first_idx_inner(self, lvl) result(res)

    Returns first_idx_inner at lvl

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl

    Level (up to nlvl+1)

    Return Value integer

procedure, public :: get_np_total

  • public pure function get_np_total(self) result(res)

    Returns number of mesh points sumed over all levels

    Arguments

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

    Instance of the type

    Return Value integer

procedure, public :: get_np_inner_total

  • public pure function get_np_inner_total(self) result(res)

    Returns number of inner mesh points sumed over all levels

    Arguments

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

    Instance of the type

    Return Value integer

procedure, public :: restrict

  • interface

    public module subroutine restrict(self, lvl_f, uf, lvl_c, uc)

    Restricts quantity from fine grid to coarse grid

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl_f

    Level of fine grid

    real(kind=FP), intent(in), dimension(:) :: uf

    Quantity on fine grid

    integer, intent(in) :: lvl_c

    Level of coarse grid

    real(kind=FP), intent(out), dimension(:) :: uc

    Quantity on coarse grid

procedure, public :: restrict_inner

  • interface

    public module subroutine restrict_inner(self, lvl_f, uf, lvl_c, uc)

    Restricts quantity defined only on inner grid points from fine grid to coarse grid

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl_f

    Level of fine grid

    real(kind=FP), intent(in), dimension(:) :: uf

    Quantity on fine grid

    integer, intent(in) :: lvl_c

    Level of coarse grid

    real(kind=FP), intent(out), dimension(:) :: uc

    Quantity on coarse grid

procedure, public :: prolong

  • interface

    public module subroutine prolong(self, lvl_c, uc, lvl_f, uf)

    Prolongs quantity from coarse grid to fine grid

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl_c

    Level of coarse grid

    real(kind=FP), intent(in), dimension(:) :: uc

    Quantity on coarse grid

    integer, intent(in) :: lvl_f

    Level of fine grid

    real(kind=FP), intent(out), dimension(:) :: uf

    Quantity on fine grid

procedure, public :: extrapolate_boundary_points

  • interface

    public module subroutine extrapolate_boundary_points(self, lvl, u)

    Extrapolates boundary points according to homegeneous Neumann boundary condition

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl

    Level of mesh

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

    Quantity

procedure, public :: expose_data

  • interface

    public module subroutine expose_data(self, intermediate_object, data_object)

    Exposes multigrid data through multigrid_data object boundary condition

    Arguments

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

    Instance of the type

    type(multigrid_intermediate_data_t), intent(out), target :: intermediate_object

    Intermediate object, holds arrays of mesh_cart and csrmat "data"

    type(multigrid_data_t), intent(out) :: data_object

    Destination multigrid_data object

procedure, public :: get_mrcsr_pointer

  • public function get_mrcsr_pointer(self, lvl_f) result(res)

    Returns pointer to restriction matrix

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl_f

    Level of restriction matrix (from lvl_f to lvl_f+1)

    Return Value type(csrmat_t), pointer

    Helmholtz matrix for level lvl

procedure, public :: get_mpcsr_pointer

  • public function get_mpcsr_pointer(self, lvl_f) result(res)

    Returns pointer to prolongation matrix

    Arguments

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

    Instance of the type

    integer, intent(in) :: lvl_f

    Level of prolongation matrix (from lvl_f+1 to lvl_f)

    Return Value type(csrmat_t), pointer

    Helmholtz matrix for level lvl