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

generalizedOffLatticeModel3D.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 GENERALIZED_OFF_LATTICE_MODEL_3D_H
00026 #define GENERALIZED_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 ExtrapolatedGeneralizedOffLatticeModel3D : public OffLatticeModel3D<T,Array<T,3> >
00035 {
00036 public:
00037     ExtrapolatedGeneralizedOffLatticeModel3D(BoundaryShape3D<T,Array<T,3> >* shape_, int flowType_);
00038     ExtrapolatedGeneralizedOffLatticeModel3D(ExtrapolatedGeneralizedOffLatticeModel3D<T,Descriptor> const& rhs);
00039     ExtrapolatedGeneralizedOffLatticeModel3D<T,Descriptor>& operator=(ExtrapolatedGeneralizedOffLatticeModel3D<T,Descriptor> const& rhs);
00040     virtual ExtrapolatedGeneralizedOffLatticeModel3D<T,Descriptor>* clone() const;
00041     virtual plint getNumNeighbors() const;
00042     virtual void prepareCell (
00043             Dot3D const& cellLocation, AtomicContainerBlock3D& container );
00044     virtual void boundaryCompletion (
00045             AtomicBlock3D& lattice, AtomicContainerBlock3D& container,
00046             std::vector<AtomicBlock3D const*> const& args );
00047     virtual ContainerBlockData* generateOffLatticeInfo() const;
00048     virtual Array<T,3> getLocalForce(AtomicContainerBlock3D& container) const;
00049 private:
00050     void cellCompletion (
00051             BlockLattice3D<T,Descriptor>& lattice,
00052             Dot3D const& genNode,
00053             std::vector<std::pair<int,int> > const& dryNodeFluidDirections,
00054             std::vector<int > const& dryNodeFluidNoSolidDirections,
00055             std::vector<plint> const& dryNodeIds, Dot3D const& absoluteOffset,
00056             Array<T,3>& localForce );
00057     void computeVelocity (
00058               BlockLattice3D<T,Descriptor> const& lattice, Dot3D const& genNode,
00059               Dot3D const& fluidDirection, int depth, Array<T,3> const& wallNode, T delta,
00060               Array<T,3> const& wall_vel, OffBoundary::Type bdType, Array<T,3> const& wallNormal,
00061               Array<T,Descriptor<T>::d>& u) const;
00062 private:
00065     class ExtrapolatedGeneralizedOffLatticeInfo3D : public ContainerBlockData {
00066     public:
00067         std::vector<Dot3D> const&                               getDryNodes() const
00068         { return dryNodes; }
00069         std::vector<Dot3D>&                                     getDryNodes()
00070         { return dryNodes; }
00071         std::vector<std::vector<std::pair<int,int> > > const&   getDryNodeFluidDirections() const
00072         { return dryNodeFluidDirections; }
00073         std::vector<std::vector<std::pair<int,int> > >&         getDryNodeFluidDirections()
00074         { return dryNodeFluidDirections; }
00075         std::vector<std::vector<int> > const&   getDryNodeFluidWithFluidDirections() const
00076         { return dryNodeFluidNoSolidDirections; }
00077         std::vector<std::vector<int> >&         getDryNodeFluidWithFluidDirections()
00078         { return dryNodeFluidNoSolidDirections; }
00079         std::vector<std::vector<plint> > const&                 getDryNodeIds() const
00080         { return dryNodeIds; }
00081         std::vector<std::vector<plint> >&                       getDryNodeIds()
00082         { return dryNodeIds; }
00083         Array<T,3> const&                                       getLocalForce() const
00084         { return localForce; }
00085         Array<T,3>&                                             getLocalForce()
00086         { return localForce; }
00087         virtual ExtrapolatedGeneralizedOffLatticeInfo3D* clone() const {
00088             return new ExtrapolatedGeneralizedOffLatticeInfo3D(*this);
00089         }
00090     private:
00091         std::vector<Dot3D> dryNodes;
00092         std::vector<std::vector<std::pair<int,int> > >   dryNodeFluidDirections;
00093         std::vector<std::vector<int> >   dryNodeFluidNoSolidDirections;
00094         std::vector<std::vector<plint> >                 dryNodeIds;
00095         Array<T,3>                                       localForce;
00096     };
00097 };
00098 
00099 
00100 template<typename T, template<typename U> class Descriptor>
00101 class InterpolatedGeneralizedOffLatticeModel3D : public OffLatticeModel3D<T,Array<T,3> >
00102 {
00103 public:
00104     InterpolatedGeneralizedOffLatticeModel3D(BoundaryShape3D<T,Array<T,3> >* shape_, int flowType_);
00105     InterpolatedGeneralizedOffLatticeModel3D(InterpolatedGeneralizedOffLatticeModel3D<T,Descriptor> const& rhs);
00106     InterpolatedGeneralizedOffLatticeModel3D<T,Descriptor>& operator=(InterpolatedGeneralizedOffLatticeModel3D<T,Descriptor> const& rhs);
00107     virtual InterpolatedGeneralizedOffLatticeModel3D<T,Descriptor>* clone() const;
00108     virtual plint getNumNeighbors() const;
00109     virtual void prepareCell (
00110         Dot3D const& cellLocation, AtomicContainerBlock3D& container );
00111     virtual void boundaryCompletion (
00112         AtomicBlock3D& lattice, AtomicContainerBlock3D& container,
00113         std::vector<AtomicBlock3D const*> const& args );
00114     virtual ContainerBlockData* generateOffLatticeInfo() const;
00115     virtual Array<T,3> getLocalForce(AtomicContainerBlock3D& container) const;
00116 private:
00117     void cellCompletion (
00118         BlockLattice3D<T,Descriptor>& lattice,
00119         Dot3D const& genNode,
00120         std::vector<std::pair<int,int> > const& wetNodeSolidDirections,
00121         std::vector<int > const& wetNodeFluidDirections,
00122         std::vector<plint> const& wetNodeIds, Dot3D const& absoluteOffset,
00123         Array<T,3>& localForce );
00124     void computeVelocity (
00125         BlockLattice3D<T,Descriptor> const& lattice, Dot3D const& genNode,
00126         Dot3D const& soldDirection, int depth, Array<T,3> const& wallNode, T wallDistance, T cellDistance,
00127         Array<T,3> const& wall_vel, OffBoundary::Type bdType, Array<T,3> const& wallNormal,
00128         Array<T,Descriptor<T>::d>& u) const;
00129 private:
00132     class InterpolatedGeneralizedOffLatticeInfo3D : public ContainerBlockData {
00133     public:
00134         std::vector<Dot3D> const&                               getWetNodes() const
00135         { return wetNodes; }
00136         std::vector<Dot3D>&                                     getWetNodes()
00137         { return wetNodes; }
00138         std::vector<std::vector<std::pair<int,int> > > const&   getWetNodeSolidDirections() const
00139         { return wetNodeSolidDirections; }
00140         std::vector<std::vector<std::pair<int,int> > >&         getWetNodeSolidDirections()
00141         { return wetNodeSolidDirections; }
00142         std::vector<std::vector<int> > const&   getWetNodeFluidDirections() const
00143         { return wetNodeFluidDirections; }
00144         std::vector<std::vector<int> >&         getWetNodeFluidDirections()
00145         { return wetNodeFluidDirections; }
00146         std::vector<std::vector<plint> > const&                 getWetNodeIds() const
00147         { return wetNodeIds; }
00148         std::vector<std::vector<plint> >&                       getWetNodeIds()
00149         { return wetNodeIds; }
00150         Array<T,3> const&                                       getLocalForce() const
00151         { return localForce; }
00152         Array<T,3>&                                             getLocalForce()
00153         { return localForce; }
00154         virtual InterpolatedGeneralizedOffLatticeInfo3D* clone() const {
00155             return new InterpolatedGeneralizedOffLatticeInfo3D(*this);
00156         }
00157     private:
00158         std::vector<Dot3D> wetNodes;
00159         std::vector<std::vector<std::pair<int,int> > > wetNodeSolidDirections; // stores the directions where there is a wall and valid neighbors in its opposite direction
00160         std::vector<std::vector<int> >                 wetNodeFluidDirections; // 
00161         std::vector<std::vector<plint> >               wetNodeIds;
00162         Array<T,3>                                     localForce;
00163     };
00164 };
00165 
00166 }  // namespace plb
00167 
00168 #endif  // GUO_OFF_LATTICE_MODEL_3D_H