File laplacexy.hxx#
-
class LaplaceXY#
Public Functions
-
LaplaceXY(Mesh *m = nullptr, Options *opt = nullptr, const CELL_LOC loc = CELL_CENTRE)#
Constructor
-
~LaplaceXY()#
Destructor
-
void setCoefs(const Field2D &A, const Field2D &B)#
Set coefficients (A, B) in equation: Div( A * Grad_perp(x) ) + B*x = b
-
const Field2D solve(const Field2D &rhs, const Field2D &x0)#
Solve Laplacian in X-Y
Inputs
rhs - The field to be inverted. This must be allocated and contain valid data. x0 - Initial guess at the solution. If this is unallocated then an initial guess of zero will be used.
Returns
The solution as a Field2D. On failure an exception will be raised
-
int precon(Vec x, Vec y)#
Preconditioner function This is called by PETSc via a static function. and should not be called by external users
Preconditioner NOTE: For generality, this routine does use globalIndex() in the inner loop, although this may be slightly less efficient than incrementing an integer for the global index, the finite-volume and finite-difference implementations have slightly different indexing patterns, so incrementing an integer would be tricky.
Private Functions
-
int localSize()#
Number of grid points on this processor
-
MPI_Comm communicator()#
Return the communicator for XY
-
int globalIndex(int x, int y)#
Return the global index of a local (x,y) coordinate including guard cells. Boundary cells have a global index of -1
To do this, a Field2D (indexXY) is used to store the index as a floating point number which is then rounded to an integer. Guard cells are filled by communication so no additional logic is needed in Mesh.
-
void setPreallocationFiniteVolume(PetscInt *d_nnz, PetscInt *o_nnz)#
-
void setPreallocationFiniteDifference(PetscInt *d_nnz, PetscInt *o_nnz)#
Private Members
-
Vec xs#
-
Vec bs#
Solution and RHS vectors.
-
KSP ksp#
Krylov Subspace solver.
-
PC pc#
Preconditioner.
-
int xstart#
-
int xend#
-
int nloc#
-
int nsys#
-
std::unique_ptr<CyclicReduce<BoutReal>> cr#
Tridiagonal solver.
-
bool finite_volume = {true}#
-
bool include_y_derivs#
-
bool x_inner_dirichlet#
-
bool x_outer_dirichlet#
-
bool save_performance = false#
-
int n_calls = 0#
-
LaplaceXYMonitor monitor#
Friends
- friend class LaplaceXYMonitor
-
LaplaceXY(Mesh *m = nullptr, Options *opt = nullptr, const CELL_LOC loc = CELL_CENTRE)#