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

regularizedBoundaryDynamics.hh

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 REGULARIZED_BOUNDARY_DYNAMICS_HH
00030 #define REGULARIZED_BOUNDARY_DYNAMICS_HH
00031 
00032 #include "boundaryCondition/regularizedBoundaryDynamics.h"
00033 #include "boundaryCondition/boundaryTemplates.h"
00034 #include "core/cell.h"
00035 #include "core/dynamicsIdentifiers.h"
00036 #include "latticeBoltzmann/indexTemplates.h"
00037 
00038 namespace plb {
00039 
00040 /* *************** Class RegularizedVelocityBoundaryDynamics ************* */
00041 
00042 template<typename T, template<typename U> class Descriptor,
00043          int direction, int orientation>
00044 int RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation>::id =
00045     meta::registerGeneralDynamics<T,Descriptor, RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation> >
00046             ( std::string("Boundary_RegularizedVelocity_")+util::val2str(direction) +
00047               std::string("_")+util::val2str(orientation) );
00048 
00049 template<typename T, template<typename U> class Descriptor,
00050          int direction, int orientation>
00051 RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation>::
00052     RegularizedVelocityBoundaryDynamics(Dynamics<T,Descriptor>* baseDynamics_, bool automaticPrepareCollision_)
00053         : VelocityDirichletBoundaryDynamics<T,Descriptor,direction,orientation>(baseDynamics_, automaticPrepareCollision_)
00054 { }
00055 
00056 template<typename T, template<typename U> class Descriptor,
00057          int direction, int orientation>
00058 RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation>::
00059     RegularizedVelocityBoundaryDynamics(HierarchicUnserializer& unserializer)
00060         : VelocityDirichletBoundaryDynamics<T,Descriptor,direction,orientation>(0, false)
00061 {
00062     unserialize(unserializer);
00063 }
00064 
00065 template<typename T, template<typename U> class Descriptor,
00066          int direction, int orientation>
00067 RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation>*
00068     RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation>::clone() const
00069 {
00070     return new RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation>(*this);
00071 }
00072  
00073 template<typename T, template<typename U> class Descriptor,
00074          int direction, int orientation>
00075 void RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation>::serialize(HierarchicSerializer& serializer) const
00076 {
00077     VelocityDirichletBoundaryDynamics<T,Descriptor,direction,orientation>::serialize(serializer);
00078 }
00079 
00080 template<typename T, template<typename U> class Descriptor,
00081          int direction, int orientation>
00082 void RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation>::unserialize(HierarchicUnserializer& unserializer)
00083 {
00084     VelocityDirichletBoundaryDynamics<T,Descriptor,direction,orientation>::unserialize(unserializer);
00085 }
00086 
00087 template<typename T, template<typename U> class Descriptor,
00088          int direction, int orientation>
00089 int RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation>::getId() const {
00090     return id;
00091 }
00092 
00093 template<typename T, template<typename U> class Descriptor,
00094          int direction, int orientation>
00095 void RegularizedVelocityBoundaryDynamics<T,Descriptor,direction,orientation>::
00096     completePopulations(Cell<T,Descriptor>& cell) const
00097 {
00098     T rhoBar;
00099     Array<T,Descriptor<T>::d> j;
00100     this -> computeRhoBarJ(cell, rhoBar, j);
00101     T jSqr = VectorTemplate<T,Descriptor>::normSqr(j);
00102 
00103     Array<T,SymmetricTensor<T,Descriptor>::n> PiNeq;
00104     boundaryTemplates<T,Descriptor,direction,orientation>::compute_PiNeq (
00105             this->getBaseDynamics(), cell, rhoBar, j, jSqr, PiNeq );
00106 
00107     this->getBaseDynamics().regularize(cell, rhoBar, j, jSqr, PiNeq);
00108 }
00109 
00110 
00111 /* *************** Class RegularizedDensityBoundaryDynamics ************* */
00112 
00113 template<typename T, template<typename U> class Descriptor,
00114          int direction, int orientation>
00115 int RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation>::id =
00116     meta::registerGeneralDynamics<T,Descriptor, RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation> >
00117             ( std::string("Boundary_RegularizedDensity_")+util::val2str(direction) +
00118               std::string("_")+util::val2str(orientation) );
00119 
00120 template<typename T, template<typename U> class Descriptor,
00121          int direction, int orientation>
00122 RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation>::
00123     RegularizedDensityBoundaryDynamics(Dynamics<T,Descriptor>* baseDynamics_, bool automaticPrepareCollision_)
00124         : DensityDirichletBoundaryDynamics<T,Descriptor,direction,orientation>(baseDynamics_, automaticPrepareCollision_)
00125 { }
00126 
00127 template<typename T, template<typename U> class Descriptor,
00128          int direction, int orientation>
00129 RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation>::
00130     RegularizedDensityBoundaryDynamics(HierarchicUnserializer& unserializer)
00131         : DensityDirichletBoundaryDynamics<T,Descriptor,direction,orientation>(0, false)
00132 {
00133     unserialize(unserializer);
00134 }
00135 
00136 template<typename T, template<typename U> class Descriptor,
00137          int direction, int orientation>
00138 RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation>*
00139     RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation>::clone() const
00140 {
00141     return new RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation>(*this);
00142 }
00143  
00144 template<typename T, template<typename U> class Descriptor,
00145          int direction, int orientation>
00146 int RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation>::getId() const {
00147     return id;
00148 }
00149 
00150  
00151 template<typename T, template<typename U> class Descriptor,
00152          int direction, int orientation>
00153 void RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation>::serialize(HierarchicSerializer& serializer) const
00154 {
00155     DensityDirichletBoundaryDynamics<T,Descriptor,direction,orientation>::serialize(serializer);
00156 }
00157 
00158 template<typename T, template<typename U> class Descriptor,
00159          int direction, int orientation>
00160 void RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation>::unserialize(HierarchicUnserializer& unserializer)
00161 {
00162     DensityDirichletBoundaryDynamics<T,Descriptor,direction,orientation>::unserialize(unserializer);
00163 }
00164 
00165 template<typename T, template<typename U> class Descriptor,
00166          int direction, int orientation>
00167 void RegularizedDensityBoundaryDynamics<T,Descriptor,direction,orientation>::
00168     completePopulations(Cell<T,Descriptor>& cell) const
00169 {
00170     T rhoBar;
00171     Array<T,Descriptor<T>::d> j;
00172     this -> computeRhoBarJ(cell, rhoBar, j);
00173     T jSqr = VectorTemplate<T,Descriptor>::normSqr(j);
00174 
00175     Array<T,SymmetricTensor<T,Descriptor>::n> PiNeq;
00176     boundaryTemplates<T,Descriptor,direction,orientation>::compute_PiNeq (
00177             this->getBaseDynamics(), cell, rhoBar, j, jSqr, PiNeq );
00178 
00179     this->getBaseDynamics().regularize(cell, rhoBar, j, jSqr, PiNeq);
00180 }
00181 
00182 }  // namespace plb
00183 
00184 #endif  // REGULARIZED_BOUNDARY_DYNAMICS_HH