LBIBCell
 All Classes Functions Variables Friends Pages
CDESolverD2Q5.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 CDESOLVERD2Q5_HPP
23 #define CDESOLVERD2Q5_HPP
24 
25 #include <LbmLib/include/solver/CDESolver/CDEAbstractSolver.hpp>
26 #include <array>
27 #include <string>
28 #include <iomanip>
29 
30 namespace LbmLib {
31 namespace solver {
35 class CDESolverD2Q5 : public BaseCDESolver<CDESolverD2Q5> {
36  public:
40  virtual ~CDESolverD2Q5() {}
41 
45  virtual void collide();
46 
50  virtual void advect();
51 
55  virtual void initSolver();
56 
62  virtual double calculateEquilibrium(const Direction& dir);
63 
69  virtual double& accessDistribution(const Direction& dir);
70 
75  virtual void rescaleDistributions(const double factor);
76 
81  virtual double getC() const;
82 
86  virtual void reinitialise();
87 
92  virtual void loadSolver(std::stringstream* const stream);
93 
98  virtual void writeSolver(std::ostream* const stream);
99 
100  private:
104  friend class BaseCDESolver;
108  CDESolverD2Q5();
112  void localSwap();
113 
117  std::array<double, 5> distributions_;
118 
122  static const CDEDirectionsIteratorD2Q5 cdeDirIter_;
126  static const std::string name;
127 };
128 }
129 } // end namespace
130 
131 #endif // CDESOLVERD2Q5_HPP
virtual void loadSolver(std::stringstream *const stream)
loads the solver from the file
The Base class for all CDESolver implementations This classes uses the recursive template idiom to au...
virtual double getC() const
getC Calculates the concentration on this node
virtual ~CDESolverD2Q5()
~CDESolverD2Q5 virtual Destructor
The CDEDirectionsIteratorD2Q5 class Provides methods to handle the Directions. Use the Function Direc...
Definition: Direction.hpp:126
virtual void initSolver()
initSolver Use this to initalise the solver
virtual void collide()
collide The collision step of the LBM
the cde solver for the D2Q5 grid
virtual void reinitialise()
reinitialise this solver iff the corresponding physical node has switched domain
virtual void writeSolver(std::ostream *const stream)
writes the solver to the file
virtual double calculateEquilibrium(const Direction &dir)
calculateEquilibrium calculates the equilibirum for direction dir
virtual void rescaleDistributions(const double factor)
Rescales all distributions by a factor.
virtual void advect()
advect The advect step of the LBM
virtual double & accessDistribution(const Direction &dir)
accessDistribution Access to the distribution