Mesh ODE

The MeshODEStepper module is designed to illustrate the usage of a Mesh ODE solver. This model has no functionality for cell-refinement based on the solutions, so refinement is limited to the geometric refinement methods supplied by Driver.

The main class implements TimeStepper and is templated as follows:

/*!
  @brief Implementation of TimeStepper for solving an ODE on a mesh. N is the number of variables. 
*/
template <size_t N>
class MeshODEStepper : public TimeStepper

Here, N is the number of variables that will be stored on the mesh.

Example problem

The example problem set up by MeshODEStepper is

\[\partial_t\phi(t) = \cos\left(2\pi f t\right),\]

where \(f\) is a user-supplied frequency. The user can also set the initial value for \(\phi\) through the configuration options for MeshODEStepper<N>, see Solver configuration

Time advancement

Integration over a time step is done using either a second (Heun’s method) or fourth order Runge-Kutta method (classical RK4). The user can choose between the methods through the configuration options, see Solver configuration.

Setting up a new problem

To set up a new problem, using the Python setup tools in $DISCHARGE_HOME/Physics/MeshODEStepper is the simplest way. A full description is available in the README.md contained in the folder:

# Physics/MeshODE
This physics module solves for an ODE problem of a single scalar quantity. 

The source files consist of the following:

* **CD_MeshODEStepper.H** Implementation of TimeStepper, for advancing the equations of motion.

# Setting up a new problem
To set up a new problem, use the Python script. For example:

```shell
python setup.py -base_dir=/home/foo/MyApplications -app_name=MyProblem -geometry=Vessel
```

To install within chombo-discharge:

```shell
python setup.py -base_dir=$DISCHARGE_HOME/MyApplications -app_name=MyProblem -geometry=Vessel
```

The application will then be installed to $DISCHARGE_HOME/MyApplications/MyProblem.
The user will need to modify the geometry and set the initial conditions through the inputs file. 

To see available setup options, use

python setup.py --help

Note

The Python setup tools will set up a single scalar (i.e., N=1).

Solver configuration

The MeshODEStepper class comes with configurable input options that can be adjusted at runtime, which are listed below

# ====================================================================================================
# MeshODEStepper class options
# ====================================================================================================
MeshODEStepper.verbosity       = -1      ## Verbosity level
MeshODEStepper.integration     = rk2     ## 'euler', 'rk2', or 'rk4'
MeshODEStepper.init_phi        = 0.0     ## Initial value for phi.
MeshODEStepper.frequency       = 10      ## Frequency
MeshODEStepper.dt              = 1E-3    ## Time step