comm_variable Module

This is a module that define some common variables for the whole project


Uses

  • module~~comm_variable~~UsesGraph module~comm_variable comm_variable mpi mpi module~comm_variable->mpi

Used by

  • module~~comm_variable~~UsedByGraph module~comm_variable comm_variable module~analytical_sol analytical_sol module~analytical_sol->module~comm_variable module~cslp_solver CSLP_Solver module~cslp_solver->module~comm_variable module~mpi_setup mpi_setup module~cslp_solver->module~mpi_setup module~operators operators module~cslp_solver->module~operators module~smoother smoother module~cslp_solver->module~smoother module~wavenumber wavenumber module~cslp_solver->module~wavenumber module~define_bc define_BC module~define_bc->module~comm_variable module~define_bc->module~wavenumber module~define_grid define_grid module~define_grid->module~comm_variable module~define_rhs define_rhs module~define_rhs->module~comm_variable module~deflaion_setup deflaion_setup module~deflaion_setup->module~comm_variable module~deflaion_setup->module~cslp_solver module~deflaion_setup->module~mpi_setup module~deflaion_setup->module~operators module~deflaion_setup->module~wavenumber module~idrs_module idrs_module module~idrs_module->module~comm_variable module~idrs_module->module~mpi_setup module~read_setup read_setup module~idrs_module->module~read_setup module~user_module user_module module~idrs_module->module~user_module module~mpi_setup->module~comm_variable module~operators->module~comm_variable module~operators->module~define_bc module~operators->module~mpi_setup module~operators->module~wavenumber module~read_setup->module~comm_variable module~smoother->module~comm_variable module~smoother->module~define_bc module~smoother->module~mpi_setup module~smoother->module~operators module~solvers solvers module~solvers->module~comm_variable module~solvers->module~cslp_solver module~solvers->module~deflaion_setup module~solvers->module~operators module~solvers->module~read_setup module~user_module->module~comm_variable module~user_module->module~cslp_solver module~user_module->module~deflaion_setup module~user_module->module~operators module~wavenumber->module~comm_variable module~wavenumber->module~mpi_setup module~write_data write_data module~write_data->module~comm_variable program~helmholtz_2d helmholtz_2d program~helmholtz_2d->module~comm_variable program~helmholtz_2d->module~analytical_sol program~helmholtz_2d->module~define_grid program~helmholtz_2d->module~define_rhs program~helmholtz_2d->module~idrs_module program~helmholtz_2d->module~mpi_setup program~helmholtz_2d->module~read_setup program~helmholtz_2d->module~solvers program~helmholtz_2d->module~user_module program~helmholtz_2d->module~wavenumber program~helmholtz_2d->module~write_data

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: realdp = 8

precision for the whole program

real(kind=realdp), public, parameter :: pi = 3.141592653589793238d0
real(kind=realdp), public, parameter :: e = 2.7182818285d0
integer, public, parameter :: npMax = 400

the maximun number of partitions in one dimension

complex(kind=realdp), public, parameter :: cone = (0.d0, 1.d0)
complex(kind=realdp), public, parameter :: czero = (0.d0, 0.d0)

Constants for complex numbers

character(len=100), public :: filename
character(len=100), public :: output_name
character(len=100), public :: logname

Strings for file names

real(kind=realdp), public :: eps

eps: tolerance for the outer iterations

real(kind=realdp), public :: def_rtol

def_rtol: tolerance for the coarse-grid solver in two-level deflation method

real(kind=realdp), public :: cslp_mg_tol

cslp_mg_tol: tolerance for Krylov based CSLP solver on coarse-grid levels

integer, public :: m_iter

m_iter: maximum number of outer iterations

integer, public :: Algorithm

Algorithm: solver identifier

integer, public :: Irestart

Irestart: Restart GMRES (1) or full GMRES (0)

integer, public :: M_flag

M_flag: Flag for preconditioner type

integer, public :: M2h_flag

M2h_flag: In two-level deflation method, flag for using CSLP for the coarse level (1) or not (0)

integer, public :: A2h_flag

A2h_flag: In two-level deflation method, flag for the ReD method used for the coarse level operator

integer, public :: def_mg_miter

def_mg_miter: maximum number of iterations for deflation on the coarse levels

integer, public :: cslp_mg_miter

cslp_mg_miter: maximum number of iterations for solving CSLP by multigrid method on the coarsest level

integer, public :: MG_flag

MG_flag: flag for the type of multigrid method

integer, public :: nx_min

nx_min: minimum number of grid points in x-direction for the coarsest grid, it is used to specified the grid size of the coarsest grid when coarsening

integer, public :: def_nlevel

def_nlevel: Number of levels in multilevel deflation method

integer, public :: indf_level

indf_level: The level that the linear system becomes indefinite

integer, public :: Sv_L2

Sv_L2: In multilevel method, a single-digit number that sets the tolerance for the second coarse grid iterations, ex. 1 means 1E-1

integer, public :: Sv_L3

Sv_L3: In multilevel method, a single-digit number that sets the tolerance for the third coarse grid iterations, ex. 3 means 3E-1

integer, public :: Sv_L4

Sv_L4: In multilevel method, a single-digit number that sets the tolerance for the fourth coarse grid iterations, ex. 10 means one iteration

integer, public :: npx0

npx0: Number of partitions in x-direction

integer, public :: npy0

npy0: Number of partitions in y-direction

integer, public :: npx

npx: The coordinate/order of the current partition in x-direction

integer, public :: npy

npy: The coordinate/order of the current partition in y-direction

integer, public :: nx_global

nx_global: Global number of grid points in x-direction

integer, public :: ny_global

ny_global: Global number of grid points in y-direction

integer, public :: nx

nx: Local number of grid points of the current subdomain in x-direction

integer, public :: ny

ny: Local number of grid points of the current subdomain in y-direction

integer, public :: ID_XM1

ID_XM1: Identifier for neighboring partition in the -x direction

integer, public :: ID_XP1

ID_XP1: Identifier for neighboring partition in the +x direction

integer, public :: ID_YM1

ID_YM1: Identifier for neighboring partition in the -y direction

integer, public :: ID_YP1

ID_YP1: Identifier for neighboring partition in the +y direction

integer, public :: Iperiodic_X

Iperiodic_X: Periodicity flag in x-direction

integer, public :: Iperiodic_Y

Iperiodic_Y: Periodicity flag in y-direction

real(kind=realdp), public :: slx

slx: Physical length of the computational domain in x direction

real(kind=realdp), public :: sly

sly: Physical length of the computational domain in y direction

real(kind=realdp), public :: hx

hx: Grid spacing in x-direction

real(kind=realdp), public :: hy

hy: Grid spacing in y-direction

real(kind=realdp), public :: hxhy

hxhy: Product of grid spacings hx * hy, for this project hx must equal to hy, so hxhy=h^2

integer, public, dimension(0:npMax - 1) :: i_offset

i_offset: an array that contains the index offset for MPI ranks in x direction

integer, public, dimension(0:npMax - 1) :: j_offset

j_offset: an array that contains the index offset for MPI ranks in y direction

integer, public, dimension(0:npMax - 1) :: i_nn

i_nn: an array that contains the number of grid points for MPI ranks in x direction

integer, public, dimension(0:npMax - 1) :: j_nn

j_nn: an array that contains the number of grid points for MPI ranks in y direction

integer, public :: LAP

The number of overlapping layers. The higher order deflation will be turned on once LAP > 1

integer, public :: i_case

Case identifier

real(kind=realdp), public :: freq

freq: the frequency for Helmholtz problem

real(kind=realdp), public :: k0

k0: the wavenumber for constant-wavenumber model problem

real(kind=realdp), public :: beta1

beta1: the real term for CSLP, usually 1.d0

real(kind=realdp), public :: beta2

beta2: the complex shift for CSLP

integer, public :: k_case

k_case: Case identifier for constant (0) or non-constant (1) wavenumber

integer, public :: flag_BCs

flag_BCs: Boundary conditions flag

integer, public :: ierr

ierr: MPI error code

integer, public :: np_size

np_size: the total number of MPI processes

integer, public :: my_id

my_id: MPI rank ID

integer, public :: STATUS(MPI_STATUS_SIZE)

MPI status array

integer, public :: request1

MPI status array

integer, public :: request2

MPI status array


Derived Types

type, public ::  Gridpara

Type definition for grid parameters

Components

Type Visibility Attributes Name Initial
integer(kind=4), public :: nx_global
integer(kind=4), public :: ny_global
integer(kind=4), public :: nx
integer(kind=4), public :: ny
real(kind=realdp), public :: hx
real(kind=realdp), public :: hy
real(kind=realdp), public :: hxhy
integer, public, dimension(0:npMax - 1) :: i_offset
integer, public, dimension(0:npMax - 1) :: j_offset
integer, public, dimension(0:npMax - 1) :: i_nn
integer, public, dimension(0:npMax - 1) :: j_nn
real(kind=realdp), public, allocatable, dimension(:,:) :: wavenumber_k

wavenumber_k: the wavenumber profile of the domain

real(kind=realdp), public, allocatable, dimension(:,:) :: wavenumber_kh_pow_2

wavenumber_kh_pow_2 = (kh)^2