File slepc.hxx


class SlepcSolver : public Solver

Public Functions

SlepcSolver(Options *options)
int advanceStep(Mat &matOperator, Vec &inData, Vec &outData)
int compareEigs(PetscScalar ar, PetscScalar ai, PetscScalar br, PetscScalar bi)
void monitor(PetscInt its, PetscInt nconv, PetscScalar eigr[], PetscScalar eigi[], PetscReal errest[], PetscInt nest)
int init(int nout, BoutReal tstep)

Initialise the solver NOTE: nout and tstep should be passed to run, not init. Needed because of how the PETSc TS code works

int run()

Run the solver, calling monitors nout times, at intervals of tstep. This function is called by solve(), and is specific to each solver type

This should probably be protected, since it shouldn’t be called by users.

void setModel(PhysicsModel *model)

OVERRIDE Here we override all other virtual functions in order to pass through control to the actual solver (advanceSolver) This is only required if allow use of additional solver

void setRHS(rhsfunc f)

Set the RHS function.

void add(Field2D &v, const std::string &name)

Add a variable to be solved. This must be done in the initialisation stage, before the simulation starts.

void add(Field3D &v, const std::string &name)
void add(Vector2D &v, const std::string &name)
void add(Vector3D &v, const std::string &name)
void setJacobian(Jacobian j)

Specify a Jacobian (optional)

void setSplitOperator(rhsfunc fC, rhsfunc fD)

Split operator solves.

bool constraints()

Returns true if constraints available.

void constraint(Field2D &v, Field2D &C_v, std::string name)

Add constraint functions (optional). These link a variable v to a control parameter C_v such that v is adjusted to keep C_v = 0.

void constraint(Field3D &v, Field3D &C_v, std::string name)
void constraint(Vector2D &v, Vector2D &C_v, std::string name)
void constraint(Vector3D &v, Vector3D &C_v, std::string name)
int n2Dvars() const

Number of 2D variables. Vectors count as 3.

int n3Dvars() const

Number of 3D variables. Vectors count as 3.

void setMaxTimestep(BoutReal dt)

Set a maximum internal timestep (only for explicit schemes)

BoutReal getCurrentTimestep()

Return the current internal timestep.

void slepcToBout(PetscScalar &reEigIn, PetscScalar &imEigIn, BoutReal &reEigOut, BoutReal &imEigOut, bool force = false)

Public Members

int compareState
Mat shellMat

Private Functions

void vecToFields(Vec &inVec)
void fieldsToVec(Vec &outVec)
void createShellMat()
void createEPS()
void analyseResults()
void boutToSlepc(BoutReal &reEigIn, BoutReal &imEigIn, PetscScalar &reEigOut, PetscScalar &imEigOut, bool force = false)

Private Members

MPI_Comm comm
EPS eps
ST st
PetscBool stIsShell
Solver *advanceSolver
SlepcLib slib
bool ddtMode
bool selfSolve
bool eigenValOnly
Array<BoutReal> f0
Array<BoutReal> f1
int nout
BoutReal tstep
int nEig
int maxIt
int mpd
PetscReal tol
PetscReal target
BoutReal targRe
BoutReal targIm
bool userWhich
bool useInitial
bool debugMonitor
PetscInt localSize