helmholtz_solver_factory_m Module

Parameters and factory routine to create Helmholtz solver Factory routine for 2D Helmholtz solver



Interfaces

public interface helmholtz_solver_factory

  • private subroutine factory_allocatable(multigrid, bnd_type_core, bnd_type_wall, bnd_type_dome, bnd_type_out, co, lambda, xi, par, solver_type, hsolver)

    Factory routine for 2D Helmholtz solver, including type allocation of the hsolver specified by string solver_type

    Arguments

    Type IntentOptional Attributes Name
    type(multigrid_t), intent(inout) :: multigrid

    Multigrid on which to solve the Helmholtz problem (not changed)

    integer, intent(in) :: bnd_type_core

    Boundary descriptor for core boundary

    integer, intent(in) :: bnd_type_wall

    Boundary descriptor for wall boundary

    integer, intent(in) :: bnd_type_dome

    Boundary descriptor for dome boundary

    integer, intent(in) :: bnd_type_out

    Boundary descriptor for outer(mask) boundary

    real(kind=FP), intent(in), dimension(multigrid%get_np(1)) :: co

    Coefficient within Helmholtz operator

    real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: lambda

    Lambda within Helmholtz operator

    real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: xi

    Xi within Helmholtz operator

    type(parameters_helmholtz_solver_factory), intent(in) :: par

    Parameters and selection of Helmholtz solver

    character(len=*), intent(in) :: solver_type

    Desired type of Helmholtz solver (DIRECT, MGMRES)

    class(helmholtz_solver_t), intent(out), allocatable :: hsolver

    Created Helmholtz solver

  • private subroutine factory_direct(multigrid, bnd_type_core, bnd_type_wall, bnd_type_dome, bnd_type_out, co, lambda, xi, par, hsolver)

    Factory routine for 2D Helmholtz solver, type DIRECT. Only the finest mesh of the multigrid will be used.

    Arguments

    Type IntentOptional Attributes Name
    type(multigrid_t), intent(inout) :: multigrid
    integer, intent(in) :: bnd_type_core
    integer, intent(in) :: bnd_type_wall
    integer, intent(in) :: bnd_type_dome
    integer, intent(in) :: bnd_type_out
    real(kind=FP), intent(in), dimension(multigrid%get_np(1)) :: co
    real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: lambda
    real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: xi
    type(parameters_helmholtz_solver_factory), intent(in) :: par
    type(helmholtz_solver_direct_t), intent(inout) :: hsolver
  • private subroutine factory_mgmres(multigrid, bnd_type_core, bnd_type_wall, bnd_type_dome, bnd_type_out, co, lambda, xi, par, hsolver)

    Factory routine for 2D Helmholtz solver, type MGMRES

    Arguments

    Type IntentOptional Attributes Name
    type(multigrid_t), intent(inout) :: multigrid
    integer, intent(in) :: bnd_type_core
    integer, intent(in) :: bnd_type_wall
    integer, intent(in) :: bnd_type_dome
    integer, intent(in) :: bnd_type_out
    real(kind=FP), intent(in), dimension(multigrid%get_np(1)) :: co
    real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: lambda
    real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: xi
    type(parameters_helmholtz_solver_factory), intent(in) :: par
    type(helmholtz_solver_mgmres_cpu_t), intent(inout) :: hsolver
  • private subroutine factory_mgmres_cxx(multigrid, compute_backend_to_use, bnd_type_core, bnd_type_wall, bnd_type_dome, bnd_type_out, co, lambda, xi, par, hsolver, data_backend_to_use)

    Factory routine for 2D Helmholtz solver, type MGMRES

    Arguments

    Type IntentOptional Attributes Name
    type(multigrid_t), intent(inout) :: multigrid
    integer, intent(in) :: compute_backend_to_use
    integer, intent(in) :: bnd_type_core
    integer, intent(in) :: bnd_type_wall
    integer, intent(in) :: bnd_type_dome
    integer, intent(in) :: bnd_type_out
    real(kind=FP), intent(in), dimension(multigrid%get_np(1)) :: co
    real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: lambda
    real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: xi
    type(parameters_helmholtz_solver_factory), intent(in) :: par
    type(helmholtz_solver_mgmres_cxx_t), intent(inout) :: hsolver
    integer, intent(in), optional :: data_backend_to_use
  • public subroutine factory_petsc(multigrid, bnd_type_core, bnd_type_wall, bnd_type_dome, bnd_type_out, co, lambda, xi, par, hsolver, pc_sel)

    Factory routine for 2D Helmholtz solver, type PETSC. Only the finest mesh of the multigrid will be used.

    Arguments

    Type IntentOptional Attributes Name
    type(multigrid_t), intent(inout) :: multigrid
    integer, intent(in) :: bnd_type_core
    integer, intent(in) :: bnd_type_wall
    integer, intent(in) :: bnd_type_dome
    integer, intent(in) :: bnd_type_out
    real(kind=FP), intent(in), dimension(multigrid%get_np(1)) :: co
    real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: lambda
    real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: xi
    type(parameters_helmholtz_solver_factory), intent(in) :: par
    type(helmholtz_solver_petsc_t), intent(inout) :: hsolver
    character(len=*), intent(in) :: pc_sel

    Type of Preconditioner PGMG: Multigrid with operators from parallax-multigrid PCRC: As specified in file petscrc


Derived Types

Parameters for factory routine, with defaults

Components

Type Visibility Attributes Name Initial
character(len=16), public :: dirsolver_type = 'MKL'

Library used for direct solver (MKL, CUSPARSE)

character(len=16), public :: smoother_type = 'GSRB'

Algorithm for smoother within multigrid (JAC, GS, GSRB)

real(kind=FP), public :: rtol = 1.0E-8_FP

Relative tolerance on residuum res := ||Ax - b|| / (||b|| + restol_zero) < rtol

real(kind=FP), public :: restol_zero = FP_EPS

Tolerance for zero of right hand side in residuum computation

integer, public :: gmres_maxiter = 15

Maximum number of GMRES iterations

integer, public :: gmres_nrestart = 15

Number of iterations after which restart of GMRES is done

character(len=1), public :: mgrid_cycletype = 'V'

V or W cycle

integer, public :: mgrid_npresmooth = 5

Number of pre-smoothing steps

integer, public :: mgrid_npostsmooth = 5

Number of post-smoothing steps

integer, public :: dbgout = 0

Debug output level

Type-Bound Procedures

procedure, public :: display => display_parameters_helmholtz_solver_factory

Subroutines

Displays parameters

Arguments

Type IntentOptional Attributes Name
class(parameters_helmholtz_solver_factory) :: self

public subroutine factory_petsc(multigrid, bnd_type_core, bnd_type_wall, bnd_type_dome, bnd_type_out, co, lambda, xi, par, hsolver, pc_sel)

Factory routine for 2D Helmholtz solver, type PETSC. Only the finest mesh of the multigrid will be used.

Arguments

Type IntentOptional Attributes Name
type(multigrid_t), intent(inout) :: multigrid
integer, intent(in) :: bnd_type_core
integer, intent(in) :: bnd_type_wall
integer, intent(in) :: bnd_type_dome
integer, intent(in) :: bnd_type_out
real(kind=FP), intent(in), dimension(multigrid%get_np(1)) :: co
real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: lambda
real(kind=FP), intent(in), dimension(multigrid%get_np_inner(1)) :: xi
type(parameters_helmholtz_solver_factory), intent(in) :: par
type(helmholtz_solver_petsc_t), intent(inout) :: hsolver
character(len=*), intent(in) :: pc_sel

Type of Preconditioner PGMG: Multigrid with operators from parallax-multigrid PCRC: As specified in file petscrc