LBIBCell
 All Classes Functions Variables Friends Pages
SimulationRunner.hpp
1 /* Copyright (c) 2013 David Sichau <mail"at"sichau"dot"eu>
2  * 2013-2015 Simon Tanaka <tanakas"at"gmx"dot"ch>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 #ifndef SIMULATIONRUNNER_HPP
23 #define SIMULATIONRUNNER_HPP
24 
25 #include <LbmLib/include/geometry/GeometryHandler.hpp>
26 #include <LbmLib/include/solver/ForceSolver.hpp>
27 #include <LbmLib/include/solver/MassSolver/MassAbstractSolver.hpp>
28 #include <LbmLib/include/solver/BioSolver/BioAbstractSolver.hpp>
29 #include <string>
30 #include <unordered_set>
31 
32 namespace LbmLib {
33 namespace geometry {
34 class GeometryHandler;
35 }
36 namespace reportHandler {
37 class ReportHandler;
38 }
39 
44  public:
51  explicit SimulationRunner(
52  const geometry::GeometryHandler& geometry,
53  const reportHandler::ReportHandler& reportHandler);
54 
59 
63  void runSimulation();
64 
72  void writeSimulation(
73  const std::string& forceFileName,
74  const std::string& geometryFileName,
75  const std::string& parameterFileName,
76  const std::string& solverFileName) const;
77 
82  void initSolvers(Field<double> fluidVelocity);
83 
87  void initSolvers();
88 
93  void initSolvers(const std::string& filename);
94 
99  void addMassSolver(const std::string& name);
100 
105  void addBioSolver(const std::string& name);
106 
112  void initForceSolver(const std::string& fileName);
113 
114 
119  const solver::ForceSolver& getForceSolver(void);
120 
121  private:
127  void setTau(
128  double tau,
129  const std::string& name="");
130 
135  void addCDESolver(const std::string& name);
136 
140  void calculateForce();
141 
145  void collectVelocity();
146 
150  void distributeForce();
151 
155  void moveGeometry();
156 
160  void remeshBoundary();
161 
165  void coarsenBoundary(void);
166 
170  void checkLatticeIntegrity();
171 
175  void checkBoundaryIntegrity();
176 
180  void collide();
181 
185  void advect();
186 
190  void preAdvect();
191 
195  void postAdvect();
196 
200  void applyMassSolvers();
201 
205  void applyBioSolvers();
206 
210  solver::ForceSolver forceSolver_;
211 
215  std::vector<solver::MassAbstractSolver*> massSolvers_;
216 
220  std::vector<solver::BioAbstractSolver*> bioSolvers_;
221 
225  const geometry::GeometryHandler& geometryHandler_;
226 
230  const reportHandler::ReportHandler& reportHandler_;
231 };
232 } // end namespace
233 
234 #endif // SIMULATIONRUNNER_HPP
void addMassSolver(const std::string &name)
adds a mass solver to the simulation
SimulationRunner(const geometry::GeometryHandler &geometry, const reportHandler::ReportHandler &reportHandler)
constructor
void initSolvers()
initSolvers Initialises the solvers
The actual force solver.
Definition: ForceSolver.hpp:43
void runSimulation()
runSimulation Runs the main Simulation loop
void addBioSolver(const std::string &name)
Adds a BioSolver.
the main simulation class
const solver::ForceSolver & getForceSolver(void)
getForceSolver Returns a reference to the solver::ForceSolver
void writeSimulation(const std::string &forceFileName, const std::string &geometryFileName, const std::string &parameterFileName, const std::string &solverFileName) const
writes the simulation to the files
void initForceSolver(const std::string &fileName)
Inits the Force solver to calculate the forces on the geometry nodes.
the report handler which stores the reporters
class responsible for generating the internal geometry representation