Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
krylov Module Reference

Implements the base abstract type for Krylov solvers plus helper types.

Data Types

interface  ksp_method
 Abstract interface for a Krylov method's solve routine. More...
 
interface  ksp_method_coupled
 Abstract interface for a Krylov method's coupled solve routine. More...
 
type  ksp_monitor_t
 Type for storing initial and final residuals in a Krylov solver. More...
 
type  ksp_t
 Base abstract type for a canonical Krylov method, solving \( Ax = f \). More...
 
interface  ksp_t_free
 Abstract interface for deallocating a Krylov method. More...
 

Functions/Subroutines

subroutine krylov_init (this, max_iter, rel_tol, abs_tol, m, monitor)
 Factory for Krylov solvers. Both creates and initializes the object.
 
subroutine krylov_free (this)
 Deallocate a Krylov solver.
 
subroutine krylov_set_pc (this, m)
 Setup a Krylov solver's preconditioner.
 
subroutine krylov_monitor_start (this, name)
 Monitor start.
 
subroutine krylov_monitor_stop (this)
 Monitor stop.
 
subroutine krylov_monitor_iter (this, iter, rnorm)
 Monitor iteration.
 
pure logical function krylov_is_converged (this, iter, residual)
 Check for convergence.
 

Variables

integer, parameter, public ksp_max_iter = 1e3
 Maximum number of iters.
 
real(kind=rp), parameter, public ksp_abs_tol = 1d-9
 Absolut tolerance.
 
real(kind=rp), parameter, public ksp_rel_tol = 1d-9
 Relative tolerance.
 

Function/Subroutine Documentation

◆ krylov_free()

subroutine krylov::krylov_free ( class(ksp_t), intent(inout this)
private
Todo:
add calls to destroy precon. if necessary

Definition at line 265 of file krylov.f90.

◆ krylov_init()

subroutine krylov::krylov_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 
)
private
Parameters
objectThe object to be allocated.
nSize of the vectors the solver operates on.
type_nameThe name of the solver type.
max_iterThe maximum number of iterations
abstolThe absolute tolerance, optional.
MThe preconditioner, optional.
monitorEnable/disable monitoring, optional. Destroy an iterative Krylov type_name Constructor for the base type.
max_iterMaximum number of iterations.
rel_tolRelative tolarance for converence.
rel_tolAbsolute tolarance for converence.
MThe preconditioner.

Definition at line 219 of file krylov.f90.

◆ krylov_is_converged()

pure logical function krylov::krylov_is_converged ( class(ksp_t), intent(in this,
integer, intent(in iter,
real(kind=rp), intent(in residual 
)
private

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 343 of file krylov.f90.

◆ krylov_monitor_iter()

subroutine krylov::krylov_monitor_iter ( class(ksp_t), intent(in this,
integer, intent(in iter,
real(kind=rp), intent(in rnorm 
)
private

Definition at line 322 of file krylov.f90.

◆ krylov_monitor_start()

subroutine krylov::krylov_monitor_start ( class(ksp_t), intent(in this,
character(len=*)  name 
)
private

Definition at line 292 of file krylov.f90.

◆ krylov_monitor_stop()

subroutine krylov::krylov_monitor_stop ( class(ksp_t), intent(in this)
private

Definition at line 310 of file krylov.f90.

◆ krylov_set_pc()

subroutine krylov::krylov_set_pc ( class(ksp_t), intent(inout this,
class(pc_t), intent(in), target  m 
)
private
Parameters
MThe preconditioner.

Definition at line 274 of file krylov.f90.

Variable Documentation

◆ ksp_abs_tol

real(kind=rp), parameter, public krylov::ksp_abs_tol = 1d-9

Definition at line 52 of file krylov.f90.

◆ ksp_max_iter

integer, parameter, public krylov::ksp_max_iter = 1e3

Definition at line 51 of file krylov.f90.

◆ ksp_rel_tol

real(kind=rp), parameter, public krylov::ksp_rel_tol = 1d-9

Definition at line 53 of file krylov.f90.