# User Guide¶

Serac can be used either by providing input files to the main executable or through a C++ API. Example lua input files are located in the data directory and examples of how to use the C++ API are located in the tests directory.

## Physics Module C++ Interface¶

A fundamental data structure in Serac is BasePhysics. Classes derived from BasePhysics are expected to encapsulate a specific partial differential equation and all of the state data and parameters associated with it. Currently, Serac contains the following physics modules:

If you would like to include Serac's simulation capabilities in your software project, these are the classes to include. To set up and use a physics module:

1. Construct the appropriate physics module class using a mfem::ParMesh and a polynomial order of approximation.
2. Set the material properties via mfem::Coefficients.
3. Set the boundary conditions via a std::set of boundary attributes and a mfem::Coefficient.
4. Set the right hand side source terms (e.g. body forces).
5. Set the time integration scheme (e.g. quasi-static or backward Euler). Note that not all time integrators are available for all physics modules.
6. Complete the setup of the physics module by calling completeSetup(). This allocates and builds all of the underlying linear algebra data structures.
7. Advance the timestep by calling advanceTimestep(double dt).
8. Output the state variables in VisIt, and optionally ParaView, format by calling outputState(). You can also access the underlying state data via the generic getState() or physics-specific calls (e.g. temperature()).