File iterative_parallel_tri.hxx

class LaplaceIPT : public Laplacian

Public Functions

LaplaceIPT(Options *opt = nullptr, const CELL_LOC loc = CELL_CENTRE, Mesh *mesh_in = nullptr, Solver *solver = nullptr, Datafile *dump = nullptr)
~LaplaceIPT() = default
inline virtual void setCoefA(const Field2D &val) override

Set coefficients for inversion. Re-builds matrices if necessary.

inline virtual void setCoefC(const Field2D &val) override
inline virtual void setCoefD(const Field2D &val) override
inline virtual void setCoefEx(const Field2D &val) override
inline virtual void setCoefEz(const Field2D &val) override
inline virtual FieldPerp solve(const FieldPerp &b) override
virtual FieldPerp solve(const FieldPerp &b, const FieldPerp &x0) override
inline BoutReal getMeanIterations() const
inline void resetMeanIterations()
void resetSolver()

Private Functions

inline bool isGlobalFlagSet(int flag) const
inline bool isInnerBoundaryFlagSet(int flag) const
inline bool isOuterBoundaryFlagSet(int flag) const

Private Members

BoutReal rtol

Solver tolerances.

BoutReal atol
int maxits

Maximum number of iterations.

int max_level

Maximum number of coarse grids.

int max_cycle

Maximum number of iterations per grid.

bool predict_exit

Predict when convergence will be reached, and skip expensive convergence checks at earlier iterations.

Field2D A

The coefficents in $D*grad_perp^2(x) + (1/C)*(grad_perp(C))*grad_perp(x) + A*x = b$

Field2D C
Field2D D
int nmode

Number of unfiltered Fourier modes.

int ncx

Number of local x, y points.

int ny
std::vector<Level> levels

Information about the grids.

int jy

Current y index.

Tensor<dcomplex> avec

Lower-, on- and upper-diagonal terms of the operator matrix.

Tensor<dcomplex> bvec
Tensor<dcomplex> cvec
Tensor<dcomplex> upperGuardVector

Coefficients for recovering the full global solution from guard cells

Tensor<dcomplex> lowerGuardVector
Matrix<dcomplex> minvb

Local $M^{-1} f$.

Matrix<dcomplex> al

Coefficients of first and last interior rows $^l$

Matrix<dcomplex> bl

$^l$

Matrix<dcomplex> au

$^u$

Matrix<dcomplex> bu

$^u$

Array<dcomplex> rl

$r^l$

Array<dcomplex> ru

$r^u$

Matrix<dcomplex> r1

Coefficients used to compute $r^l$ from domain below.

Matrix<dcomplex> r2
Array<bool> first_call

Flag to state whether this is the first time the solver is called on the point (jy,kz).

Tensor<dcomplex> x0saved

Save previous x in Fourier space.

BoutReal ipt_mean_its = {0.0}

Mean number of iterations taken by the solver.

int ncalls = {0}

Counter for the number of times the solver has been called.

int proc_in

Neighbouring processors in the in and out directions.

int proc_out
int myproc

This processor’s unique ID.

int nproc

Shorthand for localmesh->NXPE.

Array<bool> converged

Array recording whether a kz mode is converged.

Matrix<dcomplex> fine_error

Error interpolated onto the grid one finer than current grid.

int xs

First and last interior points xstart, xend.

int xe

Friends

friend class Level
class Level

Public Functions

Level(LaplaceIPT &lap)
Level(const LaplaceIPT &lap, const Level &lup, std::size_t current_level)
void calculate_residual(const LaplaceIPT &lap)
void calculate_total_residual(const LaplaceIPT &lap, Array<BoutReal> &error, Array<bool> &converged)
void coarsen(const LaplaceIPT &lap, const Matrix<dcomplex> &fine_residual)
void gauss_seidel_red_black(const LaplaceIPT &lap)
void init_rhs(LaplaceIPT &lap, const Matrix<dcomplex> &bcmplx)
bool is_diagonally_dominant(const LaplaceIPT &lap) const
void reconstruct_full_solution(const LaplaceIPT &lap, Matrix<dcomplex> &xk1d) const
void refine(const LaplaceIPT &lap, Matrix<dcomplex> &fine_error)
void synchronize_reduced_field(const LaplaceIPT &lap, Matrix<dcomplex> &field)
void update_solution(const LaplaceIPT &lap)

Public Members

Matrix<dcomplex> xloc
Matrix<dcomplex> residual
Tensor<dcomplex> ar
Tensor<dcomplex> br
Tensor<dcomplex> cr
Tensor<dcomplex> brinv
Matrix<dcomplex> rr
int myproc

Unique ID.

int proc_in

In-neighbour.

int proc_out

Out-neighbour.

bool included

Whether this processor is included in this grid level’s calculation.

bool red

Colouring of processor for Gauss-Seidel.

bool black
std::size_t current_level

Current grid level being solved.

int index_start
int index_end
bool included_up

Whether this processor is involved in the calculation on the grid one level more refined

int proc_in_up

This processor’s neighbours on the level above.

int proc_out_up