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

NLD_boundaryDynamics3D.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 
00029 #ifndef NLD_BOUNDARY_DYNAMICS_3D_H
00030 #define NLD_BOUNDARY_DYNAMICS_3D_H
00031 
00032 #include "core/globalDefs.h"
00033 #include "core/array.h"
00034 #include "boundaryCondition/regularizedBoundaryDynamics.h"
00035 
00036 namespace plb {
00037 
00038 template<typename T, template<typename U> class Descriptor>
00039 class NonLocalBoundaryDynamics3D : public CompositeDynamics<T,Descriptor> {
00040 public:
00041     NonLocalBoundaryDynamics3D(Dynamics<T,Descriptor>* baseDynamics_);
00042     virtual bool isBoundary() const;
00043     virtual bool isNonLocal() const;
00044 
00045     virtual void planeBoundaryCompletion (
00046             int direction, int orientation, plint iX, plint iY, plint iZ,
00047             BlockLattice3D<T,Descriptor>& lattice ) =0;
00048     virtual void edgeBoundaryCompletion (
00049             int plane, int normal1, int normal2, plint iX, plint iY, plint iZ,
00050             BlockLattice3D<T,Descriptor>& lattice ) =0;
00051     virtual void cornerBoundaryCompletion (
00052             int xNormal, int yNormal, int zNormal, plint iX, plint iY, plint iZ,
00053             BlockLattice3D<T,Descriptor>& lattice ) =0;
00054 
00055     virtual void planeComputeMacroscopic (
00056             int direction, int orientation, plint iX, plint iY, plint iZ,
00057             BlockLattice3D<T,Descriptor>& lattice,
00058             T& rhoBar, Array<T,3>& j, T& thetaBar ) =0;
00059     virtual void edgeComputeMacroscopic (
00060             int plane, int normal1, int normal2, plint iX, plint iY, plint iZ,
00061             BlockLattice3D<T,Descriptor>& lattice,
00062             T& rhoBar, Array<T,3>& j, T& thetaBar ) =0;
00063     virtual void cornerComputeMacroscopic (
00064             int xNormal, int yNormal, int zNormal, plint iX, plint iY, plint iZ,
00065             BlockLattice3D<T,Descriptor>& lattice,
00066             T& rhoBar, Array<T,3>& j, T& thetaBar ) =0;
00067 
00068 public:
00069     static void staticPlaneComputeMacroscopic (
00070             int direction, int orientation, plint iX, plint iY, plint iZ,
00071             BlockLattice3D<T,Descriptor>& lattice,
00072             T& rhoBar, Array<T,3>& j, T& thetaBar )
00073     {
00074         NonLocalBoundaryDynamics3D<T,Descriptor>* dynamics =
00075             dynamic_cast<NonLocalBoundaryDynamics3D<T,Descriptor>*>(&lattice.get(iX,iY,iZ).getDynamics());
00076         if (dynamics) {
00077             dynamics->planeComputeMacroscopic(direction, orientation, iX, iY, iZ, lattice, rhoBar, j, thetaBar);
00078         }
00079         else {
00080             rhoBar = T();
00081             j.resetToZero();
00082             thetaBar = T();
00083         }
00084     }
00085     static void staticEdgeComputeMacroscopic (
00086             int plane, int normal1, int normal2, plint iX, plint iY, plint iZ,
00087             BlockLattice3D<T,Descriptor>& lattice,
00088             T& rhoBar, Array<T,3>& j, T& thetaBar )
00089     {
00090         NonLocalBoundaryDynamics3D<T,Descriptor>* dynamics =
00091             dynamic_cast<NonLocalBoundaryDynamics3D<T,Descriptor>*>(&lattice.get(iX,iY,iZ).getDynamics());
00092         if (dynamics) {
00093             dynamics->edgeComputeMacroscopic(plane, normal1, normal2, iX, iY, iZ, lattice, rhoBar, j, thetaBar);
00094         }
00095         else {
00096             rhoBar = T();
00097             j.resetToZero();
00098             thetaBar = T();
00099         }
00100     }
00101     static void staticCornerComputeMacroscopic (
00102             int xNormal, int yNormal, int zNormal, plint iX, plint iY, plint iZ,
00103             BlockLattice3D<T,Descriptor>& lattice,
00104             T& rhoBar, Array<T,3>& j, T& thetaBar )
00105     {
00106         NonLocalBoundaryDynamics3D<T,Descriptor>* dynamics =
00107             dynamic_cast<NonLocalBoundaryDynamics3D<T,Descriptor>*>(&lattice.get(iX,iY,iZ).getDynamics());
00108         if (dynamics) {
00109             dynamics->cornerComputeMacroscopic(xNormal, yNormal, zNormal, iX, iY, iZ, lattice, rhoBar, j, thetaBar);
00110         }
00111         else {
00112             rhoBar = T();
00113             j.resetToZero();
00114             thetaBar = T();
00115         }
00116     }
00117 };
00118 
00119 template<typename T, template<typename U> class Descriptor>
00120 class NLD_VelocityBoundaryDynamics3D : public NonLocalBoundaryDynamics3D<T,Descriptor>
00121 {
00122 public:
00123     NLD_VelocityBoundaryDynamics3D(Dynamics<T,Descriptor>* baseDynamics_);
00124     NLD_VelocityBoundaryDynamics3D(HierarchicUnserializer& unserializer);
00125     virtual void defineVelocity(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& velocity_);
00126     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00127                                   Array<T,Descriptor<T>::d>& velocity_ ) const;
00128     virtual void serialize(HierarchicSerializer& serializer) const;
00129     virtual void unserialize(HierarchicUnserializer& unserializer);
00130     virtual NLD_VelocityBoundaryDynamics3D<T,Descriptor>* clone() const;
00131     virtual int getId() const;
00132     virtual void prepareCollision(Cell<T,Descriptor>& cell);
00133     Array<T,3> const& get_u() const { return u; }
00134 public:
00135     virtual void planeBoundaryCompletion (
00136             int direction, int orientation, plint iX, plint iY, plint iZ,
00137             BlockLattice3D<T,Descriptor>& lattice );
00138     virtual void edgeBoundaryCompletion (
00139             int plane, int normal1, int normal2, plint iX, plint iY, plint iZ,
00140             BlockLattice3D<T,Descriptor>& lattice );
00141     virtual void cornerBoundaryCompletion (
00142             int xNormal, int yNormal, int zNormal, plint iX, plint iY, plint iZ,
00143             BlockLattice3D<T,Descriptor>& lattice );
00144 
00145     virtual void planeComputeMacroscopic (
00146             int direction, int orientation, plint iX, plint iY, plint iZ,
00147             BlockLattice3D<T,Descriptor>& lattice,
00148             T& rhoBar, Array<T,3>& j, T& thetaBar );
00149     virtual void edgeComputeMacroscopic (
00150             int plane, int normal1, int normal2, plint iX, plint iY, plint iZ,
00151             BlockLattice3D<T,Descriptor>& lattice,
00152             T& rhoBar, Array<T,3>& j, T& thetaBar );
00153     virtual void cornerComputeMacroscopic (
00154             int xNormal, int yNormal, int zNormal, plint iX, plint iY, plint iZ,
00155             BlockLattice3D<T,Descriptor>& lattice,
00156             T& rhoBar, Array<T,3>& j, T& thetaBar );
00157 private:
00158     Array<T,3> u;
00159     static int id;
00160 };
00161 
00162 template<typename T, template<typename U> class Descriptor>
00163 class NLD_VelocityNeumannBoundaryDynamics3D : public NonLocalBoundaryDynamics3D<T,Descriptor>
00164 {
00165 public:
00166     NLD_VelocityNeumannBoundaryDynamics3D(Dynamics<T,Descriptor>* baseDynamics_);
00167     NLD_VelocityNeumannBoundaryDynamics3D(HierarchicUnserializer& unserializer);
00168     virtual NLD_VelocityNeumannBoundaryDynamics3D<T,Descriptor>* clone() const;
00169     virtual int getId() const;
00170     virtual void prepareCollision(Cell<T,Descriptor>& cell);
00171 public:
00172     virtual void planeBoundaryCompletion (
00173             int direction, int orientation, plint iX, plint iY, plint iZ,
00174             BlockLattice3D<T,Descriptor>& lattice );
00175     virtual void edgeBoundaryCompletion (
00176             int plane, int normal1, int normal2, plint iX, plint iY, plint iZ,
00177             BlockLattice3D<T,Descriptor>& lattice );
00178     virtual void cornerBoundaryCompletion (
00179             int xNormal, int yNormal, int zNormal, plint iX, plint iY, plint iZ,
00180             BlockLattice3D<T,Descriptor>& lattice );
00181 
00182     virtual void planeComputeMacroscopic (
00183             int direction, int orientation, plint iX, plint iY, plint iZ,
00184             BlockLattice3D<T,Descriptor>& lattice,
00185             T& rhoBar, Array<T,3>& j, T& thetaBar );
00186     virtual void edgeComputeMacroscopic (
00187             int plane, int normal1, int normal2, plint iX, plint iY, plint iZ,
00188             BlockLattice3D<T,Descriptor>& lattice,
00189             T& rhoBar, Array<T,3>& j, T& thetaBar );
00190     virtual void cornerComputeMacroscopic (
00191             int xNormal, int yNormal, int zNormal, plint iX, plint iY, plint iZ,
00192             BlockLattice3D<T,Descriptor>& lattice,
00193             T& rhoBar, Array<T,3>& j, T& thetaBar );
00194 private:
00195     static int id;
00196 };
00197 
00198 }  // namespace plb
00199 
00200 #endif  // NLD_BOUNDARY_DYNAMICS_3D_H