This is an integrated module for deflation preconditioning
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
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(Gridpara), | intent(inout) | :: | OneGrid |
Type definition for a two-grid system. "f" in variable names stands for fine grid, "c" in variable names stands for coarse grid
| 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 |
| 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 |
Identifier for different deflation methods, ONLY for an input array from the default (finest) grid system A basic deflation method
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | dimension(1-LAP:nx+LAP,1-LAP:ny+LAP) | :: | x |
Restriction of a variable, by full-weight restriction or higher-order restriction depending on the laylers of overlapping grid points used.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
Interpolation of a variable from coarse to fine, by bilinear or higher-order interpolation depending on the laylers of overlapping grid points used.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
A routine that first perform restriction and then interpolation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
A function that performs the Helmholtz operator on the fine grid of the two-grid system, by ReD-O2 method
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | 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
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
Coarse-grid operation for two-level deflation Straight-forward Galerkin coarsening approach
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | 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
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | y(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
A recursive function to invert the coarse-level operators for multilevel delfation methods, by using preconditioned FGMRES
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | y(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
Perform y=Qx in deflation definition, where Q=ZE^(-1)Z^T
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
Perform y=Px in deflation definition, where P=I-AQ
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
Deflation preconditioning, P = (I-AQ)+Q
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
Adapted Deflation Preconditioning, P = M^(-1)(I-AQ)+Q, including higher-order deflation (ADP) if LAP > 1
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
Multilevel deflation preconditioning (MADP) Multigrid-based CSLP on the finest and second level Krylov-based CSLP on the finest and second level
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp) | :: | x(1-LAP:grid%nx+LAP,1-LAP:grid%ny+LAP) | ||||
| type(Gridpara), | intent(inout) | :: | grid |
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
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | x(1-LAP:f2c%nxf+LAP,1-LAP:f2c%nyf+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |
This is a rountine to define the default finest Gridpara from the common grid parameters of the whole project
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(Gridpara), | intent(inout) | :: | finestgrid |
This routine obtains the wavenumber of the coarse level by full-weight restriction from the fine level
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(TwoGrids), | intent(inout) | :: | 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.
| Type | Intent | Optional | 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 |
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)
| Type | Intent | Optional | 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 |
Apply givens rotation of DEF_fullgmres
| Type | Intent | Optional | 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 |
Perform back substitute in of DEF_fullgmres
| Type | Intent | Optional | 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 |
A (CSLP preconditioned) Bi-CGSTAB solver for the coarse-grid problem in two-level deflation method
| Type | Intent | Optional | 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 |
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.
| Type | Intent | Optional | 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 |
A coarse-grid Helmholtz operator for two-level deflation, descretized by a classic compact fourth-order FD scheme
| Type | Intent | Optional | 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 |
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
| Type | Intent | Optional | 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 |
ReD-Glk computational stencils of the Helmholtz operator for coarse-grid level in two-deflation method
| Type | Intent | Optional | 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 |
Extrapolate a layer of ghost grid points based on the boundary conditions The zero padding of wavenumber is ok in practical
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=realdp), | intent(inout) | :: | v_in(1-LAP:f2c%nxc+LAP,1-LAP:f2c%nyc+LAP) | |||
| type(TwoGrids), | intent(inout) | :: | f2c |