|
Neko 1.99.9
A portable framework for high-order spectral element flow simulations
|
Device implementation of the right-preconditioned BiCGStab method. More...


Public Member Functions | |
| procedure, pass(this) | init (this, n, max_iter, m, rel_tol, abs_tol, monitor) |
| Initialise a device BiCGStab solver. | |
| procedure, pass(this) | free (this) |
| Free a device BiCGStab solver. | |
| procedure, pass(this) | solve (this, ax, x, f, n, coef, bc_projector, gs_h, niter) |
| Solve a linear system with the device BiCGStab method. | |
| procedure, pass(this) | solve_coupled (this, ax, x, y, z, fx, fy, fz, n, coef, bc_projector, gs_h, niter) |
| Solve three independent systems with the device BiCGStab method. | |
| procedure(ksp_init_intrf), deferred, pass(this) | init (this, n, max_iter, m, rel_tol, abs_tol, monitor) |
| Constructor. | |
| procedure, pass(this) | ksp_init (this, max_iter, rel_tol, abs_tol, m, monitor) |
| Base type constructor. | |
| procedure, pass(this) | ksp_free (this) |
| Base type destructor. | |
| procedure, pass(this) | set_pc (this, m) |
| Set preconditioner. | |
| procedure(ksp_method), deferred, pass | solve (this, ax, x, f, n, coef, bc_projector, gs_h, niter) |
| Solve the system. | |
| procedure(ksp_method_coupled), deferred, pass | solve_coupled (this, ax, x, y, z, fx, fy, fz, n, coef, bc_projector, gs_h, niter) |
| Solve the system (coupled version). | |
| procedure, pass(this) | monitor_start (this, name) |
| Monitor start. | |
| procedure, pass(this) | monitor_stop (this) |
| Monitor stop. | |
| procedure, pass(this) | monitor_iter (this, iter, rnorm) |
| Monitor iteration. | |
| procedure, pass(this) | is_converged (this, iter, residual) |
| Check for convergence. | |
| procedure(ksp_t_free), deferred, pass | free (this) |
| Destructor. | |
Public Attributes | |
| real(kind=rp), dimension(:), allocatable | p |
| Search direction \(p\). | |
| real(kind=rp), dimension(:), allocatable | p_hat |
| Preconditioned search direction \(\hat{p} = M^{-1}p\). | |
| real(kind=rp), dimension(:), allocatable | r |
| Residual \(r\). | |
| real(kind=rp), dimension(:), allocatable | s |
| Intermediate residual \(s = r - \alpha v\). | |
| real(kind=rp), dimension(:), allocatable | s_hat |
| Preconditioned intermediate residual \(\hat{s} = M^{-1}s\). | |
| real(kind=rp), dimension(:), allocatable | t |
| Operator action \(t = A\hat{s}\). | |
| real(kind=rp), dimension(:), allocatable | v |
| Operator action \(v = A\hat{p}\). | |
| type(c_ptr) | p_d = C_NULL_PTR |
| type(c_ptr) | p_hat_d = C_NULL_PTR |
| type(c_ptr) | r_d = C_NULL_PTR |
| type(c_ptr) | s_d = C_NULL_PTR |
| type(c_ptr) | s_hat_d = C_NULL_PTR |
| type(c_ptr) | t_d = C_NULL_PTR |
| type(c_ptr) | v_d = C_NULL_PTR |
| type(c_ptr) | gs_event = C_NULL_PTR |
| class(pc_t), pointer | m => null() |
| Preconditioner. | |
| real(kind=rp) | rel_tol |
| Relative tolerance. | |
| real(kind=rp) | abs_tol |
| Absolute tolerance. | |
| integer | max_iter |
| Maximum number of iterations. | |
| class(pc_t), allocatable | m_ident |
| Internal preconditioner (Identity) | |
| logical | monitor |
| Turn on/off monitoring. | |
The recurrence and the breakdown criteria mirror the CPU implementation in bicgstab_t. The solve starts from a zero initial guess and uses the preconditioner provided by ksp_t. The coupled interface solves the three components independently and does not apply a coupled operator.
Each vector update is fused with the reduction that follows it, so an iteration issues four kernels and four global reductions rather than thirteen and seven.
Definition at line 71 of file bicgstab_device.F90.
| procedure, pass(this) bicgstab_device::bicgstab_device_t::free | ( | class(bicgstab_device_t), intent(inout) | this | ) |
Definition at line 98 of file bicgstab_device.F90.
|
pure virtualinherited |
Definition at line 103 of file krylov.f90.
| procedure, pass(this) bicgstab_device::bicgstab_device_t::init | ( | class(bicgstab_device_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 | ||
| ) |
| 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 96 of file bicgstab_device.F90.
|
pure virtualinherited |
Definition at line 83 of file krylov.f90.
|
inherited |
This function checks if the Krylov solver has converged. The solver is considered converged if the residual is less than the absolute tolerance.
| residual | Residual |
| iter | Iteration number |
Definition at line 101 of file krylov.f90.
Definition at line 87 of file krylov.f90.
|
inherited |
| max_iter | Maximum number of iterations. |
| rel_tol | Relative tolarance for converence. |
| rel_tol | Absolute tolarance for converence. |
| M | The preconditioner. |
Definition at line 85 of file krylov.f90.
|
inherited |
Definition at line 99 of file krylov.f90.
|
inherited |
Definition at line 95 of file krylov.f90.
Definition at line 97 of file krylov.f90.
|
inherited |
| M | The preconditioner. |
Definition at line 89 of file krylov.f90.
| procedure, pass(this) bicgstab_device::bicgstab_device_t::solve | ( | class(bicgstab_device_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 | ||
| ) |
The initial guess in x is discarded and the iteration starts from zero.
| 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. |
Definition at line 100 of file bicgstab_device.F90.
|
pure virtualinherited |
Definition at line 91 of file krylov.f90.
| procedure, pass(this) bicgstab_device::bicgstab_device_t::solve_coupled | ( | class(bicgstab_device_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 | ||
| ) |
This routine sequentially invokes the scalar solver for each component.
| 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. |
| bc_projector | Boundary conditions for the three components. |
| gs_h | Gather-scatter handle used to assemble operator results. |
| niter | Optional maximum number of iterations, overriding the configured value. |
Definition at line 102 of file bicgstab_device.F90.
|
pure virtualinherited |
Definition at line 93 of file krylov.f90.
|
inherited |
Definition at line 77 of file krylov.f90.
| type(c_ptr) bicgstab_device::bicgstab_device_t::gs_event = C_NULL_PTR |
Definition at line 93 of file bicgstab_device.F90.
|
inherited |
Definition at line 79 of file krylov.f90.
|
inherited |
Definition at line 78 of file krylov.f90.
|
inherited |
Definition at line 80 of file krylov.f90.
| real(kind=rp), dimension(:), allocatable bicgstab_device::bicgstab_device_t::p |
Definition at line 73 of file bicgstab_device.F90.
| type(c_ptr) bicgstab_device::bicgstab_device_t::p_d = C_NULL_PTR |
Definition at line 86 of file bicgstab_device.F90.
| real(kind=rp), dimension(:), allocatable bicgstab_device::bicgstab_device_t::p_hat |
Definition at line 75 of file bicgstab_device.F90.
| type(c_ptr) bicgstab_device::bicgstab_device_t::p_hat_d = C_NULL_PTR |
Definition at line 87 of file bicgstab_device.F90.
| real(kind=rp), dimension(:), allocatable bicgstab_device::bicgstab_device_t::r |
Definition at line 77 of file bicgstab_device.F90.
| type(c_ptr) bicgstab_device::bicgstab_device_t::r_d = C_NULL_PTR |
Definition at line 88 of file bicgstab_device.F90.
|
inherited |
Definition at line 76 of file krylov.f90.
| real(kind=rp), dimension(:), allocatable bicgstab_device::bicgstab_device_t::s |
Definition at line 79 of file bicgstab_device.F90.
| type(c_ptr) bicgstab_device::bicgstab_device_t::s_d = C_NULL_PTR |
Definition at line 89 of file bicgstab_device.F90.
| real(kind=rp), dimension(:), allocatable bicgstab_device::bicgstab_device_t::s_hat |
Definition at line 81 of file bicgstab_device.F90.
| type(c_ptr) bicgstab_device::bicgstab_device_t::s_hat_d = C_NULL_PTR |
Definition at line 90 of file bicgstab_device.F90.
| real(kind=rp), dimension(:), allocatable bicgstab_device::bicgstab_device_t::t |
Definition at line 83 of file bicgstab_device.F90.
| type(c_ptr) bicgstab_device::bicgstab_device_t::t_d = C_NULL_PTR |
Definition at line 91 of file bicgstab_device.F90.
| real(kind=rp), dimension(:), allocatable bicgstab_device::bicgstab_device_t::v |
Definition at line 85 of file bicgstab_device.F90.
| type(c_ptr) bicgstab_device::bicgstab_device_t::v_d = C_NULL_PTR |
Definition at line 92 of file bicgstab_device.F90.