$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

guoOffLatticeModel3D.h

Go to the documentation of this file.
00001 /* This file is part of the Palabos library.
00002  *
00003  * Copyright (C) 2011 FlowKit Sarl
00004  * Avenue de Chailly 23
00005  * 1012 Lausanne, Switzerland
00006  * E-mail contact: contact@flowkit.com
00007  *
00008  * The most recent release of Palabos can be downloaded at 
00009  * <http://www.palabos.org/>
00010  *
00011  * The library Palabos is free software: you can redistribute it and/or
00012  * modify it under the terms of the GNU Affero General Public License as
00013  * published by the Free Software Foundation, either version 3 of the
00014  * License, or (at your option) any later version.
00015  *
00016  * The library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Affero General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Affero General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 #ifndef GUO_OFF_LATTICE_MODEL_3D_H
00026 #define GUO_OFF_LATTICE_MODEL_3D_H
00027 
00028 #include "core/globalDefs.h"
00029 #include "offLattice/offLatticeModel3D.h"
00030 
00031 namespace plb {
00032 
00033 template<typename T, template<typename U> class Descriptor>
00034 class GuoOffLatticeModel3D : public OffLatticeModel3D<T,Array<T,3> >
00035 {
00036 public:
00037     GuoOffLatticeModel3D(BoundaryShape3D<T,Array<T,3> >* shape_, int flowType_, bool useAllDirections_=true);
00038     virtual GuoOffLatticeModel3D<T,Descriptor>* clone() const;
00039     virtual plint getNumNeighbors() const;
00040     virtual void prepareCell (
00041             Dot3D const& cellLocation, AtomicContainerBlock3D& container );
00042     virtual void boundaryCompletion (
00043             AtomicBlock3D& lattice, AtomicContainerBlock3D& container,
00044             std::vector<AtomicBlock3D const*> const& args );
00045     virtual ContainerBlockData* generateOffLatticeInfo() const;
00046     virtual Array<T,3> getLocalForce(AtomicContainerBlock3D& container) const;
00047     void selectSecondOrder(bool flag) { secondOrderFlag = flag; }
00048     bool usesSecondOrder() const { return secondOrderFlag; }
00049     void selectUseRegularizedModel(bool flag) { regularizedModel = flag; }
00050     bool usesRegularizedModel() const { return regularizedModel; }
00051     void selectComputeStat(bool flag) { computeStat = flag; }
00052     bool computesStat() const { return computeStat; }
00053 private:
00054     void cellCompletion (
00055             BlockLattice3D<T,Descriptor>& lattice,
00056             Dot3D const& guoNode,
00057             std::vector<std::pair<int,int> > const& dryNodeFluidDirections,
00058             std::vector<plint> const& dryNodeIds, Dot3D const& absoluteOffset,
00059             Array<T,3>& localForce, std::vector<AtomicBlock3D const*> const& args );
00060     void computeRhoBarJPiNeq (
00061               BlockLattice3D<T,Descriptor> const& lattice, Dot3D const& guoNode,
00062               Dot3D const& fluidDirection, int depth, Array<T,3> const& wallNode, T delta,
00063               Array<T,3> const& wall_vel, OffBoundary::Type bdType,
00064               Array<T,3> const& wallNormal, plint triangleId,
00065               T& rhoBar, Array<T,Descriptor<T>::d>& j,
00066               Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq,
00067               std::vector<AtomicBlock3D const*> const& args ) const;
00068     void computeRhoBarJfNeq (
00069               BlockLattice3D<T,Descriptor> const& lattice, Dot3D const& guoNode,
00070               Dot3D const& fluidDirection, int depth, Array<T,3> const& wallNode, T delta,
00071               Array<T,3> const& wall_vel, OffBoundary::Type bdType,
00072               Array<T,3> const& wallNormal, plint triangleId,
00073               T& rhoBar, Array<T,Descriptor<T>::d>& j,
00074               Array<T,Descriptor<T>::q>& fNeq,
00075               std::vector<AtomicBlock3D const*> const& args ) const;
00076 private:
00077     bool useAllDirections;
00078     bool regularizedModel;
00079     bool secondOrderFlag;
00080     bool computeStat;
00081 private:
00084     class GuoOffLatticeInfo3D : public ContainerBlockData {
00085     public:
00086         std::vector<Dot3D> const&                               getDryNodes() const
00087         { return dryNodes; }
00088         std::vector<Dot3D>&                                     getDryNodes()
00089         { return dryNodes; }
00090         std::vector<std::vector<std::pair<int,int> > > const&   getDryNodeFluidDirections() const
00091         { return dryNodeFluidDirections; }
00092         std::vector<std::vector<std::pair<int,int> > >&         getDryNodeFluidDirections()
00093         { return dryNodeFluidDirections; }
00094         std::vector<std::vector<plint> > const&                 getDryNodeIds() const
00095         { return dryNodeIds; }
00096         std::vector<std::vector<plint> >&                       getDryNodeIds()
00097         { return dryNodeIds; }
00098         std::vector<bool> const&                                getIsConnected() const
00099         { return isConnected; }
00100         std::vector<bool>&                                      getIsConnected()
00101         { return isConnected; }
00102         Array<T,3> const&                                       getLocalForce() const
00103         { return localForce; }
00104         Array<T,3>&                                             getLocalForce()
00105         { return localForce; }
00106         virtual GuoOffLatticeInfo3D* clone() const {
00107             return new GuoOffLatticeInfo3D(*this);
00108         }
00109     private:
00110         std::vector<Dot3D> dryNodes;
00111         std::vector<std::vector<std::pair<int,int> > >   dryNodeFluidDirections;
00112         std::vector<std::vector<plint> >                 dryNodeIds;
00113         std::vector<bool>                                isConnected;
00114         Array<T,3>                                       localForce;
00115     };
00116 
00117     struct LiquidNeighbor {
00118         LiquidNeighbor(plint iNeighbor_, plint depth_, plint iTriangle_, Array<T,3> wallNormal);
00119         bool operator<(LiquidNeighbor const& rhs) const;
00120         plint iNeighbor, depth;
00121         plint iTriangle;
00122         T cosAngle;
00123     };
00124 };
00125 
00126 }  // namespace plb
00127 
00128 #endif  // GUO_OFF_LATTICE_MODEL_3D_H