aslLBGK.h
Go to the documentation of this file.
/*
* Advanced Simulation Library <http://asl.org.il>
*
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
*
*
* This file is part of Advanced Simulation Library (ASL).
*
* ASL is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3 of the License.
*
* ASL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with ASL. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ASLLBGK_H
#define ASLLBGK_H
#include "aslSingleKernelNM.h"
#include <acl/aclHardware.h>
#include <math/aslVectors.h>
#include "acl/aclMath/aclVectorOfElementsDef.h"
#include "acl/aclMath/aclMatrixOfElements.h"
namespace asl
{
class Block;
class VectorTemplate;
template <typename V> class DataWithGhostNodes;
typedef DataWithGhostNodes<acl::VectorOfElements> DataWithGhostNodesACL;
typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
typedef std::shared_ptr<DataWithGhostNodesACL> SPDataWithGhostNodesACL;
typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
class AbstractDataWithGhostNodes;
typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
acl::VectorOfElements computeRho(acl::VectorOfElements f, const VectorTemplate* vt);
acl::VectorOfElements computeMomentum(acl::VectorOfElements f, const VectorTemplate* vt);
acl::VectorOfElements generateInverceVector(acl::VectorOfElements f, const VectorTemplate* vt);
acl::MatrixOfElements generateLBGKMatrix(acl::VectorOfElements nu);
acl::MatrixOfElements generateMRTMatrix(acl::VectorOfElements nu);
acl::MatrixOfElements generateDifKinMatrix(acl::VectorOfElements nu);
class LBGK: public SingleKernelNM
{
public:
typedef SPDataWithGhostNodesACL Data;
typedef SPDataWithGhostNodesACLData DataD;
typedef acl::VectorOfElements Param;
const VectorTemplate* vectorTemplate;
protected:
acl::VectorOfElementsData fPool;
Data f;
DataD v;
DataD rho;
std::shared_ptr<AVec<int>> fShifts;
std::shared_ptr<AVec<int>> fShiftsIncrement;
std::vector<acl::SPKernel> copyKernels;
Param viscosity;
Param deltat;
Param force;
Param omega;
bool flagComputeVelocity;
bool flagComputeRho;
bool flagCompressible;
void createData(Block b, acl::CommandQueue queue, acl::TypeID type);
void createCopyKernels();
virtual void preProcessing();
virtual void init0();
public:
LBGK();
LBGK(DataD v, Param nu, const VectorTemplate* vT);
LBGK(Block b, Param nu, const VectorTemplate* vT,
bool compVel=true, bool compRho=true,
acl::CommandQueue queue = acl::hardware.defaultQueue);
void setViscosity(Param nu);
double getViscosity(unsigned int i = 0);
void setOmega(Param w);
void setVectorTemplate(const VectorTemplate* vT);
inline const VectorTemplate* getVectorTemplate() const;
inline Data getF();
inline DataD getRho();
inline DataD getVelocity();
inline void setCompressible(bool flag = true);
inline const bool & getCompressible() const;
};
typedef std::shared_ptr<LBGK> SPLBGK;
class LBGKUtilities
{
private:
typedef acl::VectorOfElements Param;
SPLBGK num;
acl::SPKernel kernelComputeV;
acl::SPKernel kernelComputeRho;
acl::SPKernel kernelComputeRhoV;
acl::SPKernel kernelInitF;
Param velocity;
Param rho;
public:
LBGKUtilities(SPLBGK lbgk);
void computeRho();
void computeVelocity();
void computeRhoVelocity();
void initF(Param rho, Param vel);
void initF(Param vel);
};
typedef std::shared_ptr<LBGKUtilities> SPLBGKUtilities;
class LBGKTurbulence: public LBGK
{
public:
LBGKTurbulence(DataD v, Param nu, const VectorTemplate* vT);
LBGKTurbulence(Block b, Param nu, const VectorTemplate* vT,
bool compVel=true, bool compRho=true,
acl::CommandQueue queue = acl::hardware.defaultQueue);
virtual void init0();
};
typedef std::shared_ptr<LBGKTurbulence> SPLBGKTurbulence;
// ------------------------- Implementation ------------------------
inline LBGK::Data LBGK::getF()
{
return f;
}
inline LBGK::DataD LBGK::getRho()
{
return rho;
}
inline LBGK::DataD LBGK::getVelocity()
{
return v;
}
inline const VectorTemplate* LBGK::getVectorTemplate() const
{
return vectorTemplate;
}
inline void LBGK::setCompressible(bool flag)
{
flagCompressible=flag;
}
inline const bool & LBGK::getCompressible() const
{
return flagCompressible;
}
} // asl
#endif // ASLLBGK_H
acl::MatrixOfElements
The class represents a matrix elements of Element.
Definition: aclMatrixOfElements.h:36
acl::VectorOfElementsData
The class represents several ElementData.
Definition: aclVectorOfElementsDef.h:57
acl::VectorOfElements
The class represents several Element.
Definition: aclVectorOfElementsDef.h:92
asl::Block
Definition: aslBlocks.h:57
asl::LBGK
Numerical method for fluid flow.
Definition: aslLBGK.h:78
asl::LBGK::getVectorTemplate
const VectorTemplate * getVectorTemplate() const
asl::LBGK::getVelocity
DataD getVelocity()
Definition: aslLBGK.h:188
asl::LBGK::setViscosity
void setViscosity(Param nu)
asl::LBGK::getVectorTemplate
const VectorTemplate * getVectorTemplate() const
Definition: aslLBGK.h:193
asl::LBGK::getF
Data getF()
asl::LBGK::omega
Param omega
Definition: aslLBGK.h:99
asl::LBGK::getVelocity
DataD getVelocity()
asl::LBGK::LBGK
LBGK(DataD v, Param nu, const VectorTemplate *vT)
asl::LBGK::init0
virtual void init0()
full initialisation but without kernel->setup()
asl::LBGK::flagComputeRho
bool flagComputeRho
Definition: aslLBGK.h:102
asl::LBGK::v
DataD v
Definition: aslLBGK.h:88
asl::LBGK::vectorTemplate
const VectorTemplate * vectorTemplate
Definition: aslLBGK.h:84
asl::LBGK::flagCompressible
bool flagCompressible
Definition: aslLBGK.h:103
asl::LBGK::getCompressible
const bool & getCompressible() const
asl::LBGK::preProcessing
virtual void preProcessing()
contains classical moving procedure
asl::LBGK::force
Param force
Definition: aslLBGK.h:98
asl::LBGK::createCopyKernels
void createCopyKernels()
asl::LBGK::computeRho
acl::VectorOfElements computeRho(acl::VectorOfElements f, const VectorTemplate *vt)
returns VectorOfElements with values of rho
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::fPool
acl::VectorOfElementsData fPool
Definition: aslLBGK.h:86
asl::LBGK::flagComputeVelocity
bool flagComputeVelocity
Definition: aslLBGK.h:101
asl::LBGK::LBGK
LBGK()
asl::LBGK::computeMomentum
acl::VectorOfElements computeMomentum(acl::VectorOfElements f, const VectorTemplate *vt)
returns VectorOfElements with values of velocity
asl::LBGK::Param
acl::VectorOfElements Param
Definition: aslLBGK.h:82
asl::LBGK::viscosity
Param viscosity
Definition: aslLBGK.h:96
asl::LBGK::getViscosity
double getViscosity(unsigned int i=0)
asl::LBGK::copyKernels
std::vector< acl::SPKernel > copyKernels
Definition: aslLBGK.h:94
asl::LBGK::fShifts
std::shared_ptr< AVec< int > > fShifts
Definition: aslLBGK.h:91
asl::LBGK::deltat
Param deltat
Definition: aslLBGK.h:97
asl::LBGK::setVectorTemplate
void setVectorTemplate(const VectorTemplate *vT)
asl::LBGK::getRho
DataD getRho()
Definition: aslLBGK.h:183
asl::LBGK::getRho
DataD getRho()
asl::LBGK::fShiftsIncrement
std::shared_ptr< AVec< int > > fShiftsIncrement
Definition: aslLBGK.h:92
asl::LBGK::getF
Data getF()
Definition: aslLBGK.h:178
asl::LBGK::DataD
SPDataWithGhostNodesACLData DataD
Definition: aslLBGK.h:81
asl::LBGK::createData
void createData(Block b, acl::CommandQueue queue, acl::TypeID type)
asl::LBGK::rho
DataD rho
Definition: aslLBGK.h:89
asl::LBGK::getCompressible
const bool & getCompressible() const
Definition: aslLBGK.h:203
asl::LBGK::f
Data f
Definition: aslLBGK.h:87
asl::LBGK::setCompressible
void setCompressible(bool flag=true)
asl::LBGK::setOmega
void setOmega(Param w)
sets angular velocity for Coriolis term in noninertial reference frame
asl::LBGK::Data
SPDataWithGhostNodesACL Data
Definition: aslLBGK.h:80
asl::LBGKTurbulence
Definition: aslLBGK.h:164
asl::LBGKTurbulence::init0
virtual void init0()
full initialisation but without kernel->setup()
asl::LBGKTurbulence::LBGKTurbulence
LBGKTurbulence(Block b, Param nu, const VectorTemplate *vT, bool compVel=true, bool compRho=true, acl::CommandQueue queue=acl::hardware.defaultQueue)
asl::LBGKTurbulence::LBGKTurbulence
LBGKTurbulence(DataD v, Param nu, const VectorTemplate *vT)
asl::LBGKUtilities
contains different kernels for preprocessing and posprocessing of data used by LBGK
Definition: aslLBGK.h:138
asl::LBGKUtilities::computeRho
void computeRho()
asl::LBGKUtilities::computeRhoVelocity
void computeRhoVelocity()
asl::LBGKUtilities::initF
void initF(Param rho, Param vel)
asl::LBGKUtilities::computeVelocity
void computeVelocity()
asl::LBGKUtilities::LBGKUtilities
LBGKUtilities(SPLBGK lbgk)
asl::LBGKUtilities::initF
void initF(Param vel)
dencity is suposed to be 1
asl::SingleKernelNM
Definition: aslSingleKernelNM.h:47
asl::UValue< FlT >
asl::VectorTemplate
Defines set of vectros with several properties.
Definition: aslTemplates.h:88
type
acl::TypeID type(acl::typeToTypeID< FlT >())
acl::CommandQueue
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
acl::hardware
Hardware hardware
Definition: aclHardware.h:163
acl::TypeID
TypeID
Definition: aclTypes.h:39
acl::SPKernel
std::shared_ptr< Kernel > SPKernel
Definition: aclKernelMerger.h:34
asl
Advanced Simulation Library.
Definition: aslDataInc.h:31
asl::DataWithGhostNodesACLData
DataWithGhostNodes< acl::VectorOfElementsData > DataWithGhostNodesACLData
Definition: aslGenerators.h:45
asl::generateLBGKMatrix
acl::MatrixOfElements generateLBGKMatrix(acl::VectorOfElements nu)
asl::SPAbstractDataWithGhostNodes
std::shared_ptr< AbstractDataWithGhostNodes > SPAbstractDataWithGhostNodes
Definition: aslGenerators.h:50
asl::generateDifKinMatrix
acl::MatrixOfElements generateDifKinMatrix(acl::VectorOfElements nu)
asl::generateInverceVector
acl::VectorOfElements generateInverceVector(acl::VectorOfElements f, const VectorTemplate *vt)
generates Vector Of Elements with inverce components according to vt
asl::DataWithGhostNodesACL
DataWithGhostNodes< acl::VectorOfElements > DataWithGhostNodesACL
Definition: aslGenerators.h:48
asl::SPDataWithGhostNodesACL
std::shared_ptr< DataWithGhostNodesACL > SPDataWithGhostNodesACL
Definition: aslGenerators.h:49
asl::SPDataWithGhostNodesACLData
std::shared_ptr< DataWithGhostNodesACLData > SPDataWithGhostNodesACLData
Definition: aslGenerators.h:47
asl::generateMRTMatrix
acl::MatrixOfElements generateMRTMatrix(acl::VectorOfElements nu)
asl::SPLBGK
std::shared_ptr< LBGK > SPLBGK
Definition: aslLBGK.h:133
asl::SPLBGKTurbulence
std::shared_ptr< LBGKTurbulence > SPLBGKTurbulence
Definition: aslLBGK.h:173
asl::SPLBGKUtilities
std::shared_ptr< LBGKUtilities > SPLBGKUtilities
Definition: aslLBGK.h:161
aslSingleKernelNM.h