Provides a type for preconditioning fields in an iterative solver using Picard iteration.
Create a preconditioner object with the desired tolerance and maximum number of iterations.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r8), | intent(in), | optional | :: | tolerance | The tolerance within which to apply the inverse Jacobian. Defaults to 0.001. |
|
integer, | intent(in), | optional | :: | max_iterations | The maximum number of iterations to use when applying the preconditioner. Defaults to 20. |
Uses Picard iterations to apply the inverse Jacobian of a system to a vector, to low accuracy. Rather than directly computing the inverse Jacobian, it is more efficient to approximate it. If is the vector being preconditioned, and is the result of applying the preconditioner, then Thus, the preconditioner can be applied by approximately solving this system for . Linearising , this system can be solved efficiently using Picard iteration.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=r8), | private | :: | tolerance | = | 1.e-3_r8 | ||
integer, | private | :: | max_iterations | = | 20 |
private function constructor(tolerance, max_iterations) | Create a preconditioner object with the desired tolerance and maximum number of iterations. |
procedure, public :: apply => preconditioner_apply |
Create a preconditioner object with the desired tolerance and maximum number of iterations.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r8), | intent(in), | optional | :: | tolerance | The tolerance within which to apply the inverse Jacobian. Defaults to 0.001. |
|
integer, | intent(in), | optional | :: | max_iterations | The maximum number of iterations to use when applying the preconditioner. Defaults to 20. |
Use Picard iteration to approximately multiply the state vector by the inverse Jacobian. The details for this procedure are in the documentation of the preconditioner type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(preconditioner), | intent(in) | :: | this | |||
class(jacobian_block), | intent(inout), | dimension(:,:) | :: | jacobian | An matrix approximating the Jacobian for which the preconditioner is used. |
|
class(scalar_field), | intent(in), | dimension(:) | :: | vector | A vector of size which is to be preconditioned. |
|
class(scalar_field), | intent(inout), | dimension(:) | :: | estimate | On entry, an initial guess for the preconditioned vector. On exit, the iteratively determined value of the preconditioned vector. |