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(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.

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

PETSc solution vector.

TS ts

PETSc timestepper object.

Mat J
Mat Jmf

RHS Jacobian.

MatFDColoring matfdcoloring
int nout

The number of outputs.

BoutReal tstep

Time between outputs.

bool diagnose

If true, print some information about current stage.

BoutReal next_output

When the monitor should be called next.

PetscBool interpolate

Whether to interpolate or not.

char output_name[PETSC_MAX_PATH_LEN]
PetscBool output_flag
PetscInt prev_linear_its
BoutReal bout_snes_time
std::vector<snes_info> snes_list
bool adaptive

Use adaptive timestepping.

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.