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

neumannCondition2D.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 
00028 #ifndef NEUMANN_CONDITION_2D_HH
00029 #define NEUMANN_CONDITION_2D_HH
00030 
00031 #include "boundaryCondition/neumannCondition2D.h"
00032 #include "latticeBoltzmann/indexTemplates.h"
00033 
00034 namespace plb {
00035 
00036 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00037 void CopyUnknownPopulationsFunctional2D<T,Descriptor,direction,orientation>::process (
00038         Box2D domain, BlockLattice2D<T,Descriptor>& lattice )
00039 {
00040     std::vector<plint> const& unknownIndices
00041         = indexTemplates::subIndex<Descriptor<T>, direction, -orientation>();
00042     enum {
00043         normalX = direction==0 ? orientation : 0,
00044         normalY = direction==1 ? orientation : 0
00045     };
00046     for (plint iX=domain.x0; iX<=domain.x1; ++iX) {
00047         for (plint iY=domain.y0; iY<=domain.y1; ++iY) {
00048             for (pluint fIndex=0; fIndex<unknownIndices.size(); ++fIndex) {
00049                 plint iPop = unknownIndices[fIndex];
00050                 lattice.get(iX,iY)[iPop] = lattice.get(iX-normalX, iY-normalY)[iPop];
00051             }
00052         }
00053     }
00054 }
00055 
00056 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00057 CopyUnknownPopulationsFunctional2D<T,Descriptor,direction,orientation>*
00058     CopyUnknownPopulationsFunctional2D<T,Descriptor,direction,orientation>::clone() const
00059 {
00060     return new CopyUnknownPopulationsFunctional2D<T,Descriptor,direction,orientation>(*this);
00061 }
00062 
00063 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00064 void CopyUnknownPopulationsFunctional2D<T,Descriptor,direction,orientation>::
00065          getTypeOfModification(std::vector<modif::ModifT>& modified) const
00066 {
00067     modified[0] = modif::staticVariables;
00068 }
00069 
00070 template<typename T, template<typename U> class Descriptor, int direction, int orientation>
00071 BlockDomain::DomainT CopyUnknownPopulationsFunctional2D<T,Descriptor,direction,orientation>::appliesTo() const {
00072     return BlockDomain::bulk;
00073 }
00074 
00075 
00076 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00077 void CopyAllPopulationsFunctional2D<T,Descriptor,normalX,normalY>::process (
00078         Box2D domain, BlockLattice2D<T,Descriptor>& lattice )
00079 {
00080     for (plint iX=domain.x0; iX<=domain.x1; ++iX) {
00081         for (plint iY=domain.y0; iY<=domain.y1; ++iY) {
00082             for (plint iPop=0; iPop<Descriptor<T>::q; ++iPop) {
00083                 lattice.get(iX,iY)[iPop] = lattice.get(iX-normalX, iY-normalY)[iPop];
00084             }
00085         }
00086     }
00087 }
00088 
00089 
00090 template<typename T, template<typename U> class Descriptor, int normalX, int normalY>
00091 CopyAllPopulationsFunctional2D<T,Descriptor,normalX,normalY>*
00092     CopyAllPopulationsFunctional2D<T,Descriptor,normalX,normalY>::clone() const
00093 {
00094     return new CopyAllPopulationsFunctional2D<T,Descriptor,normalX,normalY>(*this);
00095 }
00096 
00097 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00098 void CopyAllPopulationsFunctional2D<T,Descriptor, normalX,normalY>::
00099          getTypeOfModification(std::vector<modif::ModifT>& modified) const
00100 {
00101     modified[0] = modif::staticVariables;
00102 }
00103 
00104 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00105 BlockDomain::DomainT CopyAllPopulationsFunctional2D<T,Descriptor,normalX,normalY>::appliesTo() const {
00106     return BlockDomain::bulk;
00107 }
00108 
00109 
00110 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00111 void CopyVelocityFunctional2D<T,Descriptor,normalX,normalY>::process (
00112         Box2D domain, BlockLattice2D<T,Descriptor>& lattice )
00113 {
00114     for (plint iX=domain.x0; iX<=domain.x1; ++iX) {
00115         for (plint iY=domain.y0; iY<=domain.y1; ++iY) {
00116             Array<T,Descriptor<T>::d> u;
00117             lattice.get(iX-normalX, iY-normalY).computeVelocity(u);
00118             lattice.get(iX,iY).defineVelocity(u);
00119         }
00120     }
00121 }
00122 
00123 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00124 CopyVelocityFunctional2D<T,Descriptor,normalX,normalY>*
00125     CopyVelocityFunctional2D<T,Descriptor,normalX,normalY>::clone() const
00126 {
00127     return new CopyVelocityFunctional2D<T,Descriptor,normalX,normalY>(*this);
00128 }
00129 
00130 
00131 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00132 void CopyVelocityFunctional2D<T,Descriptor, normalX,normalY>::
00133          getTypeOfModification(std::vector<modif::ModifT>& modified) const
00134 {
00135     modified[0] = modif::dynamicVariables;
00136 }
00137 
00138 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00139 BlockDomain::DomainT CopyVelocityFunctional2D<T,Descriptor,normalX,normalY>::appliesTo() const {
00140     return BlockDomain::bulk;
00141 }
00142 
00143 
00144 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00145 void CopyTangentialVelocityFunctional2D<T,Descriptor,normalX,normalY>::process (
00146         Box2D domain, BlockLattice2D<T,Descriptor>& lattice )
00147 {
00148     for (plint iX=domain.x0; iX<=domain.x1; ++iX) {
00149         for (plint iY=domain.y0; iY<=domain.y1; ++iY) {
00150             Array<T,Descriptor<T>::d> u;
00151             lattice.get(iX-normalX, iY-normalY).computeVelocity(u);
00152             if (normalX!=0) {
00153                 u[0] = T();
00154             }
00155             if (normalY!=0) {
00156                 u[1] = T();
00157             }
00158             lattice.get(iX,iY).defineVelocity(u);
00159         }
00160     }
00161 }
00162 
00163 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00164 CopyTangentialVelocityFunctional2D<T,Descriptor,normalX,normalY>*
00165     CopyTangentialVelocityFunctional2D<T,Descriptor,normalX,normalY>::clone() const
00166 {
00167     return new CopyTangentialVelocityFunctional2D<T,Descriptor,normalX,normalY>(*this);
00168 }
00169 
00170 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00171 BlockDomain::DomainT CopyTangentialVelocityFunctional2D<T,Descriptor,normalX,normalY>::appliesTo() const {
00172     return BlockDomain::bulk;
00173 }
00174 
00175 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00176 void CopyTangentialVelocityFunctional2D<T,Descriptor, normalX,normalY>::
00177          getTypeOfModification(std::vector<modif::ModifT>& modified) const
00178 {
00179     modified[0] = modif::dynamicVariables;
00180 }
00181 
00182 
00183 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00184 void CopyNormalVelocityFunctional2D<T,Descriptor,normalX,normalY>::process (
00185         Box2D domain, BlockLattice2D<T,Descriptor>& lattice )
00186 {
00187     for (plint iX=domain.x0; iX<=domain.x1; ++iX) {
00188         for (plint iY=domain.y0; iY<=domain.y1; ++iY) {
00189             Array<T,Descriptor<T>::d> u;
00190             lattice.get(iX-normalX, iY-normalY).computeVelocity(u);
00191             if (normalX==0) {
00192                 u[0] = T();
00193             }
00194             if (normalY==0) {
00195                 u[1] = T();
00196             }
00197             lattice.get(iX,iY).defineVelocity(u);
00198         }
00199     }
00200 }
00201 
00202 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00203 CopyNormalVelocityFunctional2D<T,Descriptor,normalX,normalY>*
00204     CopyNormalVelocityFunctional2D<T,Descriptor,normalX,normalY>::clone() const
00205 {
00206     return new CopyNormalVelocityFunctional2D<T,Descriptor,normalX,normalY>(*this);
00207 }
00208 
00209 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00210 void CopyNormalVelocityFunctional2D<T,Descriptor, normalX,normalY>::
00211          getTypeOfModification(std::vector<modif::ModifT>& modified) const
00212 {
00213     modified[0] = modif::dynamicVariables;
00214 }
00215 
00216 
00217 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00218 BlockDomain::DomainT CopyNormalVelocityFunctional2D<T,Descriptor,normalX,normalY>::appliesTo() const {
00219     return BlockDomain::bulk;
00220 }
00221 
00222 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00223 void CopyDensityFunctional2D<T,Descriptor,normalX,normalY>::process (
00224         Box2D domain, BlockLattice2D<T,Descriptor>& lattice )
00225 {
00226     for (plint iX=domain.x0; iX<=domain.x1; ++iX) {
00227         for (plint iY=domain.y0; iY<=domain.y1; ++iY) {
00228             lattice.get(iX,iY).defineDensity (
00229                     lattice.get(iX-normalX, iY-normalY).computeDensity() );
00230         }
00231     }
00232 }
00233 
00234 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00235 CopyDensityFunctional2D<T,Descriptor,normalX,normalY>*
00236     CopyDensityFunctional2D<T,Descriptor,normalX,normalY>::clone() const
00237 {
00238     return new CopyDensityFunctional2D<T,Descriptor,normalX,normalY>(*this);
00239 }
00240 
00241 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00242 void CopyDensityFunctional2D<T,Descriptor, normalX,normalY>::
00243          getTypeOfModification(std::vector<modif::ModifT>& modified) const
00244 {
00245     modified[0] = modif::dynamicVariables;
00246 }
00247 
00248 template<typename T, template<typename U> class Descriptor, int normalX, int normalY> 
00249 BlockDomain::DomainT CopyDensityFunctional2D<T,Descriptor,normalX,normalY>::appliesTo() const {
00250     return BlockDomain::bulk;
00251 }
00252 
00253 }  // namespace plb
00254 
00255 #endif  // NEUMANN_CONDITION_2D_HH