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

advectionDiffusionBoundaries.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 
00025 /* Main author: Orestis Malaspinas
00026  */
00027 
00028 #ifndef ADVECTION_DIFFUSION_BOUNDARIES_HH
00029 #define ADVECTION_DIFFUSION_BOUNDARIES_HH
00030 
00031 #include "complexDynamics/advectionDiffusionBoundaries.h"
00032 #include "core/util.h"
00033 #include "complexDynamics/utilAdvectionDiffusion.h"
00034 #include "latticeBoltzmann/advectionDiffusionLattices.h"
00035 #include "latticeBoltzmann/advectionDiffusionDynamicsTemplates.h"
00036 #include "latticeBoltzmann/indexTemplates.h"
00037 
00038 namespace plb {
00039 
00040 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00041 void DensityClosure ( Cell<T,Descriptor>& cell, Dynamics<T,Descriptor> const& dynamics )
00042 {
00043     typedef Descriptor<T> D;
00044     
00045     T rho    = dynamics.computeDensity(cell);
00046     T rhoBar = D::rhoBar(rho);
00047     
00048     plint missingNormal = 0;
00049     std::vector<plint> missingDiagonal = indexTemplates::subIndexOutgoing<D,direction,orientation>();
00050     std::vector<plint> knownIndexes   = indexTemplates::remainingIndexes<D>(missingDiagonal);
00051    // here I know all missing and non missing f_i
00052     for (pluint iPop = 0; iPop < missingDiagonal.size(); ++iPop)
00053     {
00054         plint numOfNonNullComp = 0;
00055         for (int iDim = 0; iDim < D::d; ++iDim)
00056             numOfNonNullComp += abs(D::c[missingDiagonal[iPop]][iDim]);
00057 
00058         if (numOfNonNullComp == 1)
00059         {
00060             missingNormal = missingDiagonal[iPop];
00061             missingDiagonal.erase(missingDiagonal.begin()+iPop);
00062             break;
00063         }
00064     }
00065     
00066     T sum = T();
00067     for (pluint iPop = 0; iPop < knownIndexes.size(); ++iPop)
00068     {
00069         sum += cell[knownIndexes[iPop]];
00070     }
00071     cell[missingNormal] = rhoBar - sum;
00072 }
00073 
00074 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00075 void RegularizedClosure ( Cell<T,Descriptor>& cell, Dynamics<T,Descriptor> const& dynamics )
00076 {
00077     typedef Descriptor<T> D;
00078     typedef advectionDiffusionDynamicsTemplates<T,Descriptor> adTempl;
00079     
00080     T rhoBar = dynamics.computeRhoBar(cell);
00081     T* u = cell.getExternal(Descriptor<T>::ExternalField::velocityBeginsAt);
00082     Array<T,D::d> jEq;
00083     for (plint iD = 0; iD < D::d; ++iD)
00084     {
00085         jEq[iD] = Descriptor<T>::fullRho(rhoBar) * u[iD];
00086     }
00087     plint missingNormal = 0;
00088     std::vector<plint> missingDiagonal = indexTemplates::subIndexOutgoing<D,direction,orientation>();
00089    // here I know all missing and non missing f_i
00090     for (pluint iPop = 0; iPop < missingDiagonal.size(); ++iPop)
00091     {
00092         plint numOfNonNullComp = 0;
00093         for (int iDim = 0; iDim < D::d; ++iDim)
00094             numOfNonNullComp += abs(D::c[missingDiagonal[iPop]][iDim]);
00095 
00096         if (numOfNonNullComp == 1)
00097         {
00098             missingNormal = missingDiagonal[iPop];
00099             missingDiagonal.erase(missingDiagonal.begin()+iPop);
00100             break;
00101         }
00102     }
00103     
00104     // The collision procedure for D2Q5 and D3Q7 lattice is the same ...
00105     // Given the rule f_i_neq = -f_opposite(i)_neq
00106     // I have the right number of equations for the number of unknowns using these lattices 
00107     
00108     cell[missingNormal] = 
00109         adTempl::bgk_ma1_equilibrium(missingNormal, rhoBar, jEq) 
00110         -(cell[indexTemplates::opposite<D>(missingNormal)]
00111         - adTempl::bgk_ma1_equilibrium(
00112                 indexTemplates::opposite<D>(missingNormal), rhoBar, jEq) ) ;
00113 }
00114 
00115 // ============= flat wall standard boundary ==================//
00116 
00117 template<typename T, template<typename U> class Descriptor,
00118          int direction, int orientation>
00119 int AdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::id =
00120     meta::registerGeneralDynamics<T,Descriptor, AdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation> > (
00121             std::string("Boundary_AdvectionDiffusion")+util::val2str(direction) +
00122             std::string("_")+util::val2str(orientation) );
00123 
00124 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00125 AdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::AdvectionDiffusionBoundaryDynamics (
00126         Dynamics<T,Descriptor>* baseDynamics, bool automaticPrepareCollision )
00127     : StoreDensityDynamics<T,Descriptor>(baseDynamics, automaticPrepareCollision)
00128 { }
00129 
00130 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00131 AdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::AdvectionDiffusionBoundaryDynamics (
00132         HierarchicUnserializer& unserializer )
00133     : StoreDensityDynamics<T,Descriptor>(0, false)
00134 {
00135     unserialize(unserializer);
00136 }
00137 
00138 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00139 AdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>*
00140     AdvectionDiffusionBoundaryDynamics<T,Descriptor, direction, orientation>::clone() const
00141 {
00142     return new AdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>(*this);
00143 }
00144 
00145 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00146 int AdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::getId() const {
00147     return id;
00148 }
00149 
00150 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00151 void AdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::serialize(HierarchicSerializer& serializer) const
00152 {
00153     StoreDensityDynamics<T,Descriptor>::serialize(serializer);
00154 }
00155 
00156 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00157 void AdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::unserialize(HierarchicUnserializer& unserializer)
00158 {
00159     StoreDensityDynamics<T,Descriptor>::unserialize(unserializer);
00160 }
00161 
00162 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00163 void AdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::completePopulations(Cell<T,Descriptor>& cell) const
00164 {
00165     DensityClosure<T,Descriptor,direction,orientation>(cell, *this);
00166 }
00167 
00168 // ============= flat wall regularized boundary ==================//
00169 
00170 
00171 template<typename T, template<typename U> class Descriptor,
00172          int direction, int orientation>
00173 int RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::id =
00174     meta::registerGeneralDynamics<T,Descriptor, RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation> > (
00175             std::string("Boundary_RegularizedAdvectionDiffusion")+util::val2str(direction) +
00176             std::string("_")+util::val2str(orientation) );
00177 
00178 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00179 RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::
00180         RegularizedAdvectionDiffusionBoundaryDynamics (Dynamics<T,Descriptor>* baseDynamics, bool automaticPrepareCollision )
00181     : StoreDensityDynamics<T,Descriptor>(baseDynamics,automaticPrepareCollision)
00182 { }
00183 
00184 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00185 RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::RegularizedAdvectionDiffusionBoundaryDynamics (
00186         HierarchicUnserializer& unserializer )
00187     : StoreDensityDynamics<T,Descriptor>(0, false)
00188 {
00189     unserialize(unserializer);
00190 }
00191 
00192 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00193 RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>*
00194     RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor, direction, orientation>::clone() const
00195 {
00196     return new RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>(*this);
00197 }
00198 
00199 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00200 int RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::getId() const {
00201     return id;
00202 }
00203 
00204 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00205 void RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::serialize(HierarchicSerializer& serializer) const
00206 {
00207     StoreDensityDynamics<T,Descriptor>::serialize(serializer);
00208 }
00209 
00210 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00211 void RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::unserialize(HierarchicUnserializer& unserializer)
00212 {
00213     StoreDensityDynamics<T,Descriptor>::unserialize(unserializer);
00214 }
00215 
00216 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00217 void RegularizedAdvectionDiffusionBoundaryDynamics<T,Descriptor,direction,orientation>::
00218         completePopulations(Cell<T,Descriptor>& cell) const
00219 {
00220     RegularizedClosure<T,Descriptor,direction,orientation>(cell, *this);
00221 }
00222 
00223 // =============== 2D corners ===================//
00224 
00225 template<typename T, template<typename U> class Descriptor,
00226          int xNormal, int yNormal>
00227 int AdvectionDiffusionCornerDynamics2D<T,Descriptor,xNormal,yNormal>::id =
00228     meta::registerGeneralDynamics<T,Descriptor, AdvectionDiffusionCornerDynamics2D<T,Descriptor,xNormal,yNormal> > (
00229             std::string("Boundary_AdvectionDiffusionCorner")+util::val2str(xNormal) +
00230             std::string("_")+util::val2str(yNormal) );
00231 
00232 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal>
00233 AdvectionDiffusionCornerDynamics2D<T,Descriptor,xNormal,yNormal>::AdvectionDiffusionCornerDynamics2D (
00234         Dynamics<T,Descriptor>* baseDynamics, bool automaticPrepareCollision )
00235     : StoreDensityDynamics<T,Descriptor>(baseDynamics, automaticPrepareCollision)
00236 { }
00237 
00238 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal>
00239 AdvectionDiffusionCornerDynamics2D<T,Descriptor,xNormal,yNormal>::AdvectionDiffusionCornerDynamics2D (
00240         HierarchicUnserializer& unserializer )
00241     : StoreDensityDynamics<T,Descriptor>(0, false)
00242 {
00243     unserialize(unserializer);
00244 }
00245 
00246 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal>
00247 AdvectionDiffusionCornerDynamics2D<T,Descriptor,xNormal,yNormal>*
00248     AdvectionDiffusionCornerDynamics2D<T,Descriptor, xNormal,yNormal>::clone() const
00249 {
00250     return new AdvectionDiffusionCornerDynamics2D<T,Descriptor,xNormal,yNormal>(*this);
00251 }
00252 
00253 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal>
00254 int AdvectionDiffusionCornerDynamics2D<T,Descriptor,xNormal,yNormal>::getId() const {
00255     return id;
00256 }
00257 
00258 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal>
00259 void AdvectionDiffusionCornerDynamics2D<T,Descriptor,xNormal,yNormal>::serialize(HierarchicSerializer& serializer) const
00260 {
00261     StoreDensityDynamics<T,Descriptor>::serialize(serializer);
00262 }
00263 
00264 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal>
00265 void AdvectionDiffusionCornerDynamics2D<T,Descriptor,xNormal,yNormal>::unserialize(HierarchicUnserializer& unserializer)
00266 {
00267     StoreDensityDynamics<T,Descriptor>::unserialize(unserializer);
00268 }
00269 
00270 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal>
00271 void AdvectionDiffusionCornerDynamics2D<T,Descriptor,xNormal,yNormal>::completePopulations(Cell<T,Descriptor>& cell) const
00272 {
00273     typedef Descriptor<T> D;
00274     typedef advectionDiffusionDynamicsTemplates<T,Descriptor> adTempl;
00275     
00276     T rhoBar = this->computeRhoBar(cell);
00277     T* u = cell.getExternal(Descriptor<T>::ExternalField::velocityBeginsAt);
00278     Array<T,D::d> jEq;
00279     for (plint iD = 0; iD < D::d; ++iD)
00280     {
00281         jEq[iD] = Descriptor<T>::fullRho(rhoBar) * u[iD];
00282     }
00283     // I need to get Missing information on the corners !!!!
00284     std::vector<plint> unknownIndexes = utilAdvDiff::subIndexOutgoing2DonCorners<D,xNormal,yNormal>();
00285     // here I know all missing and non missing f_i
00286     
00287     // The collision procedure for D2Q5 and D3Q7 lattice is the same ...
00288     // Given the rule f_i_neq = -f_opposite(i)_neq
00289     // I have the right number of equations for the number of unknowns using these lattices 
00290     
00291     for (pluint iPop = 0; iPop < unknownIndexes.size(); ++iPop)
00292     {
00293         cell[unknownIndexes[iPop]] = 
00294                 adTempl::bgk_ma1_equilibrium(unknownIndexes[iPop], rhoBar, jEq) 
00295                 -(cell[indexTemplates::opposite<D>(unknownIndexes[iPop])]
00296                 - adTempl::bgk_ma1_equilibrium(
00297                         indexTemplates::opposite<D>(unknownIndexes[iPop]), rhoBar, jEq) ) ;
00298     }
00299 }
00300 
00301 // =============== 3D corners ===================//
00302 
00303 template<typename T, template<typename U> class Descriptor,
00304          int xNormal, int yNormal, int zNormal>
00305 int AdvectionDiffusionCornerDynamics3D<T,Descriptor,xNormal,yNormal,zNormal>::id =
00306     meta::registerGeneralDynamics<T,Descriptor, AdvectionDiffusionCornerDynamics3D<T,Descriptor,xNormal,yNormal,zNormal> > (
00307             std::string("Boundary_AdvectionDiffusionCorner")+util::val2str(xNormal) +
00308             std::string("_")+util::val2str(yNormal)+std::string("_")+util::val2str(zNormal)  );
00309 
00310 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal, int zNormal>
00311 AdvectionDiffusionCornerDynamics3D<T,Descriptor,xNormal,yNormal,zNormal>::AdvectionDiffusionCornerDynamics3D (
00312         Dynamics<T,Descriptor>* baseDynamics, bool automaticPrepareCollision )
00313     : StoreDensityDynamics<T,Descriptor>(baseDynamics, automaticPrepareCollision)
00314 { }
00315 
00316 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal, int zNormal>
00317 AdvectionDiffusionCornerDynamics3D<T,Descriptor,xNormal,yNormal,zNormal>::AdvectionDiffusionCornerDynamics3D (
00318         HierarchicUnserializer& unserializer )
00319     : StoreDensityDynamics<T,Descriptor>(0, false)
00320 {
00321     unserialize(unserializer);
00322 }
00323 
00324 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal, int zNormal>
00325 AdvectionDiffusionCornerDynamics3D<T,Descriptor,xNormal,yNormal,zNormal>*
00326     AdvectionDiffusionCornerDynamics3D<T,Descriptor, xNormal,yNormal,zNormal>::clone() const
00327 {
00328     return new AdvectionDiffusionCornerDynamics3D<T,Descriptor,xNormal,yNormal,zNormal>(*this);
00329 }
00330 
00331 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal, int zNormal>
00332 int AdvectionDiffusionCornerDynamics3D<T,Descriptor,xNormal,yNormal,zNormal>::getId() const {
00333     return id;
00334 }
00335 
00336 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal, int zNormal>
00337 void AdvectionDiffusionCornerDynamics3D<T,Descriptor,xNormal,yNormal,zNormal>::serialize(HierarchicSerializer& serializer) const
00338 {
00339     StoreDensityDynamics<T,Descriptor>::serialize(serializer);
00340 }
00341 
00342 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal, int zNormal>
00343 void AdvectionDiffusionCornerDynamics3D<T,Descriptor,xNormal,yNormal,zNormal>::unserialize(HierarchicUnserializer& unserializer)
00344 {
00345     StoreDensityDynamics<T,Descriptor>::unserialize(unserializer);
00346 }
00347 
00348 template<typename T, template<typename U> class Descriptor, int xNormal, int yNormal, int zNormal>
00349 void AdvectionDiffusionCornerDynamics3D<T,Descriptor,xNormal,yNormal,zNormal>::completePopulations(Cell<T,Descriptor>& cell) const
00350 {
00351     typedef Descriptor<T> D;
00352     typedef advectionDiffusionDynamicsTemplates<T,Descriptor> adTempl;
00353     
00354     T rhoBar = this->computeRhoBar(cell);
00355     T* u = cell.getExternal(Descriptor<T>::ExternalField::velocityBeginsAt);
00356     Array<T,D::d> jEq;
00357     for (plint iD = 0; iD < D::d; ++iD)
00358     {
00359         jEq[iD] = Descriptor<T>::fullRho(rhoBar) * u[iD];
00360     }
00361     // I need to get Missing information on the corners !!!!
00362     std::vector<plint> unknownIndexes = utilAdvDiff::subIndexOutgoing3DonCorners<D,xNormal,yNormal,zNormal>();
00363     // here I know all missing and non missing f_i
00364     
00365     // The collision procedure for D2Q5 and D3Q7 lattice is the same ...
00366     // Given the rule f_i_neq = -f_opposite(i)_neq
00367     // I have the right number of equations for the number of unknowns using these lattices 
00368     
00369     for (pluint iPop = 0; iPop < unknownIndexes.size(); ++iPop)
00370     {
00371         cell[unknownIndexes[iPop]] = 
00372                 adTempl::bgk_ma1_equilibrium(unknownIndexes[iPop], rhoBar, jEq) 
00373                 -(cell[indexTemplates::opposite<D>(unknownIndexes[iPop])]
00374                 - adTempl::bgk_ma1_equilibrium(indexTemplates::opposite<D>(unknownIndexes[iPop]), rhoBar, jEq) ) ;
00375     }
00376 }
00377 
00378 // =============== 3D edges ===================//
00379 
00380 template<typename T, template<typename U> class Descriptor, int plane, int normal1, int normal2>
00381 int AdvectionDiffusionEdgeDynamics3D<T,Descriptor,plane,normal1,normal2>::id =
00382     meta::registerGeneralDynamics<T,Descriptor, AdvectionDiffusionEdgeDynamics3D<T,Descriptor,plane,normal1,normal2> > (
00383             std::string("Boundary_AdvectionDiffusionEdge")+util::val2str(plane) +
00384             std::string("_")+util::val2str(normal1)+std::string("_")+util::val2str(normal2)  );
00385 
00386 template<typename T, template<typename U> class Descriptor, int plane, int normal1, int normal2>
00387 AdvectionDiffusionEdgeDynamics3D<T,Descriptor,plane,normal1,normal2>::AdvectionDiffusionEdgeDynamics3D (
00388         Dynamics<T,Descriptor>* baseDynamics, bool automaticPrepareCollision )
00389     : StoreDensityDynamics<T,Descriptor>(baseDynamics, automaticPrepareCollision)
00390 { }
00391 
00392 template<typename T, template<typename U> class Descriptor, int plane, int normal1, int normal2>
00393 AdvectionDiffusionEdgeDynamics3D<T,Descriptor,plane,normal1,normal2>::AdvectionDiffusionEdgeDynamics3D (
00394         HierarchicUnserializer& unserializer )
00395     : StoreDensityDynamics<T,Descriptor>(0, false)
00396 {
00397     unserialize(unserializer);
00398 }
00399 
00400 template<typename T, template<typename U> class Descriptor,  int plane, int normal1, int normal2>
00401 AdvectionDiffusionEdgeDynamics3D<T,Descriptor,plane,normal1,normal2>*
00402     AdvectionDiffusionEdgeDynamics3D<T,Descriptor, plane,normal1, normal2>::clone() const
00403 {
00404     return new AdvectionDiffusionEdgeDynamics3D<T,Descriptor,plane,normal1,normal2>(*this);
00405 }
00406 
00407 template<typename T, template<typename U> class Descriptor,  int plane, int normal1, int normal2>
00408 int AdvectionDiffusionEdgeDynamics3D<T,Descriptor,plane,normal1,normal2>::getId() const {
00409     return id;
00410 }
00411 
00412 template<typename T, template<typename U> class Descriptor,  int plane, int normal1, int normal2>
00413 void AdvectionDiffusionEdgeDynamics3D<T,Descriptor,plane,normal1,normal2>::serialize(HierarchicSerializer& serializer) const
00414 {
00415     StoreDensityDynamics<T,Descriptor>::serialize(serializer);
00416 }
00417 
00418 template<typename T, template<typename U> class Descriptor,  int plane, int normal1, int normal2>
00419 void AdvectionDiffusionEdgeDynamics3D<T,Descriptor,plane,normal1,normal2>::unserialize(HierarchicUnserializer& unserializer)
00420 {
00421     StoreDensityDynamics<T,Descriptor>::unserialize(unserializer);
00422 }
00423 
00424 template<typename T, template<typename U> class Descriptor, int plane, int normal1, int normal2>
00425 void AdvectionDiffusionEdgeDynamics3D<T,Descriptor,plane,normal1, normal2>::completePopulations(Cell<T,Descriptor>& cell) const
00426 {
00427     typedef Descriptor<T> D;
00428     typedef advectionDiffusionDynamicsTemplates<T,Descriptor> adTempl;
00429     
00430     T rhoBar = this->computeRhoBar(cell);
00431     T* u = cell.getExternal(Descriptor<T>::ExternalField::velocityBeginsAt);
00432     Array<T,D::d> jEq;
00433     for (plint iD = 0; iD < D::d; ++iD)
00434     {
00435         jEq[iD] = D::fullRho(rhoBar) * u[iD];
00436     }
00437     // I need to get Missing information on the corners !!!!
00438     std::vector<plint> unknownIndexes = utilAdvDiff::subIndexOutgoing3DonEdges<D,plane,normal1, normal2>();
00439     // here I know all missing and non missing f_i
00440     
00441     // The collision procedure for D2Q5 and D3Q7 lattice is the same ...
00442     // Given the rule f_i_neq = -f_opposite(i)_neq
00443     // I have the right number of equations for the number of unknowns using these lattices 
00444     
00445     for (pluint iPop = 0; iPop < unknownIndexes.size(); ++iPop)
00446     {
00447         cell[unknownIndexes[iPop]] = 
00448                 adTempl::bgk_ma1_equilibrium(unknownIndexes[iPop], rhoBar, jEq) 
00449                 -(cell[indexTemplates::opposite<D>(unknownIndexes[iPop])]
00450                 - adTempl::bgk_ma1_equilibrium(indexTemplates::opposite<D>(unknownIndexes[iPop]), rhoBar, jEq) ) ;
00451     }
00452 }
00453 
00454 }  // namespace plb
00455 
00456 #endif  // ADVECTION_DIFFUSION_BOUNDARIES_HH