File pcr_thomas.hxx#
-
class LaplacePCR_THOMAS : public Laplacian#
Public Functions
-
LaplacePCR_THOMAS(Options *opt = nullptr, CELL_LOC loc = CELL_CENTRE, Mesh *mesh_in = nullptr, Solver *solver = nullptr)#
-
~LaplacePCR_THOMAS() = default#
-
inline virtual void setCoefA(const Field2D &val) override#
Set coefficients for inversion. Re-builds matrices if necessary.
-
virtual Field3D solve(const Field3D &rhs, const Field3D &x0) override#
Performs the laplacian inversion y-slice by y-slice
- Parameters:
b – [in] All the y-slices of b_slice, which is the right hand side of the equation A*x_slice = b_slice
x0 – [in] All the y-slices of the variable eventually used to set BC
- Returns:
x All the y-slices of x_slice in the equation A*x_slice = b_slice
-
void cr_solver(double *a_mpi, double *b_mpi, double *c_mpi, double *r_mpi, double *x_mpi)#
-
void cr_pcr_solver(Matrix<dcomplex> &a_mpi, Matrix<dcomplex> &b_mpi, Matrix<dcomplex> &c_mpi, Matrix<dcomplex> &r_mpi, Matrix<dcomplex> &x_mpi)#
-
void pcr_thomas_solver(Matrix<dcomplex> &a_mpi, Matrix<dcomplex> &b_mpi, Matrix<dcomplex> &c_mpi, Matrix<dcomplex> &r_mpi, Matrix<dcomplex> &x_mpi)#
Thomas-PCR solver: pThomas_forward_multiple + pcr_forward_double + pThomas_backward_multiple.
- Parameters:
a_mpi – (input) Lower off-diagonal coeff., which is assigned to local private pointer a
b_mpi – (input) Diagonal coeff., which is assigned to local private pointer b
c_mpi – (input) Upper off-diagonal coeff.,, which is assigned to local private pointer c
r_mpi – (input) RHS vector, which is assigned to local private pointer r
x_mpi – (output) Solution vector, which is assigned to local private pointer x
-
void Thomas_pcr_solver(double *a_mpi, double *b_mpi, double *c_mpi, double *r_mpi, double *x_mpi)#
-
void verify_solution(double *a_ver, double *b_ver, double *c_ver, double *r_ver, double *x_sol)#
-
void setCoefA(const Field2D &val) = 0
Set coefficients for inversion. Re-builds matrices if necessary.
-
void setCoefC(const Field2D &val) = 0
-
inline void setCoefC1(const Field2D &val)
-
inline void setCoefC2(const Field2D &val)
-
void setCoefD(const Field2D &val) = 0
-
void setCoefEx(const Field2D &val) = 0
-
void setCoefEz(const Field2D &val) = 0
-
Field3D solve(const Field3D &b, const Field3D &x0)
Performs the laplacian inversion y-slice by y-slice
- Parameters:
b – [in] All the y-slices of b_slice, which is the right hand side of the equation A*x_slice = b_slice
x0 – [in] All the y-slices of the variable eventually used to set BC
- Returns:
x All the y-slices of x_slice in the equation A*x_slice = b_slice
Private Functions
-
void cr_forward_multiple_row(Matrix<dcomplex> &a, Matrix<dcomplex> &b, Matrix<dcomplex> &c, Matrix<dcomplex> &r) const#
Forward elimination of CR until a single row per MPI process remains.
After a single row per MPI process remains, PCR or CR between a single row is performed.
-
void cr_backward_multiple_row(Matrix<dcomplex> &a, Matrix<dcomplex> &b, Matrix<dcomplex> &c, Matrix<dcomplex> &r, Matrix<dcomplex> &x) const#
Backward substitution of CR after single-row solution per MPI process is obtained.
-
void apply_boundary_conditions(const Matrix<dcomplex> &a, const Matrix<dcomplex> &b, const Matrix<dcomplex> &c, const Matrix<dcomplex> &r, Matrix<dcomplex> &x)#
Apply the boundary conditions on the first and last X processors
-
void eliminate_boundary_rows(const Matrix<dcomplex> &a, Matrix<dcomplex> &b, const Matrix<dcomplex> &c, Matrix<dcomplex> &r)#
Eliminate boundary rows - perform row elimination to uncouple the first and last interior rows from their respective boundary rows. This is necessary to ensure we pass a square system of interior rows to the PCR library.
-
void cr_forward_single_row()#
-
void cr_backward_single_row()#
-
void pcr_forward_single_row(Matrix<dcomplex> &a, Matrix<dcomplex> &b, Matrix<dcomplex> &c, Matrix<dcomplex> &r, Matrix<dcomplex> &x) const#
PCR between a single row per MPI process and 2x2 matrix solver between i and i+nprocs/2 rows.
-
void pThomas_forward_multiple_row(Matrix<dcomplex> &a, Matrix<dcomplex> &b, Matrix<dcomplex> &c, Matrix<dcomplex> &r) const#
First phase of hybrid Thomas and PCR algorithm @detail Forward and backward elimination to remain two equations of first and last rows for each MPI processes.
-
void pcr_double_row_substitution(Matrix<dcomplex> &a, Matrix<dcomplex> &b, Matrix<dcomplex> &c, Matrix<dcomplex> &r, Matrix<dcomplex> &x)#
PCR solver for two equations per each MPI process @detail Forward CR to remain a single equation per each MPI process. PCR solver for single row is, then, executed. Substitution is also performed to obtain every solution.
-
void verify_solution(const Matrix<dcomplex> &a_ver, const Matrix<dcomplex> &b_ver, const Matrix<dcomplex> &c_ver, const Matrix<dcomplex> &r_ver, const Matrix<dcomplex> &x_sol) const#
Solution check.
- Parameters:
*a_ver – Coefficients of a with original values
*b_ver – Coefficients of b with original values
*c_ver – Coefficients of c with original values
*r_ver – RHS vector with original values
*x_sol – Solution vector
Private Members
-
int n_mpi#
Number of rows per MPI process and should be 2^n.
-
int nprocs#
Number of MPI process and should be also 2^m.
-
int myrank#
MPI process ID.
-
int xproc#
MPI process x ID.
-
int nmode#
Number of unfiltered Fourier modes.
-
int nsys = {}#
Number of systems to solve = number of unfiltered Fourier modes times number of y points
-
int ncx#
Number of local x, y points.
-
int ny#
-
int ncalls = {0}#
Counter for the number of times the solver has been called.
-
int xs#
First and last interior points xstart, xend.
-
int xe#
-
bool dst = {false}#
-
LaplacePCR_THOMAS(Options *opt = nullptr, CELL_LOC loc = CELL_CENTRE, Mesh *mesh_in = nullptr, Solver *solver = nullptr)#