PDESolver Structure

Starting a Simulation

This page describes functions located in the PDESolver module that tie together the physics modules and the Nonlinear solvers.

This function provides a way to invoke any physics solver based on the specification of the physics in the input file.

The physics module must have already been registered using register_physics

This function is equivalent to solvePDE, it is maintained here for legacy purposes only.

Inputs

  • input_file: an AbstractString specifying the path to the input file

Outputs

  • mesh: the AbstractMesh object used during the solve

  • sbp: the SBP operator used by the solver

  • eqn: the AbstractSolutionData object during the solve. At exit, eqn.q_vec should have the final solution in it

  • opts: the options dictionary

source

To run a simulation, the following steps must be done

Some of these steps are handled by the PDESolver module, and a few are handled by the physics module.

Input Dictionary

The first step is to read the input file. Reading input files is split into two parts. The first part is done by the Input module, which loads the file from disk and supplies default values. The second part is done by the physics-specific registered with register_physics. this function that verifies the physics module supports the given options (especially checking for combinations of

options that might not be supported). See, for example, checkOptions.

Creating Objects

The next thing the physics module needs to do is create AbstractSBP and AbstractMesh, and AbstractSolutionData objects. The function createMeshAndOperator should be used by all physics modules to create the first two.

The AbstractSolutionData is created by the physics module itself. The details of how to do this are left up to the physics module, but the return values of createMeshAndOperator should be used for static parameter values.

These creation of all three objects are performed by the _createObjects functions provided to register_physics.

Load an initial condition

The function solvePDE is extended by each physics module to is do the remaining operations.

The details of how to load an initial condition are left up to the physics module, but the end result must be the initial condition is present in eqn.q_vec.

Physics modules generally use a Dictionary to map IC names (which is how ICs are referred to in the input file) to the function that applies the IC. See registerIC for further description.

Various calculations

After loading the IC, the options dictionary may require the calculation of a few quantities. See solvePDE for the list of options keys that must be supported.

Invoke a NonlinearSolver

The next step is calling a Nonlinear Solver. The function call_nlsolver takes the objects already constructed and calls the appropriate nonlinear solver. Currently, there are no strong guarantees about where the solution is stored (eqn.q or eqn.q_vec) when this function returns (TODO: fix that).

Do Postprocessing

The options dictionary may require post-processing be done, for example calculating the solution error when the analytical solution is known. Each physics module usually defines a function to do this. See postproc for an example.