TransFlow
0.1.0
A transient pipeline flow simulation library
|
The Simulator class combines Physics and Solver to advance the state of the pipeline in time. It contains a Pipeline instance which has thes state of the pipeline at all times. More...
#include <simulator.hpp>
Public Member Functions | |
Simulator (const Pipeline &pipeline=Pipeline(), const Config &config=Config()) | |
Construct using Pipeline and Config. Will construct Physics and Solver using the settings in Config, and will make local copy of pipeline. More... | |
Simulator (const Pipeline &pipeline, std::unique_ptr< Physics > &physics, std::unique_ptr< Solver > &solver) | |
Construct from finished instances of Pipeline, Physics and Solver. More... | |
arma::vec | simulate (const TimeSeries &timeSeries) |
Advance the pipeline in time by any number of time steps. If initialize is true the pipeline pressure, temperature and flow will be set to reasonable values according to the boundary conditions before the simulation is started. More... | |
void | enableBatchTracking () |
Enables batch tracking. Wrapper around Pipeline::enableBatchTracking(). | |
arma::uword | size () const |
Get size (number of grid points) | |
const Pipeline & | pipeline () const |
Get (const ref) Pipeline. | |
const Pipeline::State & | state () const |
Get (const ref) Pipeline::State. | |
const Solver & | solver () const |
Get (const ref) Solver. | |
const Physics & | physics () const |
Get (const ref) Physics. | |
Sampler & | sampler () |
Get (ref) sampler. | |
Private Member Functions | |
std::optional< Sampler > | makeSampler (const Config &config) |
Make optional Sampler instance. Returns empty optional if config.outputPath is empty. More... | |
Private Attributes | |
std::unique_ptr< Pipeline > | m_state |
Pipeline state. | |
std::unique_ptr< Physics > | m_physics |
Physics instance, contains HeatTransfer and EquationOfState. | |
std::unique_ptr< Solver > | m_solver |
Solver instance, contains GoverningEquationSolver and BatchTracking. | |
std::optional< Sampler > | m_sampler |
(Optional) sampler instance, for writing results to file during simulation | |
The Simulator class combines Physics and Solver to advance the state of the pipeline in time. It contains a Pipeline instance which has thes state of the pipeline at all times.
arma::vec Simulator::simulate | ( | const TimeSeries & | timeSeries | ) |
Advance the pipeline in time by any number of time steps. If initialize is true the pipeline pressure, temperature and flow will be set to reasonable values according to the boundary conditions before the simulation is started.
timeSeries | Boundary conditions with timestamps |