|
MOM6
|
Solvers of linear systems.
Date of creation: 2008.06.12 L. White.
This module contains solvers of linear systems. These routines have now been updated for greater efficiency, especially in special cases.
Functions/Subroutines | |
| subroutine, public | solve_linear_system (A, R, X, N, answers_2018) |
| Solve the linear system AX = R by Gaussian elimination. More... | |
| subroutine, public | linear_solver (N, A, R, X) |
| Solve the linear system AX = R by Gaussian elimination. More... | |
| subroutine, public | solve_tridiagonal_system (Al, Ad, Au, R, X, N, answers_2018) |
| Solve the tridiagonal system AX = R. More... | |
| subroutine, public | solve_diag_dominant_tridiag (Al, Ac, Au, R, X, N) |
| Solve the tridiagonal system AX = R. More... | |
| subroutine, public regrid_solvers::linear_solver | ( | integer, intent(in) | N, |
| real, dimension(n,n), intent(inout) | A, | ||
| real, dimension(n), intent(inout) | R, | ||
| real, dimension(n), intent(inout) | X | ||
| ) |
Solve the linear system AX = R by Gaussian elimination.
This routine uses Gauss's algorithm to transform the system's original matrix into an upper triangular matrix. Back substitution then yields the answer. The matrix A must be square, with the first index varing along the row.
| [in] | n | The size of the system |
| [in,out] | a | The matrix being inverted [nondim] |
| [in,out] | r | system right-hand side [A] |
| [in,out] | x | solution vector [A] |
Definition at line 111 of file regrid_solvers.F90.
| subroutine, public regrid_solvers::solve_diag_dominant_tridiag | ( | real, dimension(n), intent(in) | Al, |
| real, dimension(n), intent(in) | Ac, | ||
| real, dimension(n), intent(in) | Au, | ||
| real, dimension(n), intent(in) | R, | ||
| real, dimension(n), intent(out) | X, | ||
| integer, intent(in) | N | ||
| ) |
Solve the tridiagonal system AX = R.
This routine uses a variant of Thomas's algorithm to solve the tridiagonal system AX = R, in a form that is guaranteed to avoid dividing by a zero pivot. The matrix A is made up of lower (Al) and upper diagonals (Au) and a central diagonal Ad = Ac+Al+Au, where Al, Au, and Ac are all positive (or negative) definite. However when Ac is smaller than roundoff compared with (Al+Au), the answers are prone to inaccuracy.
| [in] | n | The size of the system |
| [in] | ac | Matrix center diagonal offset from Al + Au |
| [in] | al | Matrix lower diagonal |
| [in] | au | Matrix upper diagonal |
| [in] | r | system right-hand side |
| [out] | x | solution vector |
Definition at line 234 of file regrid_solvers.F90.
| subroutine, public regrid_solvers::solve_linear_system | ( | real, dimension(n,n), intent(inout) | A, |
| real, dimension(n), intent(inout) | R, | ||
| real, dimension(n), intent(inout) | X, | ||
| integer, intent(in) | N, | ||
| logical, intent(in), optional | answers_2018 | ||
| ) |
Solve the linear system AX = R by Gaussian elimination.
This routine uses Gauss's algorithm to transform the system's original matrix into an upper triangular matrix. Back substitution yields the answer. The matrix A must be square, with the first index varing down the column.
| [in] | n | The size of the system |
| [in,out] | a | The matrix being inverted [nondim] |
| [in,out] | r | system right-hand side [A] |
| [in,out] | x | solution vector [A] |
| [in] | answers_2018 | If true or absent use older, less efficient expressions. |
Definition at line 19 of file regrid_solvers.F90.
| subroutine, public regrid_solvers::solve_tridiagonal_system | ( | real, dimension(n), intent(in) | Al, |
| real, dimension(n), intent(in) | Ad, | ||
| real, dimension(n), intent(in) | Au, | ||
| real, dimension(n), intent(in) | R, | ||
| real, dimension(n), intent(out) | X, | ||
| integer, intent(in) | N, | ||
| logical, intent(in), optional | answers_2018 | ||
| ) |
Solve the tridiagonal system AX = R.
This routine uses Thomas's algorithm to solve the tridiagonal system AX = R. (A is made up of lower, middle and upper diagonals)
| [in] | n | The size of the system |
| [in] | ad | Matrix center diagonal |
| [in] | al | Matrix lower diagonal |
| [in] | au | Matrix upper diagonal |
| [in] | r | system right-hand side |
| [out] | x | solution vector |
| [in] | answers_2018 | If true use older, less acccurate expressions. |
Definition at line 172 of file regrid_solvers.F90.