Lagrangian Particle Code for The Simulation of 2D/3D Fluid Dynamics
 All Classes Files Functions Variables Typedefs Friends Pages
time_controller.h
Go to the documentation of this file.
1 
24 #ifndef __TIME_CONTROLLER_H__
25 #define __TIME_CONTROLLER_H__
26 
27 #include <cstddef>
28 #include <vector>
29 #include <fstream>
30 
31 class LPSolver;
32 class ParticleViewer;
33 
51 public:
61  virtual int solve() = 0;
62 protected:
64  std::vector<ParticleViewer*> m_vViewers;
65  double m_fTime;
66  double m_fEndTime;
69  double m_fDt;
70  std::size_t m_iWriteStep;
71  bool m_iIfDebug;
72  std::ofstream debug;
73 
84 };
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 class Initializer;
95 
96 
114 
115 public:
127  DefaultTimeController(const Initializer& init, LPSolver* solver, const std::vector<ParticleViewer*>& viewers);
128 
138  virtual int solve();
139 
140 private:
141  double m_fCFLCoeff;
142  void computeDtByCFL();
143 
144 };
145 
146 
147 #endif // __TIME_CONTROLLER_H__
This time controller calculates the time stepping based on the CFL condition.
Definition: time_controller.h:113
std::ofstream debug
output information for debugging
Definition: time_controller.h:72
An abstract class for different types of simulation time controllers.
Definition: time_controller.h:50
std::size_t m_iWriteStep
The number of times results are written to the particle veiwer.
Definition: time_controller.h:70
An abstract class for classes that output simulations results.
Definition: particle_viewer.h:47
double m_fEndTime
End physical time of simulation.
Definition: time_controller.h:66
bool m_iIfDebug
if true then print debug info
Definition: time_controller.h:71
double m_fWriteTimeInterval
The physical time interval between two writting of results.
Definition: time_controller.h:67
double m_fDt
The physical time interval between two iterations of the simulation.
Definition: time_controller.h:69
std::vector< ParticleViewer * > m_vViewers
A vector containing pointers to different types of particle viewers.
Definition: time_controller.h:64
virtual int solve()
Calls main solvers of the simulation and determines the time stepping between iterations.
Definition: time_controller.cpp:67
An abstract class for the family of Lagrangian Particle solvers.
Definition: lp_solver.h:53
This class initializes the simulation.
Definition: initializer.h:227
double m_fTime
Current physical time of simulation.
Definition: time_controller.h:65
LPSolver * m_pSolver
A pointer to the Lagrangian Particle solver.
Definition: time_controller.h:63
DefaultTimeController(const Initializer &init, LPSolver *solver, const std::vector< ParticleViewer * > &viewers)
Constructor.
Definition: time_controller.cpp:45
virtual int solve()=0
Calls main solvers of the simulation and determines the time stepping between iterations.
bool adjustDtByWriteTimeInterval()
Adjusts the iteration time step when current time approaches the time for results writting...
Definition: time_controller.cpp:15
double m_fNextWriteTime
The next physical time point to write results.
Definition: time_controller.h:68