$treeview $search $mathjax
|
Palabos
Version 1.1
$projectbrief
|
$projectbrief
|
$searchbox |
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 NLD_BOUNDARIES_3D_HH 00030 #define NLD_BOUNDARIES_3D_HH 00031 00032 #include "core/globalDefs.h" 00033 #include "boundaryCondition/NLD_boundaries3D.h" 00034 #include "core/processorIdentifiers3D.h" 00035 #include "core/nonLocalDynamics3D.h" 00036 #include "core/blockSurface3D.h" 00037 00038 namespace plb { 00039 00041 00042 template<typename T, template<typename U> class Descriptor> 00043 const int ExecutePlaneNLD_3D<T,Descriptor>::staticId = 00044 meta::registerProcessor3D < ExecutePlaneNLD_3D<T, Descriptor>, 00045 T, Descriptor> (std::string("ExecutePlaneNLD_3D")); 00046 00047 template<typename T, template<typename U> class Descriptor> 00048 ExecutePlaneNLD_3D<T,Descriptor>::ExecutePlaneNLD_3D() 00049 : direction(0), orientation(0) 00050 { } 00051 00052 template<typename T, template<typename U> class Descriptor> 00053 ExecutePlaneNLD_3D<T,Descriptor>::ExecutePlaneNLD_3D(int direction_, int orientation_) 00054 : direction(direction_), 00055 orientation(orientation_) 00056 { } 00057 00058 template<typename T, template<typename U> class Descriptor> 00059 void ExecutePlaneNLD_3D<T,Descriptor>::process ( 00060 Box3D domain, BlockLattice3D<T,Descriptor>& lattice ) 00061 { 00062 for (plint iX=domain.x0; iX<=domain.x1; ++iX) { 00063 for (plint iY=domain.y0; iY<=domain.y1; ++iY) { 00064 for (plint iZ=domain.z0; iZ<=domain.z1; ++iZ) { 00065 NonLocalBoundaryDynamics3D<T,Descriptor>* dynamics = 00066 dynamic_cast<NonLocalBoundaryDynamics3D<T,Descriptor>*> ( 00067 &lattice.get(iX,iY,iZ).getDynamics() ); 00068 if (dynamics) { 00069 dynamics->planeBoundaryCompletion(direction, orientation, iX,iY,iZ, lattice); 00070 } 00071 } 00072 } 00073 } 00074 } 00075 00076 template<typename T, template<typename U> class Descriptor> 00077 ExecutePlaneNLD_3D<T,Descriptor>* 00078 ExecutePlaneNLD_3D<T,Descriptor>::clone() const 00079 { 00080 return new ExecutePlaneNLD_3D<T,Descriptor>(*this); 00081 } 00082 00083 template<typename T, template<typename U> class Descriptor> 00084 void ExecutePlaneNLD_3D<T,Descriptor>::serialize(std::string& data) const { 00085 std::string newData = util::val2str(direction,orientation); 00086 data += newData + " "; 00087 } 00088 00089 template<typename T, template<typename U> class Descriptor> 00090 void ExecutePlaneNLD_3D<T,Descriptor>::unserialize(std::string& data) { 00091 data = util::consume(data, direction,orientation); 00092 } 00093 00094 00096 00097 template<typename T, template<typename U> class Descriptor> 00098 const int ExecuteEdgeNLD_3D<T,Descriptor>::staticId = 00099 meta::registerProcessor3D < ExecuteEdgeNLD_3D<T, Descriptor>, 00100 T, Descriptor> (std::string("ExecuteEdgeNLD_3D")); 00101 00102 template<typename T, template<typename U> class Descriptor> 00103 ExecuteEdgeNLD_3D<T,Descriptor>::ExecuteEdgeNLD_3D() 00104 : plane(0), 00105 normal1(0), 00106 normal2(0) 00107 { } 00108 00109 template<typename T, template<typename U> class Descriptor> 00110 ExecuteEdgeNLD_3D<T,Descriptor>::ExecuteEdgeNLD_3D ( 00111 int plane_, int normal1_, int normal2_ ) 00112 : plane(plane_), 00113 normal1(normal1_), 00114 normal2(normal2_) 00115 { } 00116 00117 template<typename T, template<typename U> class Descriptor> 00118 void ExecuteEdgeNLD_3D<T,Descriptor>::process ( 00119 Box3D domain, BlockLattice3D<T,Descriptor>& lattice ) 00120 { 00121 for (plint iX=domain.x0; iX<=domain.x1; ++iX) { 00122 for (plint iY=domain.y0; iY<=domain.y1; ++iY) { 00123 for (plint iZ=domain.z0; iZ<=domain.z1; ++iZ) { 00124 NonLocalBoundaryDynamics3D<T,Descriptor>* dynamics = 00125 dynamic_cast<NonLocalBoundaryDynamics3D<T,Descriptor>*> ( 00126 &lattice.get(iX,iY,iZ).getDynamics() ); 00127 if (dynamics) { 00128 dynamics->edgeBoundaryCompletion(plane,normal1,normal2, iX,iY,iZ, lattice); 00129 } 00130 } 00131 } 00132 } 00133 } 00134 00135 template<typename T, template<typename U> class Descriptor> 00136 ExecuteEdgeNLD_3D<T,Descriptor>* 00137 ExecuteEdgeNLD_3D<T,Descriptor>::clone() const 00138 { 00139 return new ExecuteEdgeNLD_3D<T,Descriptor>(*this); 00140 } 00141 00142 template<typename T, template<typename U> class Descriptor> 00143 void ExecuteEdgeNLD_3D<T,Descriptor>::serialize(std::string& data) const { 00144 std::string newData = util::val2str(plane,normal1,normal2); 00145 data += newData + " "; 00146 } 00147 00148 template<typename T, template<typename U> class Descriptor> 00149 void ExecuteEdgeNLD_3D<T,Descriptor>::unserialize(std::string& data) { 00150 data = util::consume(data, plane,normal1,normal2); 00151 } 00152 00153 00155 00156 template<typename T, template<typename U> class Descriptor> 00157 const int ExecuteCornerNLD_3D<T,Descriptor>::staticId = 00158 meta::registerProcessor3D < ExecuteCornerNLD_3D<T, Descriptor>, 00159 T, Descriptor> (std::string("ExecuteCornerNLD_3D")); 00160 00161 template<typename T, template<typename U> class Descriptor> 00162 ExecuteCornerNLD_3D<T,Descriptor>::ExecuteCornerNLD_3D() 00163 : xNormal(0), 00164 yNormal(0), 00165 zNormal(0) 00166 { } 00167 00168 template<typename T, template<typename U> class Descriptor> 00169 ExecuteCornerNLD_3D<T,Descriptor>::ExecuteCornerNLD_3D ( 00170 int xNormal_, int yNormal_, int zNormal_ ) 00171 : xNormal(xNormal_), 00172 yNormal(yNormal_), 00173 zNormal(zNormal_) 00174 { } 00175 00176 template<typename T, template<typename U> class Descriptor> 00177 void ExecuteCornerNLD_3D<T,Descriptor>::process ( 00178 Box3D domain, BlockLattice3D<T,Descriptor>& lattice ) 00179 { 00180 for (plint iX=domain.x0; iX<=domain.x1; ++iX) { 00181 for (plint iY=domain.y0; iY<=domain.y1; ++iY) { 00182 for (plint iZ=domain.z0; iZ<=domain.z1; ++iZ) { 00183 NonLocalBoundaryDynamics3D<T,Descriptor>* dynamics = 00184 dynamic_cast<NonLocalBoundaryDynamics3D<T,Descriptor>*> ( 00185 &lattice.get(iX,iY,iZ).getDynamics() ); 00186 if (dynamics) { 00187 dynamics->cornerBoundaryCompletion(xNormal,yNormal,zNormal, iX,iY,iZ, lattice); 00188 } 00189 } 00190 } 00191 } 00192 } 00193 00194 template<typename T, template<typename U> class Descriptor> 00195 ExecuteCornerNLD_3D<T,Descriptor>* 00196 ExecuteCornerNLD_3D<T,Descriptor>::clone() const 00197 { 00198 return new ExecuteCornerNLD_3D<T,Descriptor>(*this); 00199 } 00200 00201 template<typename T, template<typename U> class Descriptor> 00202 void ExecuteCornerNLD_3D<T,Descriptor>::serialize(std::string& data) const { 00203 std::string newData = util::val2str(xNormal,yNormal,zNormal); 00204 data += newData + " "; 00205 } 00206 00207 template<typename T, template<typename U> class Descriptor> 00208 void ExecuteCornerNLD_3D<T,Descriptor>::unserialize(std::string& data) { 00209 data = util::consume(data, xNormal,yNormal,zNormal); 00210 } 00211 00212 00214 00215 template<typename T, template<typename U> class Descriptor> 00216 const int ExecuteNonLocalDynamics3D<T,Descriptor>::staticId = 00217 meta::registerProcessor3D < ExecuteNonLocalDynamics3D<T, Descriptor>, 00218 T, Descriptor> (std::string("ExecuteNonLocal3D")); 00219 00220 template<typename T, template<typename U> class Descriptor> 00221 void ExecuteNonLocalDynamics3D<T,Descriptor>::process ( 00222 Box3D domain, BlockLattice3D<T,Descriptor>& lattice ) 00223 { 00224 for (plint iX=domain.x0; iX<=domain.x1; ++iX) { 00225 for (plint iY=domain.y0; iY<=domain.y1; ++iY) { 00226 for (plint iZ=domain.z0; iZ<=domain.z1; ++iZ) { 00227 Dynamics<T,Descriptor>& dynamics = lattice.get(iX,iY,iZ).getDynamics(); 00228 if (dynamics.isNonLocal()) { 00229 NonLocalBoundaryDynamics3D<T,Descriptor>& nonLocalDynamics ( 00230 dynamic_cast<NonLocalBoundaryDynamics3D<T,Descriptor>&>(dynamics) ); 00231 nonLocalDynamics.nonLocalAction(iX,iY,iZ, lattice); 00232 } 00233 } 00234 } 00235 } 00236 } 00237 00238 template<typename T, template<typename U> class Descriptor> 00239 ExecuteNonLocalDynamics3D<T,Descriptor>* 00240 ExecuteNonLocalDynamics3D<T,Descriptor>::clone() const 00241 { 00242 return new ExecuteNonLocalDynamics3D<T,Descriptor>(*this); 00243 } 00244 00245 template<typename T, template<typename U> class Descriptor> 00246 void setOuterNLDboundaryDynamics ( 00247 MultiBlockLattice3D<T,Descriptor>& lattice, Dynamics<T,Descriptor>* baseDynamics, 00248 Box3D domain, boundary::BcType bcType ) 00249 { 00250 setOuterNLDboundaryDynamics(lattice, baseDynamics, lattice.getBoundingBox(), domain, bcType); 00251 } 00252 00253 template<typename T, template<typename U> class Descriptor> 00254 void setOuterNLDboundaryDynamics ( 00255 MultiBlockLattice3D<T,Descriptor>& lattice, Dynamics<T,Descriptor>* baseDynamics, 00256 Box3D bbox, Box3D domain, boundary::BcType bcType ) 00257 { 00258 Box3D domain1(bbox.x0, bbox.x0, bbox.y0, bbox.y1, bbox.z0, bbox.z1); 00259 Box3D domain2(bbox.x1, bbox.x1, bbox.y0, bbox.y1, bbox.z0, bbox.z1); 00260 Box3D domain3(bbox.x0+1, bbox.x1-1, bbox.y0, bbox.y0, bbox.z0, bbox.z1); 00261 Box3D domain4(bbox.x0+1, bbox.x1-1, bbox.y1, bbox.y1, bbox.z0, bbox.z1); 00262 Box3D domain5(bbox.x0+1, bbox.x1-1, bbox.y0+1, bbox.y1-1, bbox.z0, bbox.z0); 00263 Box3D domain6(bbox.x0+1, bbox.x1-1, bbox.y0+1, bbox.y1-1, bbox.z1, bbox.z1); 00264 Box3D intersection; 00265 Dynamics<T,Descriptor>* dynamicsTemplate = 0; 00266 switch (bcType) { 00267 case boundary::dirichlet: 00268 dynamicsTemplate = new NLD_VelocityBoundaryDynamics3D<T,Descriptor>(baseDynamics); 00269 break; 00270 case boundary::neumann: 00271 dynamicsTemplate = new NLD_VelocityNeumannBoundaryDynamics3D<T,Descriptor>(baseDynamics); 00272 break; 00273 default: 00274 PLB_ASSERT(0); // Boundary type not implemented. 00275 } 00276 if (intersect(domain, domain1, intersection)) { 00277 defineDynamics(lattice, intersection, dynamicsTemplate->clone()); 00278 } 00279 if (intersect(domain, domain2, intersection)) { 00280 defineDynamics(lattice, intersection, dynamicsTemplate->clone()); 00281 } 00282 if (intersect(domain, domain3, intersection)) { 00283 defineDynamics(lattice, intersection, dynamicsTemplate->clone()); 00284 } 00285 if (intersect(domain, domain4, intersection)) { 00286 defineDynamics(lattice, intersection, dynamicsTemplate->clone()); 00287 } 00288 if (intersect(domain, domain5, intersection)) { 00289 defineDynamics(lattice, intersection, dynamicsTemplate->clone()); 00290 } 00291 if (intersect(domain, domain6, intersection)) { 00292 defineDynamics(lattice, intersection, dynamicsTemplate->clone()); 00293 } 00294 delete dynamicsTemplate; 00295 } 00296 00297 template<typename T, template<typename U> class Descriptor> 00298 void instantiateOuterNLDboundary(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D bbox) 00299 { 00300 BlockSurface3D surf(bbox, 1); 00301 integrateProcessingFunctional ( 00302 new ExecutePlaneNLD_3D<T,Descriptor>(0,-1), surf.surface0N(), lattice ); 00303 integrateProcessingFunctional ( 00304 new ExecutePlaneNLD_3D<T,Descriptor>(0,+1), surf.surface0P(), lattice ); 00305 integrateProcessingFunctional ( 00306 new ExecutePlaneNLD_3D<T,Descriptor>(1,-1), surf.surface1N(), lattice ); 00307 integrateProcessingFunctional ( 00308 new ExecutePlaneNLD_3D<T,Descriptor>(1,+1), surf.surface1P(), lattice ); 00309 integrateProcessingFunctional ( 00310 new ExecutePlaneNLD_3D<T,Descriptor>(2,-1), surf.surface2N(), lattice ); 00311 integrateProcessingFunctional ( 00312 new ExecutePlaneNLD_3D<T,Descriptor>(2,+1), surf.surface2P(), lattice ); 00313 00314 integrateProcessingFunctional ( 00315 new ExecuteEdgeNLD_3D<T,Descriptor>(0, -1, -1), surf.edge0NN(), lattice ); 00316 integrateProcessingFunctional ( 00317 new ExecuteEdgeNLD_3D<T,Descriptor>(0, -1, 1), surf.edge0NP(), lattice ); 00318 integrateProcessingFunctional ( 00319 new ExecuteEdgeNLD_3D<T,Descriptor>(0, 1, -1), surf.edge0PN(), lattice ); 00320 integrateProcessingFunctional ( 00321 new ExecuteEdgeNLD_3D<T,Descriptor>(0, 1, 1), surf.edge0PP(), lattice ); 00322 integrateProcessingFunctional ( 00323 new ExecuteEdgeNLD_3D<T,Descriptor>(1, -1, -1), surf.edge1NN(), lattice ); 00324 integrateProcessingFunctional ( 00325 new ExecuteEdgeNLD_3D<T,Descriptor>(1, -1, 1), surf.edge1NP(), lattice ); 00326 integrateProcessingFunctional ( 00327 new ExecuteEdgeNLD_3D<T,Descriptor>(1, 1, -1), surf.edge1PN(), lattice ); 00328 integrateProcessingFunctional ( 00329 new ExecuteEdgeNLD_3D<T,Descriptor>(1, 1, 1), surf.edge1PP(), lattice ); 00330 integrateProcessingFunctional ( 00331 new ExecuteEdgeNLD_3D<T,Descriptor>(2, -1, -1), surf.edge2NN(), lattice ); 00332 integrateProcessingFunctional ( 00333 new ExecuteEdgeNLD_3D<T,Descriptor>(2, -1, 1), surf.edge2NP(), lattice ); 00334 integrateProcessingFunctional ( 00335 new ExecuteEdgeNLD_3D<T,Descriptor>(2, 1, -1), surf.edge2PN(), lattice ); 00336 integrateProcessingFunctional ( 00337 new ExecuteEdgeNLD_3D<T,Descriptor>(2, 1, 1), surf.edge2PP(), lattice ); 00338 00339 integrateProcessingFunctional ( 00340 new ExecuteCornerNLD_3D<T,Descriptor>(-1, -1, -1), surf.cornerNNN(), lattice ); 00341 integrateProcessingFunctional ( 00342 new ExecuteCornerNLD_3D<T,Descriptor>(-1, -1, 1), surf.cornerNNP(), lattice ); 00343 integrateProcessingFunctional ( 00344 new ExecuteCornerNLD_3D<T,Descriptor>(-1, 1, -1), surf.cornerNPN(), lattice ); 00345 integrateProcessingFunctional ( 00346 new ExecuteCornerNLD_3D<T,Descriptor>(-1, 1, 1), surf.cornerNPP(), lattice ); 00347 integrateProcessingFunctional ( 00348 new ExecuteCornerNLD_3D<T,Descriptor>(1, -1, -1), surf.cornerPNN(), lattice ); 00349 integrateProcessingFunctional ( 00350 new ExecuteCornerNLD_3D<T,Descriptor>(1, -1, 1), surf.cornerPNP(), lattice ); 00351 integrateProcessingFunctional ( 00352 new ExecuteCornerNLD_3D<T,Descriptor>(1, 1, -1), surf.cornerPPN(), lattice ); 00353 integrateProcessingFunctional ( 00354 new ExecuteCornerNLD_3D<T,Descriptor>(1, 1, 1), surf.cornerPPP(), lattice ); 00355 } 00356 00357 00358 00359 } // namespace plb 00360 00361 #endif // NLD_BOUNDARIES_3D_HH
1.6.3
1.6.3