File snes.hxx

class SNESSolver : public Solver
#include <snes.hxx>

Uses PETSc’s SNES interface to find a steady state solution to a nonlinear ODE

Public Functions

SNESSolver(Options *opt = nullptr)
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.

PetscErrorCode snes_function(Vec x, Vec f)

Nonlinear function.

Private Members

int mxstep

Maximum number of internal steps between outputs.

int nlocal

Number of variables on local processor.

int neq

Number of variables in total.

PetscLib lib

Handles initialising, finalising PETSc.

Vec snes_f

Used by SNES to store function.

Vec snes_x

Result of SNES.

SNES snes

SNES context.

Mat Jmf

Matrix-free Jacobian.