ASL  0.1.7
Advanced Simulation Library
aslLBGK.h
Go to the documentation of this file.
1 /*
2  * Advanced Simulation Library <http://asl.org.il>
3  *
4  * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5  *
6  *
7  * This file is part of Advanced Simulation Library (ASL).
8  *
9  * ASL is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU Affero General Public License as
11  * published by the Free Software Foundation, version 3 of the License.
12  *
13  * ASL is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Affero General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 
24 #ifndef ASLLBGK_H
25 #define ASLLBGK_H
26 
27 #include "aslSingleKernelNM.h"
28 #include <acl/aclHardware.h>
29 #include <math/aslVectors.h>
32 
33 namespace asl
34 {
35  class Block;
36  class VectorTemplate;
37  template <typename V> class DataWithGhostNodes;
38  typedef DataWithGhostNodes<acl::VectorOfElements> DataWithGhostNodesACL;
39  typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
40  typedef std::shared_ptr<DataWithGhostNodesACL> SPDataWithGhostNodesACL;
41  typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
42  class AbstractDataWithGhostNodes;
43  typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
44 
45 
47 
53  acl::VectorOfElements computeRho(acl::VectorOfElements f, const VectorTemplate* vt);
54 
56 
62  acl::VectorOfElements computeMomentum(acl::VectorOfElements f, const VectorTemplate* vt);
63 
66 
69 
71 
73 
77  class LBGK: public SingleKernelNM
78  {
79  public:
83 
85  protected:
90 
91  std::shared_ptr<AVec<int>> fShifts;
92  std::shared_ptr<AVec<int>> fShiftsIncrement;
93 
94  std::vector<acl::SPKernel> copyKernels;
95 
100 
104 
106  void createCopyKernels();
108  virtual void preProcessing();
109  virtual void init0();
110 
111  public:
112  LBGK();
113  LBGK(DataD v, Param nu, const VectorTemplate* vT);
114  LBGK(Block b, Param nu, const VectorTemplate* vT,
115  bool compVel=true, bool compRho=true,
116  acl::CommandQueue queue = acl::hardware.defaultQueue);
117  void setViscosity(Param nu);
118  double getViscosity(unsigned int i = 0);
120  void setOmega(Param w);
121  void setVectorTemplate(const VectorTemplate* vT);
122  inline const VectorTemplate* getVectorTemplate() const;
123 
124 
125  inline Data getF();
126  inline DataD getRho();
127  inline DataD getVelocity();
128 
129  inline void setCompressible(bool flag = true);
130  inline const bool & getCompressible() const;
131  };
132 
133  typedef std::shared_ptr<LBGK> SPLBGK;
134 
135 
138  {
139  private:
141 
142  SPLBGK num;
143  acl::SPKernel kernelComputeV;
144  acl::SPKernel kernelComputeRho;
145  acl::SPKernel kernelComputeRhoV;
146  acl::SPKernel kernelInitF;
147 
148  Param velocity;
149  Param rho;
150 
151  public:
152  LBGKUtilities(SPLBGK lbgk);
153  void computeRho();
154  void computeVelocity();
155  void computeRhoVelocity();
156  void initF(Param rho, Param vel);
158  void initF(Param vel);
159  };
160 
161  typedef std::shared_ptr<LBGKUtilities> SPLBGKUtilities;
162 
163  class LBGKTurbulence: public LBGK
164  {
165  public:
166  LBGKTurbulence(DataD v, Param nu, const VectorTemplate* vT);
167  LBGKTurbulence(Block b, Param nu, const VectorTemplate* vT,
168  bool compVel=true, bool compRho=true,
169  acl::CommandQueue queue = acl::hardware.defaultQueue);
170  virtual void init0();
171  };
172 
173  typedef std::shared_ptr<LBGKTurbulence> SPLBGKTurbulence;
174 
175 // ------------------------- Implementation ------------------------
176 
177 
179  {
180  return f;
181  }
182 
184  {
185  return rho;
186  }
187 
189  {
190  return v;
191  }
192 
194  {
195  return vectorTemplate;
196  }
197 
198  inline void LBGK::setCompressible(bool flag)
199  {
200  flagCompressible=flag;
201  }
202 
203  inline const bool & LBGK::getCompressible() const
204  {
205  return flagCompressible;
206  }
207 
208 } // asl
209 #endif // ASLLBGK_H
void setVectorTemplate(const VectorTemplate *vT)
virtual void init0()
full initialisation but without kernel->setup()
DataD v
Definition: aslLBGK.h:88
void createCopyKernels()
acl::VectorOfElements generateInverceVector(acl::VectorOfElements f, const VectorTemplate *vt)
generates Vector Of Elements with inverce components according to vt
Advanced Simulation Library.
Definition: aslDataInc.h:30
std::shared_ptr< Kernel > SPKernel
std::shared_ptr< LBGKTurbulence > SPLBGKTurbulence
Definition: aslLBGK.h:173
Numerical method for fluid flow.
Definition: aslLBGK.h:77
std::shared_ptr< DataWithGhostNodesACLData > SPDataWithGhostNodesACLData
Definition: aslGenerators.h:47
acl::MatrixOfElements generateDifKinMatrix(acl::VectorOfElements nu)
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
void setCompressible(bool flag=true)
Definition: aslLBGK.h:198
bool flagComputeVelocity
Definition: aslLBGK.h:101
Param force
Definition: aslLBGK.h:98
bool flagCompressible
Definition: aslLBGK.h:103
acl::MatrixOfElements generateLBGKMatrix(acl::VectorOfElements nu)
The class represents several ElementData.
DataWithGhostNodes< acl::VectorOfElementsData > DataWithGhostNodesACLData
Definition: aslGenerators.h:45
Param omega
Definition: aslLBGK.h:99
DataD getVelocity()
Definition: aslLBGK.h:188
Param deltat
Definition: aslLBGK.h:97
acl::MatrixOfElements generateMRTMatrix(acl::VectorOfElements nu)
Data getF()
Definition: aslLBGK.h:178
DataD getRho()
Definition: aslLBGK.h:183
The class represents a matrix elements of Element.
std::shared_ptr< LBGKUtilities > SPLBGKUtilities
Definition: aslLBGK.h:161
std::shared_ptr< LBGK > SPLBGK
Definition: aslLBGK.h:133
acl::VectorOfElements Param
Definition: aslLBGK.h:82
LBGKUtilities(SPLBGK lbgk)
acl::TypeID type(acl::typeToTypeID< FlT >())
The class represents several Element.
double getViscosity(unsigned int i=0)
const VectorTemplate * vectorTemplate
Definition: aslLBGK.h:84
DataD rho
Definition: aslLBGK.h:89
Data f
Definition: aslLBGK.h:87
virtual void preProcessing()
contains classical moving procedure
virtual void init0()
full initialisation but without kernel->setup()
definition of class АVec<T>
void setViscosity(Param nu)
bool flagComputeRho
Definition: aslLBGK.h:102
std::shared_ptr< AVec< int > > fShifts
Definition: aslLBGK.h:91
Param viscosity
Definition: aslLBGK.h:96
void initF(Param rho, Param vel)
SPDataWithGhostNodesACLData DataD
Definition: aslLBGK.h:81
acl::VectorOfElementsData fPool
Definition: aslLBGK.h:86
TypeID
Definition: aclTypes.h:38
std::shared_ptr< AbstractDataWithGhostNodes > SPAbstractDataWithGhostNodes
Definition: aslGenerators.h:50
std::shared_ptr< AVec< int > > fShiftsIncrement
Definition: aslLBGK.h:92
const VectorTemplate * getVectorTemplate() const
Definition: aslLBGK.h:193
SPDataWithGhostNodesACL Data
Definition: aslLBGK.h:80
DataWithGhostNodes< acl::VectorOfElements > DataWithGhostNodesACL
Definition: aslGenerators.h:48
std::shared_ptr< DataWithGhostNodesACL > SPDataWithGhostNodesACL
Definition: aslGenerators.h:49
void createData(Block b, acl::CommandQueue queue, acl::TypeID type)
Defines set of vectros with several properties.
Definition: aslTemplates.h:87
std::vector< acl::SPKernel > copyKernels
Definition: aslLBGK.h:94
LBGKTurbulence(DataD v, Param nu, const VectorTemplate *vT)
const bool & getCompressible() const
Definition: aslLBGK.h:203
void setOmega(Param w)
sets angular velocity for Coriolis term in noninertial reference frame
contains different kernels for preprocessing and posprocessing of data used by LBGK
Definition: aslLBGK.h:137
Hardware hardware