File slepc.hxx

Defines

OPT_SIZE
SOLVERSLEPCSELF
class SlepcSolver : public Solver

Public Functions

SlepcSolver(Options *options)
~SlepcSolver()
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)
virtual int init(int NOUT, BoutReal TIMESTEP) override

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

virtual int run() override

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.

inline virtual void setModel(PhysicsModel *model) override

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

inline virtual void add(Field2D &v, const std::string &name, const std::string &description = "") override

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

inline virtual void add(Field3D &v, const std::string &name, const std::string &description = "") override
inline virtual void add(Vector2D &v, const std::string &name, const std::string &description = "") override
inline virtual void add(Vector3D &v, const std::string &name, const std::string &description = "") override
inline virtual bool constraints() override

Returns true if constraints available.

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

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.

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

Number of 2D variables. Vectors count as 3.

inline virtual int n3Dvars() const override

Number of 3D variables. Vectors count as 3.

inline virtual void setMaxTimestep(BoutReal dt) override

Set a maximum internal timestep (only for explicit schemes)

inline virtual BoutReal getCurrentTimestep() override

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
std::unique_ptr<Solver> advanceSolver = {nullptr}
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