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

boundaryDynamics.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 BOUNDARY_DYNAMICS_H
00030 #define BOUNDARY_DYNAMICS_H
00031 
00032 #include "core/globalDefs.h"
00033 #include "core/dynamics.h"
00034 #include "core/hierarchicSerializer.h"
00035 
00036 namespace plb {
00037 
00039 
00046 template<typename T, template<typename U> class Descriptor>
00047 class BoundaryCompositeDynamics : public PreparePopulationsDynamics<T,Descriptor> {
00048 public:
00049 /* *************** Construction and Destruction ********************** */
00050 
00051     BoundaryCompositeDynamics( Dynamics<T,Descriptor>* baseDynamics_,
00052                                bool automaticPrepareCollision_=true );
00053 
00055     virtual BoundaryCompositeDynamics<T,Descriptor>* clone() const;
00056 
00058     virtual int getId() const;
00059 
00060     virtual bool isBoundary() const;
00061 
00062     virtual void serialize(HierarchicSerializer& serializer) const;
00063     virtual void unserialize(HierarchicUnserializer& unserializer);
00064 
00065 /* *************** Computation of macroscopic variables ************** */
00066 
00068     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00069 
00071     virtual T computePressure(Cell<T,Descriptor> const& cell) const;
00072 
00074     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00075                                   Array<T,Descriptor<T>::d>& velocity ) const;
00076 
00078     virtual T computeTemperature(Cell<T,Descriptor> const& cell) const;
00079 
00081     virtual void computeDeviatoricStress (
00082         Cell<T,Descriptor> const& cell, Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const;
00083 
00085     virtual void computeHeatFlux( Cell<T,Descriptor> const& cell,
00086                                   Array<T,Descriptor<T>::d>& q ) const;
00087 
00089     virtual void computeMoment( Cell<T,Descriptor> const& cell,
00090                                 plint momentId, T* moment ) const;
00091 
00092 /* *************** Additional moments, intended for internal use ***** */
00093 
00095     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00096 
00098     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00099                                 T& rhoBar_, Array<T,Descriptor<T>::d>& j) const;
00100 
00103     virtual void computeRhoBarJPiNeq(Cell<T,Descriptor> const& cell,
00104                                      T& rhoBar, Array<T,Descriptor<T>::d>& j,
00105                                      Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq) const;
00106 
00108     virtual T computeEbar(Cell<T,Descriptor> const& cell) const;
00109 
00110 /* *************** Default completion scheme ************************* */
00111 
00113     virtual void completePopulations(Cell<T,Descriptor>& cell) const;
00114 private:
00115     static int id;
00116 };
00117 
00118 
00120 template<typename T, template<typename U> class Descriptor>
00121 class StoreDensityDynamics : public BoundaryCompositeDynamics<T,Descriptor> {
00122 public:
00123 /* *************** Construction and Destruction ********************** */
00124 
00125     StoreDensityDynamics(Dynamics<T,Descriptor>* baseDynamics_,
00126                          bool automaticPrepareCollision_=true );
00127     StoreDensityDynamics(HierarchicUnserializer& unserializer);
00128 
00130     virtual StoreDensityDynamics<T,Descriptor>* clone() const;
00131 
00133     virtual int getId() const;
00134 
00135     virtual void serialize(HierarchicSerializer& serializer) const;
00136     virtual void unserialize(HierarchicUnserializer& unserializer);
00137 
00138 
00139 /* *************** Computation of macroscopic variables ************** */
00140 
00142     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00143 
00145     virtual void defineDensity(Cell<T,Descriptor>& cell, T rho_);
00146 
00147 /* *************** Additional moments, intended for internal use ***** */
00148 
00150     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00151 
00153     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00154                                 T& rhoBar_, Array<T,Descriptor<T>::d>& j) const;
00155 protected:
00156     T rhoBar;
00157 private:
00158     static int id;
00159 };
00160 
00161 
00163 template<typename T, template<typename U> class Descriptor>
00164 class StoreVelocityDynamics : public BoundaryCompositeDynamics<T,Descriptor> {
00165 public:
00166 /* *************** Construction and Destruction ********************** */
00167 
00168     StoreVelocityDynamics(Dynamics<T,Descriptor>* baseDynamics_,
00169                           bool automaticPrepareCollision_=true);
00170     StoreVelocityDynamics(HierarchicUnserializer& unserializer);
00171 
00173     virtual StoreVelocityDynamics<T,Descriptor>* clone() const;
00174 
00176     virtual int getId() const;
00177 
00178     virtual void serialize(HierarchicSerializer& serializer) const;
00179     virtual void unserialize(HierarchicUnserializer& unserializer);
00180 
00181 /* *************** Computation of macroscopic variables ************** */
00182 
00184     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00185                                   Array<T,Descriptor<T>::d>& velocity_ ) const;
00186 
00188     virtual void defineVelocity(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& velocity_);
00189 
00190 /* *************** Additional moments, intended for internal use ***** */
00191 
00193     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00194 
00196     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00197                                 T& rhoBar_, Array<T,Descriptor<T>::d>& j) const;
00198 protected:
00199     Array<T,Descriptor<T>::d> velocity;
00200 private:
00201     static int id;
00202 };
00203 
00204 
00206 template<typename T, template<typename U> class Descriptor>
00207 class StoreDensityAndVelocityDynamics : public BoundaryCompositeDynamics<T,Descriptor> {
00208 public:
00209 /* *************** Construction and Destruction ********************** */
00210 
00211     StoreDensityAndVelocityDynamics( Dynamics<T,Descriptor>* baseDynamics_,
00212                                      bool automaticPrepareCollision_=true );
00213     StoreDensityAndVelocityDynamics(HierarchicUnserializer& unserializer);
00214 
00216     virtual StoreDensityAndVelocityDynamics<T,Descriptor>* clone() const;
00217 
00219     virtual int getId() const;
00220 
00221     virtual void serialize(HierarchicSerializer& serializer) const;
00222     virtual void unserialize(HierarchicUnserializer& unserializer);
00223 
00224 /* *************** Computation of macroscopic variables ************** */
00225 
00227     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00228 
00230     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00231                                   Array<T,Descriptor<T>::d>& velocity_ ) const;
00232 
00234     virtual void defineDensity(Cell<T,Descriptor>& cell, T rho_);
00235 
00237     virtual void defineVelocity(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& velocity_);
00238 
00239 /* *************** Additional moments, intended for internal use ***** */
00240 
00242     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00243 
00245     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00246                                 T& rhoBar_, Array<T,Descriptor<T>::d>& j) const;
00247 
00248 protected:
00249     T rhoBar;
00250     Array<T,Descriptor<T>::d> velocity;
00251 private:
00252     static int id;
00253 };
00254 
00255 
00257 template<typename T, template<typename U> class Descriptor>
00258 class StoreTemperatureAndVelocityDynamics : public BoundaryCompositeDynamics<T,Descriptor> {
00259 public:
00260 /* *************** Construction and Destruction ********************** */
00261 
00262     StoreTemperatureAndVelocityDynamics(Dynamics<T,Descriptor>* baseDynamics_,
00263                                         bool automaticPrepareCollision_ =true);
00264     StoreTemperatureAndVelocityDynamics(HierarchicUnserializer& unserializer);
00265 
00267     virtual StoreTemperatureAndVelocityDynamics<T,Descriptor>* clone() const;
00268 
00270     virtual int getId() const;
00271 
00272     virtual void serialize(HierarchicSerializer& serializer) const;
00273     virtual void unserialize(HierarchicUnserializer& unserializer);
00274 
00275 /* *************** Computation of macroscopic variables ************** */
00276 
00278     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00279                                   Array<T,Descriptor<T>::d>& velocity_ ) const;
00280 
00282     virtual T computeTemperature(Cell<T,Descriptor> const& cell) const;
00283 
00285     virtual void defineVelocity(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& velocity_);
00286 
00288     virtual void defineTemperature(Cell<T,Descriptor>& cell, T theta_);
00289 
00290 /* *************** Additional moments, intended for internal use ***** */
00291 
00293     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00294 
00296     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00297                                 T& rhoBar_, Array<T,Descriptor<T>::d>& j) const;
00298 
00299 protected:
00300     T thetaBar;
00301     Array<T,Descriptor<T>::d> velocity;
00302 private:
00303     static int id;
00304 };
00305 
00306 
00308 template<typename T, template<typename U> class Descriptor,
00309          int direction, int orientation>
00310 class VelocityDirichletBoundaryDynamics : public StoreVelocityDynamics<T,Descriptor> {
00311 public:
00312     VelocityDirichletBoundaryDynamics(Dynamics<T,Descriptor>* baseDynamics_,
00313                                       bool automaticPrepareCollision_=true);
00314     VelocityDirichletBoundaryDynamics(HierarchicUnserializer& unserializer);
00315 
00317     virtual VelocityDirichletBoundaryDynamics<T,Descriptor,direction,orientation>* clone() const;
00318 
00320     virtual int getId() const;
00321     virtual void serialize(HierarchicSerializer& serializer) const;
00322     virtual void unserialize(HierarchicUnserializer& unserializer);
00323 
00325     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00327     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00329     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00330                                 T& rhoBar_, Array<T,Descriptor<T>::d>& j) const;
00331 private:
00332     static int id;
00333 };
00334 
00335 
00337 template<typename T, template<typename U> class Descriptor,
00338          int direction, int orientation>
00339 class DensityDirichletBoundaryDynamics : public StoreDensityDynamics<T,Descriptor> {
00340 public:
00341     DensityDirichletBoundaryDynamics(Dynamics<T,Descriptor>* baseDynamics_,
00342                                      bool automaticPrepareCollision_=true);
00343     DensityDirichletBoundaryDynamics(HierarchicUnserializer& unserializer);
00344 
00346     virtual DensityDirichletBoundaryDynamics<T,Descriptor,direction,orientation>* clone() const;
00347 
00349     virtual int getId() const;
00350     virtual void serialize(HierarchicSerializer& serializer) const;
00351     virtual void unserialize(HierarchicUnserializer& unserializer);
00352 
00354     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00355                                   Array<T,Descriptor<T>::d>& velocity ) const;
00357     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00358                                 T& rhoBar, Array<T,Descriptor<T>::d>& j) const;
00359 
00360 public:
00361     void computeJ( Cell<T,Descriptor> const& cell, Array<T,Descriptor<T>::d>& j_ ) const;
00362 private:
00363     static int id;
00364 
00365 };
00366 
00367 }  // namespace plb
00368 
00369 #endif  // BOUNDARY_DYNAMICS_H