Provides a CPU implementation of the BiCGStab method.
|
| type | bicgstab_t |
| | CPU implementation of the right-preconditioned BiCGStab method. More...
|
| |
|
| 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.
|
| |
◆ bicgstab_check_inner_product()
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_product | Weighted inner product of the two vectors. |
| norm_a | Norm of the first vector. |
| norm_b | Norm of the second vector. |
| quantity | Name of the algorithmic quantity for error reporting. |
Definition at line 372 of file bicgstab.f90.
◆ bicgstab_free()
◆ 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
-
| n | Number of degrees of freedom. |
| max_iter | Maximum number of iterations. |
| M | Optional preconditioner. An identity preconditioner is used if absent. |
| rel_tol | Optional relative convergence tolerance. |
| abs_tol | Optional absolute convergence tolerance. |
| monitor | Optional 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
-
| product | Weighted inner product of a and b. |
| norm_squared | Weighted squared norm of b. |
| a | First vector in the inner product. |
| b | Second vector in the inner product and vector whose norm is taken. |
| mult | Spectral element multiplicity weights. |
| n | Number of vector entries. |
Definition at line 403 of file bicgstab.f90.
◆ 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
-
| Ax | Linear operator. |
| x | Solution field. |
| f | Right-hand side. |
| n | Number of degrees of freedom. |
| coef | Spectral element coefficients and multiplicity weights. |
| bc_projector | Projector for dirichlet boundary nodes. |
| gs_h | Gather-scatter handle used to assemble the operator result. |
| niter | Optional maximum number of iterations, overriding the configured value. |
- Returns
- Convergence information for the solve.
Definition at line 189 of file bicgstab.f90.
◆ 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
-
| Ax | Linear operator. |
| x | Solution field for the first component. |
| y | Solution field for the second component. |
| z | Solution field for the third component. |
| fx | Right-hand side for the first component. |
| fy | Right-hand side for the second component. |
| fz | Right-hand side for the third component. |
| n | Number of degrees of freedom per component. |
| coef | Spectral element coefficients and multiplicity weights. |
| blstx | Boundary conditions for the first component. |
| blsty | Boundary conditions for the second component. |
| blstz | Boundary conditions for the third component. |
| gs_h | Gather-scatter handle used to assemble operator results. |
| niter | Optional maximum number of iterations, overriding the configured value. |
- Returns
- Convergence information for each component.
Definition at line 468 of file bicgstab.f90.
◆ bicgstab_sqrt()
- Parameters
-
| value | Weighted squared norm. |
| quantity | Name of the vector for error reporting. |
- Returns
- The non-negative square root.
Definition at line 436 of file bicgstab.f90.