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

advectionDiffusionBoundaryInstantiator2D.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 
00025 /* Main author: Orestis Malaspinas
00026  */
00027 
00029 #ifndef ADVECTION_DIFFUSION_BOUNDARY_INSTANTIATOR_2D_H
00030 #define ADVECTION_DIFFUSION_BOUNDARY_INSTANTIATOR_2D_H
00031 
00032 #include "core/globalDefs.h"
00033 #include "core/cell.h"
00034 #include "core/geometry2D.h"
00035 #include "dataProcessors/dataInitializerFunctional2D.h"
00036 #include "complexDynamics/advectionDiffusionBoundaryCondition2D.h"
00037 
00038 namespace plb {
00039 
00040 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00041 class AdvectionDiffusionBoundaryConditionInstantiator2D : 
00042         public OnLatticeAdvectionDiffusionBoundaryCondition2D<T,Descriptor> 
00043 {
00044 public:
00045     AdvectionDiffusionBoundaryConditionInstantiator2D();
00046 
00047     void addTemperatureBoundary0N(Box2D domain, BlockLattice2D<T,Descriptor>& lattice);
00048     void addTemperatureBoundary0P(Box2D domain, BlockLattice2D<T,Descriptor>& lattice);
00049     void addTemperatureBoundary1N(Box2D domain, BlockLattice2D<T,Descriptor>& lattice);
00050     void addTemperatureBoundary1P(Box2D domain, BlockLattice2D<T,Descriptor>& lattice);
00051 
00052     void addTemperatureCornerNN(plint x, plint y, BlockLattice2D<T,Descriptor>& lattice);
00053     void addTemperatureCornerNP(plint x, plint y, BlockLattice2D<T,Descriptor>& lattice);
00054     void addTemperatureCornerPN(plint x, plint y, BlockLattice2D<T,Descriptor>& lattice);
00055     void addTemperatureCornerPP(plint x, plint y, BlockLattice2D<T,Descriptor>& lattice);
00056 
00057     void addTemperatureBoundary0N(Box2D domain, MultiBlockLattice2D<T,Descriptor>& lattice);
00058     void addTemperatureBoundary0P(Box2D domain, MultiBlockLattice2D<T,Descriptor>& lattice);
00059     void addTemperatureBoundary1N(Box2D domain, MultiBlockLattice2D<T,Descriptor>& lattice);
00060     void addTemperatureBoundary1P(Box2D domain, MultiBlockLattice2D<T,Descriptor>& lattice);
00061 
00062     void addTemperatureCornerNN(plint x, plint y, MultiBlockLattice2D<T,Descriptor>& lattice);
00063     void addTemperatureCornerNP(plint x, plint y, MultiBlockLattice2D<T,Descriptor>& lattice);
00064     void addTemperatureCornerPN(plint x, plint y, MultiBlockLattice2D<T,Descriptor>& lattice);
00065     void addTemperatureCornerPP(plint x, plint y, MultiBlockLattice2D<T,Descriptor>& lattice);
00066 
00067 private:
00068     template<int direction, int orientation>
00069         void addTemperatureBoundary(Box2D domain, BlockLattice2D<T,Descriptor>& lattice);
00070     template<int normalX, int normalY>
00071         void addTemperatureCorner(plint x, plint y, BlockLattice2D<T,Descriptor>& lattice);
00072 
00073     template<int direction, int orientation>
00074         void addTemperatureBoundary(Box2D domain, MultiBlockLattice2D<T,Descriptor>& lattice);
00075     template<int normalX, int normalY>
00076         void addTemperatureCorner(plint x, plint y, MultiBlockLattice2D<T,Descriptor>& lattice);
00077 };
00078 
00080 
00081 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00082 AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00083         AdvectionDiffusionBoundaryConditionInstantiator2D()
00084 { }
00085 
00086 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00087 template<int direction, int orientation>
00088 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00089     addTemperatureBoundary(Box2D domain, BlockLattice2D<T,Descriptor>& lattice)
00090 {
00091     PLB_PRECONDITION(domain.x0==domain.x1 || domain.y0==domain.y1);
00092 
00093     setCompositeDynamics (
00094             lattice, domain,
00095             BoundaryManager::template getAdvectionDiffusionBoundaryDynamics<direction,orientation>(new NoDynamics<T,Descriptor>) );
00096 
00097     DataProcessorGenerator2D* generator
00098         = BoundaryManager::template getAdvectionDiffusionBoundaryProcessor<direction,orientation>(domain);
00099     if (generator) {
00100         addInternalProcessor(*generator, lattice);
00101         delete generator;
00102     }
00103 }
00104 
00105 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00106 template<int xNormal, int yNormal>
00107 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00108     addTemperatureCorner(plint x, plint y, BlockLattice2D<T,Descriptor>& lattice)
00109 {
00110     setCompositeDynamics (
00111             lattice, Box2D(x,x,y,y),
00112             BoundaryManager::template getAdvectionDiffusionCornerDynamics<xNormal,yNormal>(new NoDynamics<T,Descriptor>) );
00113 
00114     DataProcessorGenerator2D* generator
00115         = BoundaryManager::template getAdvectionDiffusionCornerProcessor<xNormal,yNormal>(x, y);
00116     if (generator) {
00117         addInternalProcessor(*generator, lattice);
00118         delete generator;
00119     }
00120 }
00121 
00122 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00123 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00124     addTemperatureBoundary0N(Box2D domain, BlockLattice2D<T,Descriptor>& lattice)
00125 {
00126     addTemperatureBoundary<0,-1>(domain, lattice);
00127 }
00128 
00129 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00130 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00131     addTemperatureBoundary0P(Box2D domain, BlockLattice2D<T,Descriptor>& lattice)
00132 {
00133     addTemperatureBoundary<0,1>(domain, lattice);
00134 }
00135 
00136 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00137 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00138     addTemperatureBoundary1N(Box2D domain, BlockLattice2D<T,Descriptor>& lattice)
00139 {
00140     addTemperatureBoundary<1,-1>(domain, lattice);
00141 }
00142 
00143 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00144 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00145     addTemperatureBoundary1P(Box2D domain, BlockLattice2D<T,Descriptor>& lattice)
00146 {
00147     addTemperatureBoundary<1,1>(domain, lattice);
00148 }
00149 
00150 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00151 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00152     addTemperatureCornerNN(plint x, plint y, BlockLattice2D<T,Descriptor>& lattice)
00153 {
00154     addTemperatureCorner<-1,-1>(x,y, lattice);
00155 }
00156 
00157 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00158 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00159     addTemperatureCornerNP(plint x, plint y, BlockLattice2D<T,Descriptor>& lattice)
00160 {
00161     addTemperatureCorner<-1,1>(x,y, lattice);
00162 }
00163 
00164 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00165 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00166     addTemperatureCornerPN(plint x, plint y, BlockLattice2D<T,Descriptor>& lattice)
00167 {
00168     addTemperatureCorner<1,-1>(x,y, lattice);
00169 }
00170 
00171 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00172 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00173     addTemperatureCornerPP(plint x, plint y, BlockLattice2D<T,Descriptor>& lattice)
00174 {
00175     addTemperatureCorner<1,1>(x,y, lattice);
00176 }
00177 
00178 
00179 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00180 template<int direction, int orientation>
00181 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00182     addTemperatureBoundary(Box2D domain, MultiBlockLattice2D<T,Descriptor>& lattice)
00183 {
00184     PLB_PRECONDITION(domain.x0==domain.x1 || domain.y0==domain.y1);
00185 
00186     setCompositeDynamics (
00187             lattice, domain,
00188             BoundaryManager::template getAdvectionDiffusionBoundaryDynamics<direction,orientation>(new NoDynamics<T,Descriptor>) );
00189 
00190     DataProcessorGenerator2D* generator
00191         = BoundaryManager::template getAdvectionDiffusionBoundaryProcessor<direction,orientation>(domain);
00192     if (generator) {
00193         addInternalProcessor(*generator, lattice);
00194         delete generator;
00195     }
00196 }
00197 
00198 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00199 template<int xNormal, int yNormal>
00200 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00201     addTemperatureCorner(plint x, plint y, MultiBlockLattice2D<T,Descriptor>& lattice)
00202 {
00203     setCompositeDynamics (
00204             lattice, Box2D(x,x,y,y),
00205             BoundaryManager::template getAdvectionDiffusionCornerDynamics<xNormal,yNormal>(new NoDynamics<T,Descriptor>) );
00206 
00207     DataProcessorGenerator2D* generator
00208         = BoundaryManager::template getAdvectionDiffusionCornerProcessor<xNormal,yNormal>(x, y);
00209     if (generator) {
00210         addInternalProcessor(*generator, lattice);
00211         delete generator;
00212     }
00213 }
00214 
00215 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00216 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00217     addTemperatureBoundary0N(Box2D domain, MultiBlockLattice2D<T,Descriptor>& lattice)
00218 {
00219     addTemperatureBoundary<0,-1>(domain, lattice);
00220 }
00221 
00222 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00223 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00224     addTemperatureBoundary0P(Box2D domain, MultiBlockLattice2D<T,Descriptor>& lattice)
00225 {
00226     addTemperatureBoundary<0,1>(domain, lattice);
00227 }
00228 
00229 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00230 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00231     addTemperatureBoundary1N(Box2D domain, MultiBlockLattice2D<T,Descriptor>& lattice)
00232 {
00233     addTemperatureBoundary<1,-1>(domain, lattice);
00234 }
00235 
00236 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00237 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00238     addTemperatureBoundary1P(Box2D domain, MultiBlockLattice2D<T,Descriptor>& lattice)
00239 {
00240     addTemperatureBoundary<1,1>(domain, lattice);
00241 }
00242 
00243 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00244 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00245     addTemperatureCornerNN(plint x, plint y, MultiBlockLattice2D<T,Descriptor>& lattice)
00246 {
00247     addTemperatureCorner<-1,-1>(x,y, lattice);
00248 }
00249 
00250 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00251 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00252     addTemperatureCornerNP(plint x, plint y, MultiBlockLattice2D<T,Descriptor>& lattice)
00253 {
00254     addTemperatureCorner<-1,1>(x,y, lattice);
00255 }
00256 
00257 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00258 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00259     addTemperatureCornerPN(plint x, plint y, MultiBlockLattice2D<T,Descriptor>& lattice)
00260 {
00261     addTemperatureCorner<1,-1>(x,y, lattice);
00262 }
00263 
00264 template<typename T, template<typename U> class Descriptor, class BoundaryManager>
00265 void AdvectionDiffusionBoundaryConditionInstantiator2D<T,Descriptor,BoundaryManager>::
00266     addTemperatureCornerPP(plint x, plint y, MultiBlockLattice2D<T,Descriptor>& lattice)
00267 {
00268     addTemperatureCorner<1,1>(x,y, lattice);
00269 }
00270 
00271 }
00272 
00273 #endif