deflaion_setup Module

This is an integrated module for deflation preconditioning


Uses

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

Used by

  • module~~deflaion_setup~~UsedByGraph module~deflaion_setup deflaion_setup module~solvers solvers module~solvers->module~deflaion_setup module~user_module user_module 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

Interfaces

public interface TwoGrids

  • public function FromFine2Coarse(OneGrid)

    A procedure to create a two-grid system from a given fine Gridpara type The wavenumber of the coarse level is restricted from the fine level

    Arguments

    Type IntentOptional Attributes Name
    type(Gridpara), intent(inout) :: OneGrid

    Return Value type(TwoGrids)


Derived Types

type, public ::  TwoGrids

Type definition for a two-grid system. "f" in variable names stands for fine grid, "c" in variable names stands for coarse grid

Components

Type Visibility Attributes Name Initial
integer(kind=4), public :: nxf_global
integer(kind=4), public :: nyf_global
integer(kind=4), public :: nxf
integer(kind=4), public :: nyf
integer(kind=4), public :: nxc_global
integer(kind=4), public :: nyc_global
integer(kind=4), public :: nxc
integer(kind=4), public :: nyc
real(kind=realdp), public :: hxf
real(kind=realdp), public :: hyf
real(kind=realdp), public :: hxhyf
real(kind=realdp), public :: hxc
real(kind=realdp), public :: hyc
real(kind=realdp), public :: hxhyc
integer, public, dimension(0:npMax - 1) :: if_offset
integer, public, dimension(0:npMax - 1) :: jf_offset
integer, public, dimension(0:npMax - 1) :: if_nn
integer, public, dimension(0:npMax - 1) :: jf_nn
integer, public, dimension(0:npMax - 1) :: ic_offset
integer, public, dimension(0:npMax - 1) :: jc_offset
integer, public, dimension(0:npMax - 1) :: ic_nn
integer, public, dimension(0:npMax - 1) :: jc_nn
real(kind=realdp), public, allocatable, dimension(:,:) :: kxy_f
real(kind=realdp), public, allocatable, dimension(:,:) :: kxy_c
real(kind=realdp), public, allocatable, dimension(:,:) :: kh2_f
real(kind=realdp), public, allocatable, dimension(:,:) :: kh2_c

Constructor

public function FromFine2Coarse (OneGrid)

A procedure to create a two-grid system from a given fine Gridpara type The wavenumber of the coarse level is restricted from the fine level


Functions

public function DEF_Px(x)

Identifier for different deflation methods, ONLY for an input array from the default (finest) grid system A basic deflation method

Read more…

Arguments

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

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

public function FromFine2Coarse(OneGrid)

A procedure to create a two-grid system from a given fine Gridpara type The wavenumber of the coarse level is restricted from the fine level

Arguments

Type IntentOptional Attributes Name
type(Gridpara), intent(inout) :: OneGrid

Return Value type(TwoGrids)

public function CoarseGridpara(f2c)

A procedure to create a Gridpara type of the coarse grid system from a given a two-grid system

Arguments

Type IntentOptional Attributes Name
type(TwoGrids), intent(inout) :: f2c

Return Value type(Gridpara)

public function ZTx(x, f2c)

Restriction of a variable, by full-weight restriction or higher-order restriction depending on the laylers of overlapping grid points used.

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)

public function Zx(x, f2c)

Interpolation of a variable from coarse to fine, by bilinear or higher-order interpolation depending on the laylers of overlapping grid points used.

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)

public function ZTZx(x, f2c)

A routine that first perform restriction and then interpolation

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)

public function Helm_Ahx(x, f2c)

A function that performs the Helmholtz operator on the fine grid of the two-grid system, by ReD-O2 method

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)

public function Helm_A2hx(x, f2c)

A function that performs the Helmholtz operator on the coarse grid of the two-grid system, by different methods ReD-O2 ReD-Glk ReD-cmpO4

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)

public function Ex(x, f2c)

Coarse-grid operation for two-level deflation Straight-forward Galerkin coarsening approach

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)

public function invEy(y, f2c)

Invert the coarse-grid operator for two-level delfation method, by using GMRES or Bi-CGSTAB determined by the specified maximum number of iterations on the coarse grid

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: y(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)

public recursive function MultiLevel_invEy(y, f2c)

A recursive function to invert the coarse-level operators for multilevel delfation methods, by using preconditioned FGMRES

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: y(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)

public function Qx(x, f2c)

Perform y=Qx in deflation definition, where Q=ZE^(-1)Z^T

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)

public function Px(x, f2c)

Perform y=Px in deflation definition, where P=I-AQ

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)

public function P_DEFx(x, f2c)

Deflation preconditioning, P = (I-AQ)+Q

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)

public function P_ADEF1x(x, f2c)

Adapted Deflation Preconditioning, P = M^(-1)(I-AQ)+Q, including higher-order deflation (ADP) if LAP > 1

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)

public recursive function MultiLevelADP_Px(x, grid)

Multilevel deflation preconditioning (MADP) Multigrid-based CSLP on the finest and second level Krylov-based CSLP on the finest and second level

Arguments

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

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

public function P_TLKMx(x, f2c)

Two-Level Krylov Method, P = [(I-M^(-1)AQ)+Q]M^(-1), where Q' is defined based on M^(-1)A M^(-1)x QM^(-1)x

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)
type(TwoGrids), intent(inout) :: f2c

Return Value complex(kind=realdp), (1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP)


Subroutines

public subroutine default_gridpara(finestgrid)

This is a rountine to define the default finest Gridpara from the common grid parameters of the whole project

Arguments

Type IntentOptional Attributes Name
type(Gridpara), intent(inout) :: finestgrid

public subroutine wavenumber_FWrestriction(f2c)

This routine obtains the wavenumber of the coarse level by full-weight restriction from the fine level

Arguments

Type IntentOptional Attributes Name
type(TwoGrids), intent(inout) :: f2c

public subroutine DEF_fullgmres(y, x, f2c)

A (CSLP preconditioned) GMRES solver for the coarse-grid problem in two-level deflation method Be careful!!, after the whole iteration without achieving eps, then the value of j will be "def_mg_miter+1".So we need a k.

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: y(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c

public subroutine def_arnoldi(V, H, k, f2c, CurrentGrid)

Arnoldi prosess of DEF_fullgmres Attention: h_(i,j)=(w,v_i)=v^H*w, for complex value, so the code should be dot_product(v_i,w)

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout), dimension(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP,def_mg_miter+1) :: V
complex(kind=realdp), intent(inout), dimension(def_mg_miter+1,def_mg_miter) :: H
integer, intent(in) :: k
type(TwoGrids), intent(inout) :: f2c
type(Gridpara) :: CurrentGrid

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

Apply givens rotation of DEF_fullgmres

Arguments

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

public subroutine def_back_substitute(H, beta, k)

Perform back substitute in of DEF_fullgmres

Arguments

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

public subroutine DEF_bicgstab(y, x, f2c)

A (CSLP preconditioned) Bi-CGSTAB solver for the coarse-grid problem in two-level deflation method

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: y(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c

public recursive subroutine DEF_prefgmres(y, x, f2c, maximum_iterations, level, rtol)

A recursive flexible GMRES with right deflation preconditioning Be careful!!, after the whole iteration without achieving eps, then the value of j will be "maxit+1".So we need a k.

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: y(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
complex(kind=realdp), intent(inout) :: x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c
integer, intent(in), optional :: maximum_iterations
integer, intent(in), optional :: level
real(kind=realdp), intent(in), optional :: rtol

public subroutine Helmholtz2d_O4cmpct(v_in, v_out, f2c)

A coarse-grid Helmholtz operator for two-level deflation, descretized by a classic compact fourth-order FD scheme

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: v_in(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
complex(kind=realdp), intent(inout) :: v_out(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c

public subroutine Helmholtz2d_ReD_Glk(v_in, v_out, f2c)

A coarse-grid Helmholtz operator for two-level deflation, descretized by ReD-GLK FD scheme fill in a layer of ghost grid points by boundary conditions

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: v_in(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
complex(kind=realdp), intent(inout) :: v_out(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c

public subroutine ReD_Glk_stencils(a, b, f2c, ic, jc)

ReD-Glk computational stencils of the Helmholtz operator for coarse-grid level in two-deflation method

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp) :: a(-2:2,-2:2)

a: Laplace operator

complex(kind=realdp) :: b(-2:2,-2:2)

b: wavenumber operator

type(TwoGrids), intent(inout) :: f2c
integer :: ic
integer :: jc

public subroutine ExtrpltGhostBCs(v_in, f2c)

Extrapolate a layer of ghost grid points based on the boundary conditions The zero padding of wavenumber is ok in practical

Arguments

Type IntentOptional Attributes Name
complex(kind=realdp), intent(inout) :: v_in(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP)
type(TwoGrids), intent(inout) :: f2c