METHOD
Simulation Class Reference

#include <simulation.h>

Collaboration diagram for Simulation:

Public Member Functions

 Simulation (Data *data, PlatformEnv *env)
 
virtual ~Simulation ()
 
void set (InitialFunc *init, Model *model, TimeIntegrator *timeInt, Bcs *bcs, FluxMethod *fluxMethod, SaveData *save=NULL)
 
void updateTime ()
 
void evolve (bool output=false, int safety=-1)
 

Public Attributes

Datadata
 

Private Attributes

InitialFuncinit
 
Modelmodel
 
TimeIntegratortimeInt
 
Bcsbcs
 
FluxMethodfluxMethod
 
SaveDatasave
 
PlatformEnvenv
 

Detailed Description

The Simulation interface for the programme

The Simulation object is the furthest abstracted class of the project. All modules will be held in here, and they should have no knowledge of this class. The constructor takes a Data object (such that in this constructor we can allocate memory for the state vectors). All other system objects are set with the corresponding set functions.

Definition at line 23 of file simulation.h.

Constructor & Destructor Documentation

◆ Simulation()

Simulation::Simulation ( Data data,
PlatformEnv env 
)

Constructor.

Stores data and allocates memory for working arrays.
Note
This constructor must be called after the model has be initiated such that it knows how many conserved, primitive and auxiliary to allocate memory for, and once this has been completed, the initial function class may be implemented.
Parameters
[in]*datapointer to Data class containing global simulation data

◆ ~Simulation()

virtual Simulation::~Simulation ( )
virtual

Destructor frees alloc'd memory.

Member Function Documentation

◆ evolve()

void Simulation::evolve ( bool  output = false,
int  safety = -1 
)

Run the current set up until the end time.

Before calling evolve(), the simulation must be set up using set() to ensure all data is current and consistent with the initial primitive variables that have been selected. Once the simulation is set, evolve() calls updateTime() until the simulation has reached its end point (providing no errors occur)

Parameters
[in]outputboolean flag output files for animation
[in]safetynumber of frames after which to save all data. Defaults to -1 when option is switched off

◆ set()

void Simulation::set ( InitialFunc init,
Model model,
TimeIntegrator timeInt,
Bcs bcs,
FluxMethod fluxMethod,
SaveData save = NULL 
)

Sets up the simulation ready to be evolved.

This stores the model type and general simulation form and finds the conserved and auxiliary variables that correspond to the initial primitive data.
Note
This function must be called before calling either evolve() or updateTime(), but after the initial function, boundary conditions and time integrator have but initiated.
Parameters
[in]*initpointer to InitialFunc object
[in]*modelpointer to Model object
[in]*timeIntpointer to TimeIntegrator object
[in]*bcspointer to Bcs object
[in]*fluxMethodpointer to FluxMethod object
[in]*savepointer to the SaveData object
[in]*envpointer to the PlatformEnv object

◆ updateTime()

void Simulation::updateTime ( )

Incrememt the system forward by a single timestep.

When calling updateTime(), all primitive and auxiliary variables must be set. I.e. they must correspond to the values of the conserved vector at that time step. Given this, the conserved variables are evolved using the given time integrator according to the selected model. All primitive and auxiliary variables are then found and the updated values are saved in the Data class.

Member Data Documentation

◆ bcs

Bcs* Simulation::bcs
private

Pointer to boundary conditions, Bcs, object.

Definition at line 37 of file simulation.h.

◆ data

Data* Simulation::data

Pointer to Data class containing global simulation data.

Definition at line 27 of file simulation.h.

◆ env

PlatformEnv* Simulation::env
private

Pointer to PlatformEnv object.

Definition at line 43 of file simulation.h.

◆ fluxMethod

FluxMethod* Simulation::fluxMethod
private

Pointer to FluxMethod object.

Definition at line 39 of file simulation.h.

◆ init

InitialFunc* Simulation::init
private

Pointer to InitialFunc object to set up starting data.

Definition at line 31 of file simulation.h.

◆ model

Model* Simulation::model
private

Pointer to Model object, contains governing equations and spectral decomposition.

Definition at line 33 of file simulation.h.

◆ save

SaveData* Simulation::save
private

Pointer to SaveData object.

Definition at line 41 of file simulation.h.

◆ timeInt

TimeIntegrator* Simulation::timeInt
private

Pointer to TimeIntegrator object.

Definition at line 35 of file simulation.h.


The documentation for this class was generated from the following file: