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

Provides a CPU implementation of the BiCGStab method.

Data Types

type  bicgstab_t
 CPU implementation of the right-preconditioned BiCGStab method. More...
 

Functions/Subroutines

subroutine bicgstab_init (this, n, max_iter, m, rel_tol, abs_tol, monitor)
 Initialise a CPU BiCGStab solver.
 
subroutine bicgstab_free (this)
 Free a CPU BiCGStab solver.
 
type(ksp_monitor_t) function bicgstab_solve (this, ax, x, f, n, coef, bc_projector, gs_h, niter)
 Solve a linear system with the CPU BiCGStab method.
 
subroutine bicgstab_check_inner_product (inner_product, norm_a, norm_b, quantity)
 Check an inner product for a BiCGStab breakdown.
 
subroutine bicgstab_product_and_norm (product, norm_squared, a, b, mult, n)
 Compute a weighted inner product and squared norm in one reduction.
 
real(kind=rp) function bicgstab_sqrt (value, quantity)
 Return the square root of a valid squared norm.
 
type(ksp_monitor_t) function, dimension(3) bicgstab_solve_coupled (this, ax, x, y, z, fx, fy, fz, n, coef, bc_projector, gs_h, niter)
 Solve three independent systems with the CPU BiCGStab method.
 

Function/Subroutine Documentation

◆ bicgstab_check_inner_product()

subroutine bicgstab::bicgstab_check_inner_product ( real(kind=rp), intent(in inner_product,
real(kind=rp), intent(in norm_a,
real(kind=rp), intent(in norm_b,
character(len=*), intent(in quantity 
)
private

The comparison is normalised by both vector norms. Dividing by the larger norm first avoids overflow in their product and preserves scale invariance.

Parameters
inner_productWeighted inner product of the two vectors.
norm_aNorm of the first vector.
norm_bNorm of the second vector.
quantityName of the algorithmic quantity for error reporting.

Definition at line 372 of file bicgstab.f90.

Here is the caller graph for this function:

◆ bicgstab_free()

subroutine bicgstab::bicgstab_free ( class(bicgstab_t), intent(inout this)
private

Definition at line 138 of file bicgstab.f90.

◆ bicgstab_init()

subroutine bicgstab::bicgstab_init ( class(bicgstab_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.
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 94 of file bicgstab.f90.

◆ bicgstab_product_and_norm()

subroutine bicgstab::bicgstab_product_and_norm ( real(kind=rp), intent(out product,
real(kind=rp), intent(out norm_squared,
real(kind=rp), dimension(n), intent(in a,
real(kind=rp), dimension(n), intent(in b,
real(kind=rp), dimension(n), intent(in mult,
integer, intent(in n 
)
private

Combining the two values avoids adding a global synchronisation solely for the scale used by the breakdown checks.

Parameters
productWeighted inner product of a and b.
norm_squaredWeighted squared norm of b.
aFirst vector in the inner product.
bSecond vector in the inner product and vector whose norm is taken.
multSpectral element multiplicity weights.
nNumber of vector entries.

Definition at line 403 of file bicgstab.f90.

Here is the caller graph for this function:

◆ bicgstab_solve()

type(ksp_monitor_t) function bicgstab::bicgstab_solve ( class(bicgstab_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 
)
private

The initial guess in x is discarded and the iteration starts from zero.

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, overriding the configured value.
Returns
Convergence information for the solve.

Definition at line 189 of file bicgstab.f90.

Here is the call graph for this function:

◆ bicgstab_solve_coupled()

type(ksp_monitor_t) function, dimension(3) bicgstab::bicgstab_solve_coupled ( class(bicgstab_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 
)
private

This routine sequentially invokes the scalar solver for each component.

Parameters
AxLinear 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.
blstxBoundary conditions for the first component.
blstyBoundary conditions for the second component.
blstzBoundary conditions for the third component.
gs_hGather-scatter handle used to assemble operator results.
niterOptional maximum number of iterations, overriding the configured value.
Returns
Convergence information for each component.

Definition at line 468 of file bicgstab.f90.

◆ bicgstab_sqrt()

real(kind=rp) function bicgstab::bicgstab_sqrt ( real(kind=rp), intent(in value,
character(len=*), intent(in quantity 
)
private
Parameters
valueWeighted squared norm.
quantityName of the vector for error reporting.
Returns
The non-negative square root.

Definition at line 436 of file bicgstab.f90.

Here is the caller graph for this function: