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 
54 
56 
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 
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);
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:
153  void computeRho();
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:
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
asl::LBGK::force
Param force
Definition: aslLBGK.h:98
asl::DataWithGhostNodesACL
DataWithGhostNodes< acl::VectorOfElements > DataWithGhostNodesACL
Definition: aslGenerators.h:48
asl::generateInverceVector
acl::VectorOfElements generateInverceVector(acl::VectorOfElements f, const VectorTemplate *vt)
generates Vector Of Elements with inverce components according to vt
asl::LBGKUtilities::LBGKUtilities
LBGKUtilities(SPLBGK lbgk)
asl::LBGK::getViscosity
double getViscosity(unsigned int i=0)
aclMatrixOfElements.h
asl::LBGK::Param
acl::VectorOfElements Param
Definition: aslLBGK.h:82
asl::LBGKUtilities::computeRho
void computeRho()
asl::LBGK
Numerical method for fluid flow.
Definition: aslLBGK.h:78
asl::LBGK::setVectorTemplate
void setVectorTemplate(const VectorTemplate *vT)
asl::LBGK::vectorTemplate
const VectorTemplate * vectorTemplate
Definition: aslLBGK.h:84
asl::LBGK::rho
DataD rho
Definition: aslLBGK.h:89
acl::VectorOfElementsData
The class represents several ElementData.
Definition: aclVectorOfElementsDef.h:57
asl::SPDataWithGhostNodesACLData
std::shared_ptr< DataWithGhostNodesACLData > SPDataWithGhostNodesACLData
Definition: aslGenerators.h:47
asl::generateDifKinMatrix
acl::MatrixOfElements generateDifKinMatrix(acl::VectorOfElements nu)
asl::LBGK::Data
SPDataWithGhostNodesACL Data
Definition: aslLBGK.h:80
acl::SPKernel
std::shared_ptr< Kernel > SPKernel
Definition: aclKernelMerger.h:34
asl::SPLBGKTurbulence
std::shared_ptr< LBGKTurbulence > SPLBGKTurbulence
Definition: aslLBGK.h:173
asl::generateLBGKMatrix
acl::MatrixOfElements generateLBGKMatrix(acl::VectorOfElements nu)
acl::MatrixOfElements
The class represents a matrix elements of Element.
Definition: aclMatrixOfElements.h:36
asl::LBGK::fPool
acl::VectorOfElementsData fPool
Definition: aslLBGK.h:86
asl::SPLBGKUtilities
std::shared_ptr< LBGKUtilities > SPLBGKUtilities
Definition: aslLBGK.h:161
asl::LBGK::getF
Data getF()
Definition: aslLBGK.h:178
asl::LBGK::computeMomentum
acl::VectorOfElements computeMomentum(acl::VectorOfElements f, const VectorTemplate *vt)
returns VectorOfElements with values of velocity
asl::LBGK::flagComputeVelocity
bool flagComputeVelocity
Definition: aslLBGK.h:101
asl::LBGKTurbulence::LBGKTurbulence
LBGKTurbulence(Block b, Param nu, const VectorTemplate *vT, bool compVel=true, bool compRho=true, acl::CommandQueue queue=acl::hardware.defaultQueue)
asl::LBGK::flagCompressible
bool flagCompressible
Definition: aslLBGK.h:103
asl::LBGK::v
DataD v
Definition: aslLBGK.h:88
asl::LBGK::createCopyKernels
void createCopyKernels()
asl::LBGK::LBGK
LBGK(DataD v, Param nu, const VectorTemplate *vT)
acl::CommandQueue
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
asl::DataWithGhostNodesACLData
DataWithGhostNodes< acl::VectorOfElementsData > DataWithGhostNodesACLData
Definition: aslGenerators.h:45
asl::SPLBGK
std::shared_ptr< LBGK > SPLBGK
Definition: aslLBGK.h:133
asl::LBGK::LBGK
LBGK(Block b, Param nu, const VectorTemplate *vT, bool compVel=true, bool compRho=true, acl::CommandQueue queue=acl::hardware.defaultQueue)
asl::LBGK::deltat
Param deltat
Definition: aslLBGK.h:97
asl::LBGK::getCompressible
const bool & getCompressible() const
Definition: aslLBGK.h:203
asl::LBGKUtilities::computeVelocity
void computeVelocity()
aclHardware.h
asl::LBGK::setOmega
void setOmega(Param w)
sets angular velocity for Coriolis term in noninertial reference frame
asl::LBGK::viscosity
Param viscosity
Definition: aslLBGK.h:96
asl::LBGKUtilities
contains different kernels for preprocessing and posprocessing of data used by LBGK
Definition: aslLBGK.h:138
acl::VectorOfElements
The class represents several Element.
Definition: aclVectorOfElementsDef.h:92
asl::Block
Definition: aslBlocks.h:57
asl::LBGKUtilities::initF
void initF(Param rho, Param vel)
asl::LBGK::setViscosity
void setViscosity(Param nu)
asl::generateMRTMatrix
acl::MatrixOfElements generateMRTMatrix(acl::VectorOfElements nu)
asl::LBGK::init0
virtual void init0()
full initialisation but without kernel->setup()
asl::LBGK::createData
void createData(Block b, acl::CommandQueue queue, acl::TypeID type)
asl::LBGK::LBGK
LBGK()
asl::LBGKUtilities::computeRhoVelocity
void computeRhoVelocity()
aslVectors.h
definition of class АVec<T>
asl::LBGKUtilities::initF
void initF(Param vel)
dencity is suposed to be 1
asl::LBGK::fShifts
std::shared_ptr< AVec< int > > fShifts
Definition: aslLBGK.h:91
asl::LBGKTurbulence::LBGKTurbulence
LBGKTurbulence(DataD v, Param nu, const VectorTemplate *vT)
asl::LBGK::omega
Param omega
Definition: aslLBGK.h:99
asl::LBGKTurbulence::init0
virtual void init0()
full initialisation but without kernel->setup()
aclVectorOfElementsDef.h
asl::LBGK::getVectorTemplate
const VectorTemplate * getVectorTemplate() const
Definition: aslLBGK.h:193
asl::SingleKernelNM
Definition: aslSingleKernelNM.h:47
asl::VectorTemplate
Defines set of vectros with several properties.
Definition: aslTemplates.h:88
acl::hardware
Hardware hardware
asl::LBGK::setCompressible
void setCompressible(bool flag=true)
Definition: aslLBGK.h:198
asl::LBGK::preProcessing
virtual void preProcessing()
contains classical moving procedure
asl::LBGK::flagComputeRho
bool flagComputeRho
Definition: aslLBGK.h:102
aslSingleKernelNM.h
acl::TypeID
TypeID
Definition: aclTypes.h:39
asl::LBGK::getVelocity
DataD getVelocity()
Definition: aslLBGK.h:188
asl::LBGKTurbulence
Definition: aslLBGK.h:164
asl::LBGK::f
Data f
Definition: aslLBGK.h:87
asl::LBGK::fShiftsIncrement
std::shared_ptr< AVec< int > > fShiftsIncrement
Definition: aslLBGK.h:92
asl::SPDataWithGhostNodesACL
std::shared_ptr< DataWithGhostNodesACL > SPDataWithGhostNodesACL
Definition: aslGenerators.h:49
asl::LBGK::computeRho
acl::VectorOfElements computeRho(acl::VectorOfElements f, const VectorTemplate *vt)
returns VectorOfElements with values of rho
asl::LBGK::getRho
DataD getRho()
Definition: aslLBGK.h:183
asl
Advanced Simulation Library.
Definition: aslDataInc.h:31
asl::LBGK::DataD
SPDataWithGhostNodesACLData DataD
Definition: aslLBGK.h:81
type
acl::TypeID type(acl::typeToTypeID< FlT >())
asl::LBGK::copyKernels
std::vector< acl::SPKernel > copyKernels
Definition: aslLBGK.h:94
asl::SPAbstractDataWithGhostNodes
std::shared_ptr< AbstractDataWithGhostNodes > SPAbstractDataWithGhostNodes
Definition: aslGenerators.h:50