Implements the base abstract type for Krylov solvers plus helper types.
|
| subroutine | krylov_init (this, max_iter, rel_tol, abs_tol, m, monitor) |
| | Constructor for the base type.
|
| subroutine | krylov_init_from_json (this, n, json, m) |
| | Constructor from a JSON solver block. Reads max_iterations (default KSP_MAX_ITER), absolute_tolerance and monitor (default false) and calls the type's init. Types with keys of their own override this, read them and then call ksp_init_from_json.
|
| 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.
|
◆ krylov_free()
| subroutine krylov::krylov_free |
( |
class(ksp_t), intent(inout) | this | ) |
|
|
private |
- Todo
- add calls to destroy precon. if necessary
Definition at line 379 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_iter | Maximum number of iterations. |
| rel_tol | Relative tolarance for converence. |
| rel_tol | Absolute tolarance for converence. |
| M | The preconditioner. |
Definition at line 308 of file krylov.f90.
◆ krylov_init_from_json()
| subroutine krylov::krylov_init_from_json |
( |
class(ksp_t), intent(inout), target | this, |
|
|
integer, intent(in) | n, |
|
|
type(json_file), intent(inout) | json, |
|
|
class(pc_t), intent(in), optional, target | m ) |
|
private |
- Parameters
-
| n | Size of work arrays. |
| json | The solver block. |
| M | The preconditioner (optional). |
Definition at line 360 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
-
| residual | Residual |
| iter | Iteration number |
Definition at line 457 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 |
◆ krylov_monitor_print_header()
| subroutine krylov::krylov_monitor_print_header |
( |
class(ksp_monitor_t), intent(in) | this | ) |
|
|
private |
◆ krylov_monitor_print_result()
| subroutine krylov::krylov_monitor_print_result |
( |
class(ksp_monitor_t), intent(in) | this, |
|
|
integer, intent(in) | step ) |
|
private |
◆ krylov_monitor_start()
| subroutine krylov::krylov_monitor_start |
( |
class(ksp_t), intent(in) | this, |
|
|
character(len=*) | name ) |
|
private |
◆ krylov_monitor_stop()
| subroutine krylov::krylov_monitor_stop |
( |
class(ksp_t), intent(in) | this | ) |
|
|
private |
◆ krylov_set_pc()
| subroutine krylov::krylov_set_pc |
( |
class(ksp_t), intent(inout) | this, |
|
|
class(pc_t), intent(in), target | m ) |
|
private |
◆ krylov_registry
◆ krylov_registry_size
| integer krylov::krylov_registry_size = 0 |
|
private |
◆ ksp_abs_tol
| real(kind=rp), parameter, public krylov::ksp_abs_tol = 1d-9 |
◆ ksp_max_iter
| integer, parameter, public krylov::ksp_max_iter = 1e3 |
◆ ksp_rel_tol
| real(kind=rp), parameter, public krylov::ksp_rel_tol = 1d-9 |