mg_t Derived Type

type, public :: mg_t


Inherits

type~~mg_t~2~~InheritsGraph type~mg_t~2 mg_t type~mg_bc_t~2 mg_bc_t type~mg_t~2->type~mg_bc_t~2 bc type~mg_box_t~2 mg_box_t type~mg_t~2->type~mg_box_t~2 boxes type~mg_buf_t~2 mg_buf_t type~mg_t~2->type~mg_buf_t~2 buf type~mg_comm_t~2 mg_comm_t type~mg_t~2->type~mg_comm_t~2 comm_restrict, comm_prolong, comm_ghostcell type~mg_lvl_t~2 mg_lvl_t type~mg_t~2->type~mg_lvl_t~2 lvls type~mg_timer_t~2 mg_timer_t type~mg_t~2->type~mg_timer_t~2 timers

Components

Type Visibility Attributes Name Initial
type(mg_bc_t), public :: bc(mg_num_neighbors,mg_max_num_vars)

To store pre-defined boundary conditions per direction per variable

procedure(mg_box_op), public, pointer, nopass :: box_op => null()

Multigrid operator (e.g., Laplacian)

procedure(mg_box_prolong), public, pointer, nopass :: box_prolong => null()

Multigrid prolongation method

integer, public :: box_size = -1

Size of boxes in cells, be equal for all dimensions

integer, public :: box_size_lvl(mg_lvl_lo:mg_lvl_hi)

Size of boxes per level (differs for coarsest levels)

procedure(mg_box_gsrb), public, pointer, nopass :: box_smoother => null()

Multigrid smoother

type(mg_box_t), public, allocatable :: boxes(:)

Array with all boxes in the tree. Only boxes owned by this task are actually allocated

type(mg_buf_t), public, allocatable :: buf(:)

Buffer for communication with each other task

integer, public :: coarsest_grid(2) = 2
integer, public :: comm = -1

MPI communicator

type(mg_comm_t), public :: comm_ghostcell

Communication info for ghost cell filling

type(mg_comm_t), public :: comm_prolong

Communication info for prolongation

type(mg_comm_t), public :: comm_restrict

Communication info for restriction

integer, public :: domain_size_lvl(2,mg_lvl_lo:mg_lvl_hi)

Size of domain per level (if uniformly refined)

real(kind=dp), public :: dr(2,mg_lvl_lo:mg_lvl_hi)

Grid spacing per level

integer, public :: first_normal_lvl = -1

First normal level of the quadtree/octree, at coarser levels parents have only one child

integer, public :: geometry_type = mg_cartesian

Type of grid geometry

integer, public :: highest_lvl = -1

Highest grid level in the tree

logical, public :: is_allocated = .false.

Whether storage has been allocated for boxes

integer, public :: lowest_lvl = -1

Lowest grid level in the tree

type(mg_lvl_t), public :: lvls(mg_lvl_lo:mg_lvl_hi)

List of all levels

integer, public :: max_coarse_cycles = 1000

Maximum number of cycles on the coarse grid

integer, public :: my_rank = -1

MPI rank of this task

integer, public :: n_boxes = 0

Total number of boxes in the tree (among all processes)

integer, public :: n_cpu = -1

Number of MPI tasks

integer, public :: n_cycle_down = 2

Number of cycles when doing downwards relaxation

integer, public :: n_cycle_up = 2

Number of cycles when doing upwards relaxation

integer, public :: n_extra_vars = 0

Number of extra cell-centered variable (e.g., for coefficients)

integer, public :: n_smoother_substeps = 1

Number of substeps for the smoother (for GSRB this is 2)

integer, public :: n_timers = 0

Number of timers

integer, public :: operator_type = mg_laplacian

Type of operator

logical, public :: periodic(2) = .false.

Whether a dimension is periodic

logical, public :: phi_bc_data_stored = .false.

Whether boundary condition data has been stored for mg solution

real(kind=dp), public :: r_min(2)

Minimum coordinates

real(kind=dp), public :: residual_coarse_abs = 1e-8_dp

Stop coarse grid when max. residual is smaller than this

real(kind=dp), public :: residual_coarse_rel = 1e-8_dp

Stop coarse grid when residual has been reduced by this factor

integer, public :: smoother_type = mg_smoother_gs

Type of multigrid smoother

logical, public :: subtract_mean = .false.

Whether the mean has to be subtracted from the multigrid solution

type(mg_timer_t), public :: timers(mg_max_timers)

Values for the timers

logical, public :: tree_created = .false.

Whether the multigrid tree structure has been created


Source Code

  type, public :: mg_t
     !> Whether the multigrid tree structure has been created
     logical                  :: tree_created     = .false.
     !> Whether storage has been allocated for boxes
     logical                  :: is_allocated     = .false.
     !> Number of extra cell-centered variable (e.g., for coefficients)
     integer                  :: n_extra_vars      = 0
     !> MPI communicator
     integer                  :: comm             = -1
     !> Number of MPI tasks
     integer                  :: n_cpu            = -1
     !> MPI rank of this task
     integer                  :: my_rank          = -1
     !> Size of boxes in cells, be equal for all dimensions
     integer                  :: box_size         = -1
     !> Highest grid level in the tree
     integer                  :: highest_lvl      = -1
     !> Lowest grid level in the tree
     integer                  :: lowest_lvl       = -1
     !> First normal level of the quadtree/octree, at coarser levels parents
     !> have only one child
     integer                  :: first_normal_lvl = -1
     !> Total number of boxes in the tree (among all processes)
     integer                  :: n_boxes          = 0
     !> Size of boxes per level (differs for coarsest levels)
     integer                  :: box_size_lvl(mg_lvl_lo:mg_lvl_hi)
     !> Size of domain per level (if uniformly refined)
     integer                  :: domain_size_lvl(2, mg_lvl_lo:mg_lvl_hi)
     !> Grid spacing per level
     real(dp)                 :: dr(2, mg_lvl_lo:mg_lvl_hi)
     !> Minimum coordinates
     real(dp)                 :: r_min(2)
     !> List of all levels
     type(mg_lvl_t)              :: lvls(mg_lvl_lo:mg_lvl_hi)
     !> Array with all boxes in the tree. Only boxes owned by this task are
     !> actually allocated
     type(mg_box_t), allocatable :: boxes(:)
     !> Buffer for communication with each other task
     type(mg_buf_t), allocatable :: buf(:)

     !> Communication info for restriction
     type(mg_comm_t)             :: comm_restrict
     !> Communication info for prolongation
     type(mg_comm_t)             :: comm_prolong
     !> Communication info for ghost cell filling
     type(mg_comm_t)             :: comm_ghostcell

     !> Whether boundary condition data has been stored for mg solution
     logical :: phi_bc_data_stored = .false.

     !> Whether a dimension is periodic
     logical :: periodic(2) = .false.

     !> To store pre-defined boundary conditions per direction per variable
     type(mg_bc_t) :: bc(mg_num_neighbors, mg_max_num_vars)

     !> Type of operator
     integer :: operator_type = mg_laplacian
     !> Type of grid geometry
     integer :: geometry_type = mg_cartesian

     !> Whether the mean has to be subtracted from the multigrid solution
     logical  :: subtract_mean       = .false.
     !> Type of multigrid smoother
     integer  :: smoother_type       = mg_smoother_gs
     !> Number of substeps for the smoother (for GSRB this is 2)
     integer  :: n_smoother_substeps = 1
     !> Number of cycles when doing downwards relaxation
     integer  :: n_cycle_down        = 2
     !> Number of cycles when doing upwards relaxation
     integer  :: n_cycle_up          = 2
     !> Maximum number of cycles on the coarse grid
     integer  :: max_coarse_cycles   = 1000
     integer  :: coarsest_grid(2) = 2
     !> Stop coarse grid when max. residual is smaller than this
     real(dp) :: residual_coarse_abs = 1e-8_dp
     !> Stop coarse grid when residual has been reduced by this factor
     real(dp) :: residual_coarse_rel = 1e-8_dp

     !> Multigrid operator (e.g., Laplacian)
     procedure(mg_box_op), pointer, nopass   :: box_op => null()

     !> Multigrid smoother
     procedure(mg_box_gsrb), pointer, nopass :: box_smoother => null()

     !> Multigrid prolongation method
     procedure(mg_box_prolong), pointer, nopass :: box_prolong => null()

     !> Number of timers
     integer       :: n_timers = 0
     !> Values for the timers
     type(mg_timer_t) :: timers(mg_max_timers)
  end type mg_t