Neko 1.99.7
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  krylov_allocate
 Factory for Krylov solvers. Both creates and initializes the object. More...
 
type  krylov_allocator_entry
 Called in user modules to add an allocator for custom types. More...
 
interface  ksp_init_intrf
 Abstract interface for a Krylov method's constructor. More...
 
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)
 Constructor for the base type.
 
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.
 
subroutine krylov_monitor_print_header (this)
 Print the Krylov solver's result header.
 
subroutine krylov_monitor_print_result (this, step)
 Print the Krylov solver's result.
 

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.
 
type(krylov_allocator_entry), dimension(:), allocatable krylov_registry
 Registry of allocators for user-defined Krylov solver types.
 
integer krylov_registry_size = 0
 The size of the krylov_registry.
 

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 333 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
max_iterMaximum number of iterations.
rel_tolRelative tolarance for converence.
rel_tolAbsolute tolarance for converence.
MThe preconditioner.

Definition at line 287 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 411 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 390 of file krylov.f90.

◆ krylov_monitor_print_header()

subroutine krylov::krylov_monitor_print_header ( class(ksp_monitor_t), intent(in this)
private

Definition at line 424 of file krylov.f90.

◆ krylov_monitor_print_result()

subroutine krylov::krylov_monitor_print_result ( class(ksp_monitor_t), intent(in this,
integer, intent(in step 
)
private

Definition at line 436 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 360 of file krylov.f90.

◆ krylov_monitor_stop()

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

Definition at line 378 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 342 of file krylov.f90.

Variable Documentation

◆ krylov_registry

type(krylov_allocator_entry), dimension(:), allocatable krylov::krylov_registry

Definition at line 273 of file krylov.f90.

◆ krylov_registry_size

integer krylov::krylov_registry_size = 0
private

Definition at line 276 of file krylov.f90.

◆ 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.