32 integer,
intent(in) :: n, max_iter
33 class(
pc_t),
target,
optional,
intent(in) :: M
34 real(kind=
rp),
optional,
intent(in) :: rel_tol, abs_tol
35 logical,
optional,
intent(in) :: monitor
38 if (
present(m))
call this%set_pc(m)
39 if (
present(rel_tol) .and.
present(abs_tol) .and.
present(monitor))
then
40 call this%ksp_init(max_iter, rel_tol, abs_tol, monitor = monitor)
41 else if (
present(rel_tol) .and.
present(abs_tol))
then
42 call this%ksp_init(max_iter, rel_tol, abs_tol)
43 else if (
present(rel_tol))
then
44 call this%ksp_init(max_iter, rel_tol = rel_tol)
45 else if (
present(abs_tol))
then
46 call this%ksp_init(max_iter, abs_tol = abs_tol)
47 else if (
present(monitor))
then
48 call this%ksp_init(max_iter, monitor = monitor)
50 call this%ksp_init(max_iter)
62 gs_h, niter)
result(ksp_results)
64 class(
ax_t),
intent(in) :: ax
65 type(
field_t),
intent(inout) :: x
66 integer,
intent(in) :: n
67 real(kind=
rp),
intent(in) :: f(n)
68 type(
coef_t),
intent(inout) :: coef
70 type(
gs_t),
intent(inout) :: gs_h
71 integer,
optional,
intent(in) :: niter
75 call neko_error(
'krylov_solver_template: solve is not implemented')
79 n, coef, bc_projector, gs_h, niter)
result(ksp_results)
81 class(
ax_t),
intent(in) :: ax
82 type(
field_t),
intent(inout) :: x, y, z
83 integer,
intent(in) :: n
84 real(kind=
rp),
intent(in) :: fx(n), fy(n), fz(n)
85 type(
coef_t),
intent(inout) :: coef
87 type(
gs_t),
intent(inout) :: gs_h
88 integer,
optional,
intent(in) :: niter
94 ksp_results(1) = this%solve(ax, x, fx, n, coef, bc_x, gs_h, niter)
95 ksp_results(2) = this%solve(ax, y, fy, n, coef, bc_y, gs_h, niter)
96 ksp_results(3) = this%solve(ax, z, fz, n, coef, bc_z, gs_h, niter)
102 call register_krylov(
'krylov_solver_template', allocator)
106 class(
ksp_t),
allocatable,
intent(inout) :: obj
__device__ T solve(const T u, const T y, const T guess, const T nu, const T kappa, const T B)
Factory for Krylov solvers. Both creates and initializes the object.
Defines a Matrix-vector product.
Template for a user-defined Krylov solver.
subroutine krylov_solver_template_free(this)
subroutine, public krylov_solver_template_register_types()
subroutine krylov_solver_template_allocate(obj)
type(ksp_monitor_t) function krylov_solver_template_solve(this, ax, x, f, n, coef, bc_projector, gs_h, niter)
type(ksp_monitor_t) function, dimension(3) krylov_solver_template_solve_coupled(this, ax, x, y, z, fx, fy, fz, n, coef, bc_projector, gs_h, niter)
subroutine krylov_solver_template_init(this, n, max_iter, m, rel_tol, abs_tol, monitor)
Implements the base abstract type for Krylov solvers plus helper types.
integer, parameter, public rp
Global precision used in computations.
Implements scalar_projector_t.
Implements boundary condition projectors for vector fields. Two types concrete types are provided: se...
subroutine, public vector_bc_projector_components(this, x, y, z)
Access the component scalar projectors from a segregated vector projector.
Base type for a matrix-vector product providing .
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Type for storing initial and final residuals in a Krylov solver.
Base abstract type for a canonical Krylov method, solving .
Defines a canonical Krylov preconditioner.
Projector for scalar boundary conditions.
Abstract type for resolving vector boundary conditions.