Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
cg_cpld::cg_cpld_t Type Referenceabstract

CPU implementation of the coupled preconditioned conjugate gradient method. More...

Inheritance diagram for cg_cpld::cg_cpld_t:
Collaboration diagram for cg_cpld::cg_cpld_t:

Public Member Functions

procedure, pass(this) init (this, n, max_iter, m, rel_tol, abs_tol, monitor)
 Initialise a coupled CPU PCG solver.
 
procedure, pass(this) free (this)
 Free a coupled CPU PCG solver.
 
procedure, pass(this) solve (this, ax, x, f, n, coef, bc_projector, gs_h, niter)
 Reject scalar solves, which are not supported by this type.
 
procedure, pass(this) solve_coupled (this, ax, x, y, z, fx, fy, fz, n, coef, bc_projector, gs_h, niter)
 Solve a three-component coupled system with the CPU PCG method.
 
procedure(ksp_init_intrf), deferred, pass(this) init (this, n, max_iter, m, rel_tol, abs_tol, monitor)
 Constructor.
 
procedure, pass(this) ksp_init (this, max_iter, rel_tol, abs_tol, m, monitor)
 Base type constructor.
 
procedure, pass(this) ksp_free (this)
 Base type destructor.
 
procedure, pass(this) set_pc (this, m)
 Set preconditioner.
 
procedure(ksp_method), deferred, pass solve (this, ax, x, f, n, coef, bc_projector, gs_h, niter)
 Solve the system.
 
procedure(ksp_method_coupled), deferred, pass solve_coupled (this, ax, x, y, z, fx, fy, fz, n, coef, bc_projector, gs_h, niter)
 Solve the system (coupled version).
 
procedure, pass(this) monitor_start (this, name)
 Monitor start.
 
procedure, pass(this) monitor_stop (this)
 Monitor stop.
 
procedure, pass(this) monitor_iter (this, iter, rnorm)
 Monitor iteration.
 
procedure, pass(this) is_converged (this, iter, residual)
 Check for convergence.
 
procedure(ksp_t_free), deferred, pass free (this)
 Destructor.
 

Public Attributes

real(kind=rp), dimension(:), pointer w1 => null()
 First component of the operator action \(w = A p\).
 
real(kind=rp), dimension(:), pointer w2 => null()
 Second component of the operator action \(w = A p\).
 
real(kind=rp), dimension(:), pointer w3 => null()
 Third component of the operator action \(w = A p\).
 
real(kind=rp), dimension(:), pointer r1 => null()
 First component of the residual \(r = f - A x\).
 
real(kind=rp), dimension(:), pointer r2 => null()
 Second component of the residual \(r = f - A x\).
 
real(kind=rp), dimension(:), pointer r3 => null()
 Third component of the residual \(r = f - A x\).
 
real(kind=rp), dimension(:), pointer p1 => null()
 First component of the search direction \(p\).
 
real(kind=rp), dimension(:), pointer p2 => null()
 Second component of the search direction \(p\).
 
real(kind=rp), dimension(:), pointer p3 => null()
 Third component of the search direction \(p\).
 
real(kind=rp), dimension(:), pointer z1 => null()
 First component of the preconditioned residual \(z = M^{-1}r\).
 
real(kind=rp), dimension(:), pointer z2 => null()
 Second component of the preconditioned residual \(z = M^{-1}r\).
 
real(kind=rp), dimension(:), pointer z3 => null()
 Third component of the preconditioned residual \(z = M^{-1}r\).
 
class(pc_t), pointer m => null()
 Preconditioner.
 
real(kind=rp) rel_tol
 Relative tolerance.
 
real(kind=rp) abs_tol
 Absolute tolerance.
 
integer max_iter
 Maximum number of iterations.
 
class(pc_t), allocatable m_ident
 Internal preconditioner (Identity)
 
logical monitor
 Turn on/off monitoring.
 

Detailed Description

Workspace pointers are associated with host arrays from the scratch registry only for the duration of a solve. The method uses a single Krylov recurrence and combined inner products over all three components.

Definition at line 59 of file cg_coupled.f90.

Member Function/Subroutine Documentation

◆ free() [1/2]

procedure, pass(this) cg_cpld::cg_cpld_t::free ( class(cg_cpld_t), intent(inout)  this)

Definition at line 88 of file cg_coupled.f90.

◆ free() [2/2]

procedure(ksp_t_free), deferred, pass krylov::ksp_t::free ( class(ksp_t), intent(inout)  this)
pure virtualinherited

Definition at line 103 of file krylov.f90.

◆ init() [1/2]

procedure, pass(this) cg_cpld::cg_cpld_t::init ( class(cg_cpld_t), intent(inout), target  this,
integer, intent(in)  n,
integer, intent(in)  max_iter,
class(pc_t), intent(in), optional, target  m,
real(kind=rp), intent(in), optional  rel_tol,
real(kind=rp), intent(in), optional  abs_tol,
logical, intent(in), optional  monitor 
)
Parameters
nNumber of degrees of freedom per component.
max_iterMaximum number of iterations.
MOptional preconditioner. An identity preconditioner is used if absent.
rel_tolOptional relative convergence tolerance.
abs_tolOptional absolute convergence tolerance.
monitorOptional switch for logging the residual at each iteration.

Definition at line 86 of file cg_coupled.f90.

◆ init() [2/2]

procedure(ksp_init_intrf), deferred, pass(this) krylov::ksp_t::init ( class(ksp_t), intent(inout), target  this,
integer, intent(in)  n,
integer, intent(in)  max_iter,
class(pc_t), intent(in), optional, target  m,
real(kind=rp), intent(in), optional  rel_tol,
real(kind=rp), intent(in), optional  abs_tol,
logical, intent(in), optional  monitor 
)
pure virtualinherited

Definition at line 83 of file krylov.f90.

◆ is_converged()

procedure, pass(this) krylov::ksp_t::is_converged ( class(ksp_t), intent(in)  this,
integer, intent(in)  iter,
real(kind=rp), intent(in)  residual 
)
inherited

This function checks if the Krylov solver has converged. The solver is considered converged if the residual is less than the absolute tolerance.

Parameters
residualResidual
iterIteration number

Definition at line 101 of file krylov.f90.

◆ ksp_free()

procedure, pass(this) krylov::ksp_t::ksp_free ( class(ksp_t), intent(inout)  this)
inherited

Definition at line 87 of file krylov.f90.

◆ ksp_init()

procedure, pass(this) krylov::ksp_t::ksp_init ( class(ksp_t), intent(inout), target  this,
integer, intent(in)  max_iter,
real(kind=rp), intent(in), optional  rel_tol,
real(kind=rp), intent(in), optional  abs_tol,
class(pc_t), intent(in), optional, target  m,
logical, intent(in), optional  monitor 
)
inherited
Parameters
max_iterMaximum number of iterations.
rel_tolRelative tolarance for converence.
rel_tolAbsolute tolarance for converence.
MThe preconditioner.

Definition at line 85 of file krylov.f90.

◆ monitor_iter()

procedure, pass(this) krylov::ksp_t::monitor_iter ( class(ksp_t), intent(in)  this,
integer, intent(in)  iter,
real(kind=rp), intent(in)  rnorm 
)
inherited

Definition at line 99 of file krylov.f90.

◆ monitor_start()

procedure, pass(this) krylov::ksp_t::monitor_start ( class(ksp_t), intent(in)  this,
character(len=*)  name 
)
inherited

Definition at line 95 of file krylov.f90.

◆ monitor_stop()

procedure, pass(this) krylov::ksp_t::monitor_stop ( class(ksp_t), intent(in)  this)
inherited

Definition at line 97 of file krylov.f90.

◆ set_pc()

procedure, pass(this) krylov::ksp_t::set_pc ( class(ksp_t), intent(inout)  this,
class(pc_t), intent(in), target  m 
)
inherited
Parameters
MThe preconditioner.

Definition at line 89 of file krylov.f90.

◆ solve() [1/2]

procedure, pass(this) cg_cpld::cg_cpld_t::solve ( class(cg_cpld_t), intent(inout)  this,
class(ax_t), intent(in)  ax,
type(field_t), intent(inout)  x,
real(kind=rp), dimension(n), intent(in)  f,
integer, intent(in)  n,
type(coef_t), intent(inout)  coef,
class(scalar_bc_projector_t), intent(inout)  bc_projector,
type(gs_t), intent(inout)  gs_h,
integer, intent(in), optional  niter 
)
Parameters
AxLinear operator.
xSolution field.
fRight-hand side.
nNumber of degrees of freedom.
coefSpectral element coefficients and multiplicity weights.
bc_projectorProjector for Dirichlet boundary nodes.
gs_hGather-scatter handle used to assemble the operator result.
niterOptional maximum number of iterations.
Returns
Unused convergence information.

Definition at line 90 of file cg_coupled.f90.

◆ solve() [2/2]

procedure(ksp_method), deferred, pass krylov::ksp_t::solve ( class(ksp_t), intent(inout)  this,
class(ax_t), intent(in)  ax,
type(field_t), intent(inout)  x,
real(kind=rp), dimension(n), intent(in)  f,
integer, intent(in)  n,
type(coef_t), intent(inout)  coef,
class(scalar_bc_projector_t), intent(inout)  bc_projector,
type(gs_t), intent(inout)  gs_h,
integer, intent(in), optional  niter 
)
pure virtualinherited

Definition at line 91 of file krylov.f90.

◆ solve_coupled() [1/2]

procedure, pass(this) cg_cpld::cg_cpld_t::solve_coupled ( class(cg_cpld_t), intent(inout)  this,
class(ax_t), intent(in)  ax,
type(field_t), intent(inout)  x,
type(field_t), intent(inout)  y,
type(field_t), intent(inout)  z,
real(kind=rp), dimension(n), intent(in)  fx,
real(kind=rp), dimension(n), intent(in)  fy,
real(kind=rp), dimension(n), intent(in)  fz,
integer, intent(in)  n,
type(coef_t), intent(inout)  coef,
class(vector_bc_projector_t), intent(inout)  bc_projector,
type(gs_t), intent(inout)  gs_h,
integer, intent(in), optional  niter 
)

The initial guesses are discarded. All inner products combine the three components, so the method advances one Krylov recurrence for the complete coupled system.

Parameters
AxCoupled linear operator.
xSolution field for the first component.
ySolution field for the second component.
zSolution field for the third component.
fxRight-hand side for the first component.
fyRight-hand side for the second component.
fzRight-hand side for the third component.
nNumber of degrees of freedom per component.
coefSpectral element coefficients and multiplicity weights.
bc_projectorProjector for vector boundary nodes.
gs_hGather-scatter handle used to assemble operator results.
niterOptional maximum number of iterations, overriding the configured value.
Returns
Identical combined convergence information for all components.

Definition at line 92 of file cg_coupled.f90.

◆ solve_coupled() [2/2]

procedure(ksp_method_coupled), deferred, pass krylov::ksp_t::solve_coupled ( class(ksp_t), intent(inout)  this,
class(ax_t), intent(in)  ax,
type(field_t), intent(inout)  x,
type(field_t), intent(inout)  y,
type(field_t), intent(inout)  z,
real(kind=rp), dimension(n), intent(in)  fx,
real(kind=rp), dimension(n), intent(in)  fy,
real(kind=rp), dimension(n), intent(in)  fz,
integer, intent(in)  n,
type(coef_t), intent(inout)  coef,
class(vector_bc_projector_t), intent(inout)  bc_projector,
type(gs_t), intent(inout)  gs_h,
integer, intent(in), optional  niter 
)
pure virtualinherited

Definition at line 93 of file krylov.f90.

Member Data Documentation

◆ abs_tol

real(kind=rp) krylov::ksp_t::abs_tol
inherited

Definition at line 77 of file krylov.f90.

◆ m

class(pc_t), pointer krylov::ksp_t::m => null()
inherited

Definition at line 75 of file krylov.f90.

◆ m_ident

class(pc_t), allocatable krylov::ksp_t::m_ident
inherited

Definition at line 79 of file krylov.f90.

◆ max_iter

integer krylov::ksp_t::max_iter
inherited

Definition at line 78 of file krylov.f90.

◆ monitor

logical krylov::ksp_t::monitor
inherited

Definition at line 80 of file krylov.f90.

◆ p1

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::p1 => null()

Definition at line 73 of file cg_coupled.f90.

◆ p2

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::p2 => null()

Definition at line 75 of file cg_coupled.f90.

◆ p3

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::p3 => null()

Definition at line 77 of file cg_coupled.f90.

◆ r1

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::r1 => null()

Definition at line 67 of file cg_coupled.f90.

◆ r2

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::r2 => null()

Definition at line 69 of file cg_coupled.f90.

◆ r3

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::r3 => null()

Definition at line 71 of file cg_coupled.f90.

◆ rel_tol

real(kind=rp) krylov::ksp_t::rel_tol
inherited

Definition at line 76 of file krylov.f90.

◆ w1

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::w1 => null()

Definition at line 61 of file cg_coupled.f90.

◆ w2

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::w2 => null()

Definition at line 63 of file cg_coupled.f90.

◆ w3

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::w3 => null()

Definition at line 65 of file cg_coupled.f90.

◆ z1

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::z1 => null()

Definition at line 79 of file cg_coupled.f90.

◆ z2

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::z2 => null()

Definition at line 81 of file cg_coupled.f90.

◆ z3

real(kind=rp), dimension(:), pointer cg_cpld::cg_cpld_t::z3 => null()

Definition at line 83 of file cg_coupled.f90.


The documentation for this type was generated from the following file: