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

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