$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 00028 #ifndef DATA_INITIALIZER_WRAPPER_3D_H 00029 #define DATA_INITIALIZER_WRAPPER_3D_H 00030 00031 #include "core/globalDefs.h" 00032 #include "atomicBlock/dataProcessorWrapper3D.h" 00033 #include "multiBlock/multiDataProcessorWrapper3D.h" 00034 #include "core/dynamics.h" 00035 #include "dataProcessors/dataInitializerFunctional3D.h" 00036 00037 namespace plb { 00038 00039 /* *************** PART I ******************************************** */ 00040 /* *************** Initialization of the block-lattice: atomic-blocks */ 00041 /* ******************************************************************* */ 00042 00043 template<typename T, template<class U> class Descriptor> 00044 void apply(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, OneCellFunctional3D<T,Descriptor>* f); 00045 00046 template<typename T, template<class U> class Descriptor> 00047 void applyIndexed(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00048 OneCellIndexedFunctional3D<T,Descriptor>* f); 00049 00050 template<typename T, template<class U> class Descriptor> 00051 void defineDynamics(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00052 Dynamics<T,Descriptor>* dynamics); 00053 00054 template<typename T, template<class U> class Descriptor> 00055 void defineDynamics(BlockLattice3D<T,Descriptor>& lattice, Box3D boundingBox, 00056 DomainFunctional3D* domain, Dynamics<T,Descriptor>* dynamics); 00057 00058 template<typename T, template<class U> class Descriptor> 00059 void defineDynamics(BlockLattice3D<T,Descriptor>& lattice, plint iX, plint iY, plint iZ, 00060 Dynamics<T,Descriptor>* dynamics); 00061 00062 template<typename T, template<class U> class Descriptor> 00063 void defineDynamics(BlockLattice3D<T,Descriptor>& lattice, DotList3D const& dotList, 00064 Dynamics<T,Descriptor>* dynamics); 00065 00066 template<typename T, template<typename U> class Descriptor> 00067 void defineDynamics( BlockLattice3D<T,Descriptor>& lattice, ScalarField3D<bool>& boolMask, 00068 Box3D domain, Dynamics<T,Descriptor>* dynamics, bool whichFlag ); 00069 00070 template<typename T, template<typename U> class Descriptor> 00071 void defineDynamics( BlockLattice3D<T,Descriptor>& lattice, ScalarField3D<bool>& boolMask, 00072 Dynamics<T,Descriptor>* dynamics, bool whichFlag ); 00073 00074 template<typename T, template<typename U> class Descriptor> 00075 void defineDynamics( BlockLattice3D<T,Descriptor>& lattice, ScalarField3D<int>& intMask, 00076 Box3D domain, Dynamics<T,Descriptor>* dynamics, int whichFlag ); 00077 00078 template<typename T, template<typename U> class Descriptor> 00079 void defineDynamics( BlockLattice3D<T,Descriptor>& lattice, ScalarField3D<int>& intMask, 00080 Dynamics<T,Descriptor>* dynamics, int whichFlag ); 00081 00082 template<typename T, template<typename U> class Descriptor> 00083 void recomposeFromFlowVariables ( BlockLattice3D<T,Descriptor>& lattice, 00084 ScalarField3D<T>& density, TensorField3D<T,3>& velocity, 00085 TensorField3D<T,6>& strainRate, Box3D domain ); 00086 00087 template<typename T, template<typename U> class Descriptor> 00088 void recomposeFromFlowVariables ( BlockLattice3D<T,Descriptor>& lattice, 00089 ScalarField3D<T>& density, TensorField3D<T,3>& velocity, 00090 TensorField3D<T,6>& strainRate ); 00091 00092 template<typename T, template<class U> class Descriptor> 00093 void setOmega(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, T omega); 00094 00095 template<typename T, template<class U> class Descriptor> 00096 void setBoundaryVelocity(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, Array<T,3> velocity); 00097 00098 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00099 template<typename T, template<class U> class Descriptor, class VelocityFunction> 00100 void setBoundaryVelocity(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, VelocityFunction f) { 00101 applyIndexed ( 00102 lattice, domain, 00103 new SetCustomBoundaryVelocityFunctional3D<T,Descriptor,VelocityFunction> (f) ); 00104 } 00105 00106 template<typename T, template<class U> class Descriptor> 00107 void setBoundaryDensity(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, T rho); 00108 00109 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00110 template<typename T, template<class U> class Descriptor, class DensityFunction> 00111 void setBoundaryDensity(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, DensityFunction f) { 00112 applyIndexed ( 00113 lattice, domain, 00114 new SetCustomBoundaryDensityFunctional3D<T,Descriptor,DensityFunction> (f) ); 00115 } 00116 00117 00118 template<typename T, template<class U> class Descriptor> 00119 void initializeAtEquilibrium(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00120 T density, Array<T,3> velocity); 00121 00122 template<typename T, template<class U> class Descriptor> 00123 void initializeAtEquilibrium(BlockLattice3D<T,Descriptor>& lattice, 00124 Box3D boundingBox, DomainFunctional3D* domain, 00125 T density, Array<T,3> velocity); 00126 00127 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00128 template<typename T, template<class U> class Descriptor, class RhoUFunction> 00129 void initializeAtEquilibrium(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, RhoUFunction f) { 00130 applyIndexed ( 00131 lattice, domain, 00132 new IniCustomEquilibriumFunctional3D<T,Descriptor,RhoUFunction> (f) ); 00133 } 00134 00135 template<typename T, template<class U> class Descriptor, class Function> 00136 void initializeAtEquilibrium(BlockLattice3D<T,Descriptor>& lattice, 00137 Box3D boundingBox, DomainFunctional3D* domain, Function f); 00138 00139 template<typename T, template<class U> class Descriptor> 00140 void stripeOffDensityOffset(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, T deltaRho); 00141 00142 00143 template<typename T, template<class U> class Descriptor> 00144 void setCompositeDynamics( BlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00145 CompositeDynamics<T,Descriptor>* compositeDynamics ); 00146 00147 template<typename T, template<class U> class Descriptor> 00148 void setExternalScalar( BlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00149 int whichScalar, T externalScalar ); 00150 00151 template<typename T, template<class U> class Descriptor> 00152 void setExternalVector( BlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00153 int vectorStartsAt, Array<T,Descriptor<T>::d> externalVector ); 00154 00155 00156 /* *************** PART II ******************************************* */ 00157 /* *************** Initialization of the block-lattice: multi-block ** */ 00158 /* ******************************************************************* */ 00159 00160 template<typename T, template<class U> class Descriptor> 00161 void apply(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, OneCellFunctional3D<T,Descriptor>* f); 00162 00163 template<typename T, template<class U> class Descriptor> 00164 void applyIndexed(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00165 OneCellIndexedFunctional3D<T,Descriptor>* f); 00166 00167 template<typename T, template<class U> class Descriptor> 00168 void defineDynamics(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00169 Dynamics<T,Descriptor>* dynamics); 00170 00171 template<typename T, template<class U> class Descriptor> 00172 void defineDynamics(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D boundingBox, 00173 DomainFunctional3D* domain, Dynamics<T,Descriptor>* dynamics); 00174 00175 template<typename T, template<class U> class Descriptor> 00176 void defineDynamics(MultiBlockLattice3D<T,Descriptor>& lattice, plint iX, plint iY, plint iZ, 00177 Dynamics<T,Descriptor>* dynamics); 00178 00179 template<typename T, template<class U> class Descriptor> 00180 void defineDynamics(MultiBlockLattice3D<T,Descriptor>& lattice, DotList3D const& dotList, 00181 Dynamics<T,Descriptor>* dynamics); 00182 00183 template<typename T, template<typename U> class Descriptor> 00184 void defineDynamics( MultiBlockLattice3D<T,Descriptor>& lattice, MultiScalarField3D<bool>& boolMask, 00185 Box3D domain, Dynamics<T,Descriptor>* dynamics, bool whichFlag ); 00186 00187 template<typename T, template<typename U> class Descriptor> 00188 void defineDynamics( MultiBlockLattice3D<T,Descriptor>& lattice, MultiScalarField3D<bool>& boolMask, 00189 Dynamics<T,Descriptor>* dynamics, bool whichFlag ); 00190 00191 template<typename T, template<typename U> class Descriptor> 00192 void defineDynamics( MultiBlockLattice3D<T,Descriptor>& lattice, MultiScalarField3D<int>& intMask, 00193 Box3D domain, Dynamics<T,Descriptor>* dynamics, int whichFlag ); 00194 00195 template<typename T, template<typename U> class Descriptor> 00196 void defineDynamics( MultiBlockLattice3D<T,Descriptor>& lattice, MultiScalarField3D<int>& intMask, 00197 Dynamics<T,Descriptor>* dynamics, int whichFlag ); 00198 00199 template<typename T, template<typename U> class Descriptor> 00200 void recomposeFromFlowVariables ( MultiBlockLattice3D<T,Descriptor>& lattice, 00201 MultiScalarField3D<T>& density, TensorField3D<T,3>& velocity, 00202 MultiTensorField3D<T,6>& strainRate, Box3D domain ); 00203 00204 template<typename T, template<typename U> class Descriptor> 00205 void recomposeFromFlowVariables ( MultiBlockLattice3D<T,Descriptor>& lattice, 00206 MultiScalarField3D<T>& density, TensorField3D<T,3>& velocity, 00207 MultiTensorField3D<T,6>& strainRate ); 00208 00209 template<typename T, template<class U> class Descriptor> 00210 void setOmega(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, T omega); 00211 00212 template<typename T, template<class U> class Descriptor> 00213 void setBoundaryVelocity(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, Array<T,3> velocity); 00214 00215 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00216 template<typename T, template<class U> class Descriptor, class VelocityFunction> 00217 void setBoundaryVelocity(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, VelocityFunction f) { 00218 applyIndexed ( 00219 lattice, domain, 00220 new SetCustomBoundaryVelocityFunctional3D<T,Descriptor,VelocityFunction> (f) ); 00221 } 00222 00223 template<typename T, template<class U> class Descriptor> 00224 void setBoundaryDensity(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, T rho); 00225 00226 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00227 template<typename T, template<class U> class Descriptor, class DensityFunction> 00228 void setBoundaryDensity(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, DensityFunction f) { 00229 applyIndexed ( 00230 lattice, domain, 00231 new SetCustomBoundaryDensityFunctional3D<T,Descriptor,DensityFunction> (f) ); 00232 } 00233 00234 00235 template<typename T, template<class U> class Descriptor> 00236 void initializeAtEquilibrium(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00237 T density, Array<T,3> velocity); 00238 00239 template<typename T, template<class U> class Descriptor> 00240 void initializeAtEquilibrium(MultiBlockLattice3D<T,Descriptor>& lattice, 00241 Box3D boundingBox, DomainFunctional3D* domain, 00242 T density, Array<T,3> velocity); 00243 00244 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00245 template<typename T, template<class U> class Descriptor, class RhoUFunction> 00246 void initializeAtEquilibrium(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, RhoUFunction f) { 00247 applyIndexed ( 00248 lattice, domain, 00249 new IniCustomEquilibriumFunctional3D<T,Descriptor,RhoUFunction> (f) ); 00250 } 00251 00252 template<typename T, template<class U> class Descriptor, class Function> 00253 void initializeAtEquilibrium(MultiBlockLattice3D<T,Descriptor>& lattice, 00254 Box3D boundingBox, DomainFunctional3D* domain, Function f); 00255 00256 00257 template<typename T, template<class U> class Descriptor> 00258 void initializeAtThermalEquilibrium(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00259 T density, Array<T,3> velocity, T temperature); 00260 00261 template<typename T, template<class U> class Descriptor> 00262 void initializeAtThermalEquilibrium(MultiBlockLattice3D<T,Descriptor>& lattice, 00263 Box3D boundingBox, DomainFunctional3D* domain, 00264 T density, Array<T,3> velocity, T temperature); 00265 00266 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00267 template<typename T, template<class U> class Descriptor, class RhoVelTempFunction> 00268 void initializeAtThermalEquilibrium(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, RhoVelTempFunction f) { 00269 applyIndexed ( 00270 lattice, domain, 00271 new IniCustomThermalEquilibriumFunctional3D<T,Descriptor,RhoVelTempFunction> (f) ); 00272 } 00273 00274 template<typename T, template<class U> class Descriptor, class Function> 00275 void initializeAtThermalEquilibrium(MultiBlockLattice3D<T,Descriptor>& lattice, 00276 Box3D boundingBox, DomainFunctional3D* domain, Function f); 00277 00278 template<typename T, template<class U> class Descriptor> 00279 void stripeOffDensityOffset(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, T deltaRho); 00280 00281 00282 template<typename T, template<class U> class Descriptor> 00283 void setCompositeDynamics( MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00284 CompositeDynamics<T,Descriptor>* compositeDynamics ); 00285 00286 template<typename T, template<class U> class Descriptor> 00287 void setExternalScalar( MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00288 int whichScalar, T externalScalar ); 00289 00290 template<typename T, template<class U> class Descriptor> 00291 void setExternalVector( MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00292 int vectorStartsAt, Array<T,Descriptor<T>::d> externalVector ); 00293 00294 template<typename T, template<class U> class Descriptor, int nDim> 00295 void setExternalVector( MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, 00296 int vectorStartsAt, MultiTensorField3D<T,nDim> &tensor ); 00297 00298 template<typename T, template<class U> class Descriptor> 00299 void interpolatePopulations ( 00300 MultiBlockLattice3D<T,Descriptor>& modifiedLattice, 00301 MultiBlockLattice3D<T,Descriptor>& constLattice, 00302 plint minIter, plint maxIter, Box3D const& domain ); 00303 00304 template<typename T, template<class U> class Descriptor> 00305 void interpolatePopulations ( 00306 MultiBlockLattice3D<T,Descriptor>& modifiedLattice, 00307 MultiBlockLattice3D<T,Descriptor>& constLattice, 00308 plint minIter, plint maxIter ); 00309 00310 00311 00312 /* *************** PART III ******************************************* */ 00313 /* *************** Initialization of scalar- and tensor-fields: ****** */ 00314 /* *************** Atomic-Block ************************************* */ 00315 /* ******************************************************************* */ 00316 00318 template<typename T> 00319 void setToConstant(ScalarField3D<T>& field, Box3D domain, T value); 00320 00323 template<typename T> 00324 void setToConstant(ScalarField3D<T>& field, ScalarField3D<int>& mask, int flag, 00325 Box3D domain, T value); 00326 00328 template<typename T, int nDim> 00329 void setToConstant( TensorField3D<T,nDim>& field, Box3D domain, 00330 Array<T,nDim> const& value ); 00331 00334 template<typename T, int nDim> 00335 void setToConstant( TensorField3D<T,nDim>& field, ScalarField3D<int>& mask, int flag, 00336 Box3D domain, Array<T,nDim> const& value ); 00337 00339 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00340 template<typename T, class Function> 00341 void setToFunction(ScalarField3D<T>& field, Box3D domain, Function f) { 00342 applyProcessingFunctional ( 00343 new SetToScalarFunctionFunctional3D<T,Function>(f), domain, field ); 00344 } 00345 00347 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00348 template<typename T, int nDim, class Function> 00349 void setToFunction(TensorField3D<T,nDim>& field, Box3D domain, Function f) { 00350 applyProcessingFunctional ( 00351 new SetToTensorFunctionFunctional3D<T,nDim,Function>(f), domain, field ); 00352 } 00353 00355 template<typename T> 00356 void setToCoordinate(ScalarField3D<T>& field, Box3D domain, plint index); 00357 00359 template<typename T> 00360 void setToCoordinates(TensorField3D<T,3>& field, Box3D domain); 00361 00362 00364 template<typename T, int nDim> 00365 void assignComponent(TensorField3D<T,nDim>& tensorField, int whichComponent, 00366 ScalarField3D<T>& scalarField, Box3D domain); 00367 00368 /* *************** PART IV ******************************************* */ 00369 /* *************** Initialization of scalar- and tensor-fields: ****** */ 00370 /* *************** Multi-Block *************************************** */ 00371 /* ******************************************************************* */ 00372 00374 template<typename T> 00375 void setToConstant(MultiScalarField3D<T>& field, Box3D domain, T value); 00376 00379 template<typename T> 00380 void setToConstant(MultiScalarField3D<T>& field, MultiScalarField3D<int>& mask, int flag, 00381 Box3D domain, T value); 00382 00384 template<typename T, int nDim> 00385 void setToConstant( MultiTensorField3D<T,nDim>& field, Box3D domain, 00386 Array<T,nDim> const& value ); 00387 00390 template<typename T, int nDim> 00391 void setToConstant( MultiTensorField3D<T,nDim>& field, MultiScalarField3D<int>& mask, int flag, 00392 Box3D domain, Array<T,nDim> const& value ); 00393 00395 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00396 template<typename T, class Function> 00397 void setToFunction(MultiScalarField3D<T>& field, Box3D domain, Function f) { 00398 applyProcessingFunctional ( 00399 new SetToScalarFunctionFunctional3D<T,Function>(f), domain, field ); 00400 } 00401 00403 // This function is implemented in-place, because it cannot be precompiled due to its generic nature. 00404 template<typename T, int nDim, class Function> 00405 void setToFunction(MultiTensorField3D<T,nDim>& field, Box3D domain, Function f) { 00406 applyProcessingFunctional ( 00407 new SetToTensorFunctionFunctional3D<T,nDim,Function>(f), domain, field ); 00408 } 00409 00411 template<typename T> 00412 void setToCoordinate(MultiScalarField3D<T>& field, Box3D domain, plint index); 00413 00415 template<typename T> 00416 void setToCoordinates(MultiTensorField3D<T,3>& field, Box3D domain); 00417 00418 00420 template<typename T, int nDim> 00421 void assignComponent(MultiTensorField3D<T,nDim>& tensorField, int whichComponent, 00422 MultiScalarField3D<T>& scalarField, Box3D domain); 00423 } // namespace plb 00424 00425 #endif // DATA_INITIALIZER_WRAPPER_3D_H
1.6.3
1.6.3