CSLP_Solver Module

This is a module to solve the inverse of CSLP approximately By multigrid methods or Krylov iterations


Uses

  • module~~cslp_solver~~UsesGraph module~cslp_solver CSLP_Solver module~comm_variable comm_variable 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 mpi mpi module~cslp_solver->mpi module~comm_variable->mpi module~mpi_setup->module~comm_variable module~mpi_setup->mpi module~operators->module~comm_variable module~operators->module~mpi_setup module~operators->module~wavenumber module~operators->mpi module~define_bc define_BC module~operators->module~define_bc module~smoother->module~comm_variable module~smoother->module~mpi_setup module~smoother->module~operators module~smoother->module~define_bc module~wavenumber->module~comm_variable module~wavenumber->module~mpi_setup module~wavenumber->mpi module~define_bc->module~comm_variable module~define_bc->module~wavenumber

Used by

  • module~~cslp_solver~~UsedByGraph module~cslp_solver CSLP_Solver module~deflaion_setup deflaion_setup module~deflaion_setup->module~cslp_solver module~solvers solvers module~solvers->module~cslp_solver module~solvers->module~deflaion_setup module~user_module user_module module~user_module->module~cslp_solver module~user_module->module~deflaion_setup module~idrs_module idrs_module module~idrs_module->module~user_module program~helmholtz_2d helmholtz_2d program~helmholtz_2d->module~solvers program~helmholtz_2d->module~user_module program~helmholtz_2d->module~idrs_module

Derived Types

type, public ::  GridSystem

A data type that collect some info of a (coarse) grid system It is different the type Gridpara, which does not consist any variable like u, rhs, res, and etc.

Components

Type Visibility Attributes Name Initial
integer(kind=4), public :: nxc_global

Global grid size, in x and y directions respectively.

integer(kind=4), public :: nyc_global

Global grid size, in x and y directions respectively.

integer(kind=4), public :: nxc

Local grid size of a subdomain, in x and y directions respectively.

integer(kind=4), public :: nyc

Local grid size of a subdomain, in x and y directions respectively.

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

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

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

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

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

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

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

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

real(kind=realdp), public :: hxc

space step, hxhyc==hx*hy==hx^2

real(kind=realdp), public :: hyc

space step, hxhyc==hx*hy==hx^2

real(kind=realdp), public :: hxhyc

space step, hxhyc==hx*hy==hx^2

complex(kind=realdp), public, allocatable, dimension(:,:) :: u_c

Solution variable in subdomain

complex(kind=realdp), public, allocatable, dimension(:,:) :: rhs_c

RHS variable in subdomain

complex(kind=realdp), public, allocatable, dimension(:,:) :: res_c

Residual variable in subdomain

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

wavenumber in subdomain

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

wavenumber in subdomain


Functions

public function MGCSLP_invMx(b_in)

Multigrid-Based CSLP, ONLY starts from the default (finest) grid sysyem One V-cycle Two V-cycle One F-cycle

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), dimension(1-LAP:nx+LAP,1-LAP:ny+LAP) :: b_in

Return Value complex(kind=realdp), (1-LAP:nx+LAP,1-LAP:ny+LAP)

MGCSLP_invMx = M_h^(-1)(b_h)

public function MGCSLP_invMHx(b_in, grid)

Multigrid-based CSLP, starts from the a specified grid system One V-cycle Two V-cycle One F-cycle

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), dimension(1-LAP:grid%nx+LAP,1-LAP:grid%ny+LAP) :: b_in
type(Gridpara) :: grid

A data type that collect some parameters of a system

Return Value complex(kind=realdp), dimension(1-LAP:grid%nx+LAP,1-LAP:grid%ny+LAP)

MGCSLP_invMHx = M_H^(-1)(b_H)

public function KrylovCSLP_invMHx(b_in, grid)

Krylov-based CSLP, starts from the a specified grid sysyem Choose Bi-CGSATB or GMRES by uncomment or comment

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), dimension(1-LAP:grid%nx+LAP,1-LAP:grid%ny+LAP) :: b_in
type(Gridpara) :: grid

A data type that collect some parameters of a system

Return Value complex(kind=realdp), dimension(1-LAP:grid%nx+LAP,1-LAP:grid%ny+LAP)


Subroutines

public subroutine finestgrid_define(mg_finest)

This is a routine that define the finest grid system from the default (finest) grid parameters

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_finest

public subroutine gridsys_define(grid, basegridsys)

This is a routine that define a GridSystem type from the grid parameters of a data type Gridpara One can find the differnece of GridSystem and Gridpara

Arguments

Type IntentOptional Attributes Name
type(Gridpara) :: grid
type(GridSystem) :: basegridsys

public subroutine coarsegrid_create(mg_coarse, mg_fine)

This is a routine that define a coarse grid system mg_coarse from a fine grid system mg_fine

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_coarse
type(GridSystem), intent(inout) :: mg_fine

public subroutine grid_destroy(mg_dm)

This is a routine that deallocate the arrays of a grid system

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_dm

public subroutine restriction(mg_coarse, mg_fine)

This is routine that perform full-weight resctriction from fine to coarse grid system, mainly residual (res) on fine grid --> right-hand side (rhs) on coarse grid, wavenumber on fine grid --> wavenumber on the coarse grid Based on the relationship of the index between the fine and coarse grid

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_coarse
type(GridSystem), intent(inout) :: mg_fine

public subroutine prolongation_en_correct(mg_coarse, mg_fine)

This is routine that perform bilinear interpolation and correction from coarse to fine grid system, mainly solution (u) on coarse grid --> correction (e_h) for solution (u) of fine grid Based on the relationship of the index between the fine and coarse grid

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_coarse
type(GridSystem), intent(inout) :: mg_fine

public recursive subroutine V_cycle(mg_fine)

A classic multigrid V-cycle A classic Two-Cycle GMRES or Bi-CGSTAB can be chose to solve the coarse-grid problem GMRES or Bi-CGSTAB can be chose to solve the coarsest-grid problem

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_fine

public recursive subroutine F_cycle(mg_fine)

This is a classic F-cycle multigrid

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_fine

public subroutine mg_fullgmres(mg_solve)

This is a rountine to solve the (specified) coarsest-grid CSLP system approximately by using GMRES The CSLP is define by ReD-O2 scheme Be careful!!, after the whole iteration without achieving eps, then the value of j will be "m_iter+1".So we need a k. The default tolerance is 1E-08

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_solve

The current coarsest grid system

public subroutine mg_arnoldi(V, H, k, ni, nj, hx_c, hy_c, kxy, kh2)

Arnoldi precess w=A*v_i

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout), dimension(1-LAP:ni+LAP,1-LAP:nj+LAP,cslp_mg_miter+1) :: V
complex(kind=realdp), intent(inout), dimension(cslp_mg_miter+1,cslp_mg_miter) :: H
integer, intent(in) :: k
integer, intent(in) :: ni
integer, intent(in) :: nj
real(kind=realdp), intent(in) :: hx_c
real(kind=realdp), intent(in) :: hy_c
real(kind=realdp), intent(in), dimension(1-LAP:ni+LAP,1-LAP:nj+LAP) :: kxy
real(kind=realdp), intent(in), dimension(1-LAP:ni+LAP,1-LAP:nj+LAP) :: kh2

public subroutine mg_apply_givens_rotation(H, cs, sn, k)

This is routine to perform apply_givens_rotation

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout), dimension(cslp_mg_miter+1,cslp_mg_miter) :: H
complex(kind=realdp), intent(inout), dimension(cslp_mg_miter+1) :: cs
complex(kind=realdp), intent(inout), dimension(cslp_mg_miter+1) :: sn
integer, intent(in) :: k

public subroutine mg_back_substitute(H, beta, k)

This is routine that performs back substitute

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(in), dimension(cslp_mg_miter+1,cslp_mg_miter) :: H
complex(kind=realdp), intent(inout), dimension(cslp_mg_miter+1) :: beta
integer, intent(in) :: k

public subroutine mg_bicgstab(mg_solve, maximum_iterations)

This is a rountine to solve the (specified) coarsest-grid CSLP system approximately by using Bi-CGSTAB The CSLP is define by ReD-O2 scheme

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_solve
integer, intent(in), optional :: maximum_iterations

User-specified maximum number of iterations

public subroutine ReD_Glk_CSLP_bicgstab(mg_solve, grid, maximum_iterations)

This is a rountine to solve a coarse grid CSLP system approximately by using Bi-CGSTAB. The CSLP operator is defined by ReD-Glk scheme. CSLP operator by ReD-Glk

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_solve

The current coarse grid system

type(Gridpara) :: grid

Parameters of current coarse grid

integer, intent(in), optional :: maximum_iterations

public subroutine ReD_Glk_CSLP_gmres(mg_solve, grid, maximum_iterations)

This is a rountine to solve a coarse grid CSLP system approximately by using GMRES The CSLP operator is defined by ReD-Glk scheme CSLP operator by ReD-Glk

Read more…

Arguments

Type IntentOptional Attributes Name
type(GridSystem), intent(inout) :: mg_solve
type(Gridpara) :: grid
integer, intent(in), optional :: maximum_iterations

User-specified maximum number of iterations,default is 300