File boutmain.hxx

Defines

GLOBAL

Main function for legacy interface

The user provides two standalone functions, physics_init and physics_run. This header defines a class LegacyModel, which inherits from PhysicsModel. This class is used by Solver, and forwards calls to the user standalone functions.

It is recommended that users define a model by interiting from PhysicsModel directly, rather than using this header.

Note: This header file implements a main() function, so should only be included once, and cannot be combined with a user-defined main().

Functions

int physics_init(bool restarting)

Initialise the model. Called once at the start

Return
zero on success, non-zero error code
Parameters
  • restarting: True if the simulation is restarting

int physics_run(BoutReal t)

Calculate the time derivative

Return
zero on success, non-zero error code
Parameters
  • t: Simulation time

template<class T>
void bout_solve(T &var, const char *name)

Global functions used by some legacy models.

bool bout_constrain(Field3D &var, Field3D &F_var, const char *name)

Add a contraint variable

int main(int argc, char **argv)

Main function.

Variables

Solver *solver

Need a global Solver pointer, which is the same as the PhysicsModel solver

class LegacyModel : public PhysicsModel
#include <boutmain.hxx>

Class interface to Solvers, which emulates the older standalone function interface

Protected Functions

int init(bool restarting)

Initialise.

int rhs(BoutReal t)

Calculate time derivatives.