WARPXM v1.10.0
Loading...
Searching...
No Matches
Internal code structure of WARPXM

The logical flow of setting up a simulation is not necessarily how it all happens under the hood. The following describes the code structure and how it pertains to the logical components described in the WARPXM structure page.

An overview of the structure of WARPXM can also be found in Chapter 4 of Iman Datta's dissertation.

warpxm.cc

warpxm.ccholds the main method which accepts any command line arguments and calls three major sub-methods:

  • warpxm_init(): Initializes MPI and PETSc.
  • warpxm_main(): Does a number of things to set up and run the simulation:
    1. Starts MPI processes.
    2. Instantiates a WmSimulation object.
    3. Parses the command line arguments.
    4. Reads in the WARPXM input (.inp) file.
    5. Creates the WxCryptSet.
    6. Sets up the simulation by calling WmSimulation::setup().
    7. Runs the simulation by calling WmSimulation::simulate()
  • warpxm_finalize(): Cleans up MPI and PETSc processes.

WmSimulation

WmSimulation builds and runs the simulation based on the instructions contained in the WARPXM input file.

WmSimulation::setup()

The setup reads general simulation parameters from the cryptset:

  • "Simulation": Simulation name. This is the tag used in the input file for the solver. This is not the name of the simulation used for the run directory and naming files! That parameter is called "RunName". I know, it's confusing.
  • "RunName": The simulation name. Used to name the run directory and many files.
  • "GlobalVerbosity": Can have string values "debug" or "info", and determines the whether only the info stream or both the info stream and debug stream are printed to the console.
  • "LocalVerbosity": The same as global verbosity, but for each process. These logs are output to log files in the data directory, one for each process.
  • "NumericPrecision": No longer used. Still exists in many input files.

Loggers are created with the desired verbosity in mind.

Finally, a WmSolver is instantiated and it's setup method is called.

WmSimulation::simulate()

The simulate method primarily just calls WmSolver::solve().

It also prints some stuff to the console and notes the time the simulation started and stopped.

WmSolver

The solver initializes a spatial domain, initializes variables, sets up all the WmHostActions and sorts them into sequenced groups, and manages the order that all events occur in time. The WmSolver also handles simulation restarts, manages time step and frame incrimination, handles exceptions, and writes a lot of the progress messages for the debug and informational logging streams.