File petsc.hxx#

Defines

OPT_SIZE#

Typedefs

using BoutReal = PetscScalar
using rhsfunc = int (*)(BoutReal)#

Functions

PetscErrorCode PetscMonitor(TS, PetscInt, PetscReal, Vec, void *ctx)

Monitor function called on every internal timestep.

PetscErrorCode PetscSNESMonitor(SNES, PetscInt, PetscReal, void *ctx)

Monitor function for SNES.

PetscErrorCode solver_ijacobian(TS, PetscReal, Vec, Vec, PetscReal, Mat*, Mat*, MatStructure*, void*)#

Compute IJacobian = dF/dU + a dF/dUdot - a dummy matrix used for pc=none.

Variables

BoutReal simtime
struct snes_info#
#include <petsc.hxx>

Data for SNES.

Public Members

PetscInt it#
PetscInt linear_its#
PetscReal time#
PetscReal norm#
class PetscSolver : public Solver#

Public Functions

PetscSolver(Options *opts = nullptr)#
~PetscSolver()#
virtual int init() override#

Initialise the solver.

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.

PetscErrorCode rhs(TS ts, PetscReal t, Vec globalin, Vec globalout)#

Wrapper for the RHS function.

PetscErrorCode pre(PC pc, Vec x, Vec y)#

Wrapper for the preconditioner.

PetscErrorCode jac(Vec x, Vec y)#

Wrapper for the Jacobian function.

Public Members

PetscLogEvent solver_event#
PetscLogEvent loop_event#
PetscLogEvent init_event#

Private Members

BoutReal shift#

Shift (alpha) parameter from TS.

Vec state#
BoutReal ts_time#

Internal PETSc timestepper time.

PetscLib lib#

Handles initialising, finalising PETSc.

Vec u = {nullptr}#

PETSc solution vector.

TS ts = {nullptr}#

PETSc timestepper object.

Mat J = {nullptr}#

RHS Jacobian.

Mat Jmf = {nullptr}#
MatFDColoring matfdcoloring = {nullptr}#
bool diagnose#

If true, print some information about current stage.

BoutReal next_output#

When the monitor should be called next.

PetscBool interpolate = {PETSC_TRUE}#

Whether to interpolate or not.

char output_name[PETSC_MAX_PATH_LEN]#
PetscBool output_flag = {PETSC_FALSE}#
PetscInt prev_linear_its#
BoutReal bout_snes_time = {0.0}#
std::vector<snes_info> snes_list#
bool adaptive#

Use adaptive timestepping.

bool use_precon#
bool use_jacobian#
BoutReal abstol#
BoutReal reltol#
bool adams_moulton#
BoutReal start_timestep#
int mxstep#

Friends

friend PetscErrorCode PetscMonitor(TS, PetscInt, PetscReal, Vec, void *ctx)#

Monitor function called on every internal timestep.

friend PetscErrorCode PetscSNESMonitor(SNES, PetscInt, PetscReal, void *ctx)#

Monitor function for SNES.

friend PetscErrorCode solver_ijacobian(TS, PetscReal, Vec, Vec, PetscReal, Mat*, Mat*, MatStructure*, void*)#

Compute IJacobian = dF/dU + a dF/dUdot - a dummy matrix used for pc=none.