$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 ISO_THERMAL_DYNAMICS_H 00030 #define ISO_THERMAL_DYNAMICS_H 00031 00032 #include "core/globalDefs.h" 00033 #include "core/dynamics.h" 00034 00035 namespace plb { 00036 00038 template<typename T, template<typename U> class Descriptor> 00039 class IsoThermalBulkDynamics : public BasicBulkDynamics<T,Descriptor> { 00040 public: 00041 IsoThermalBulkDynamics(T omega_); 00042 00043 /* *************** Collision, Equilibrium, and Non-equilibrium ******* */ 00044 00046 virtual void regularize(Cell<T,Descriptor>& cell, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00047 T jSqr, Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq, T thetaBar=T() ) const; 00048 00049 /* *************** Computation of macroscopic variables ************** */ 00050 00052 virtual T computeTemperature(Cell<T,Descriptor> const& cell) const; 00053 00055 virtual void computeDeviatoricStress ( 00056 Cell<T,Descriptor> const& cell, Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const; 00057 00059 virtual void computeHeatFlux( Cell<T,Descriptor> const& cell, 00060 Array<T,Descriptor<T>::d>& q ) const; 00061 00062 /* *************** Switch between population and moment representation ****** */ 00063 00065 00071 virtual plint numDecomposedVariables(plint order) const; 00072 00074 00076 virtual void decompose(Cell<T,Descriptor> const& cell, std::vector<T>& rawData, plint order) const; 00077 00079 00084 virtual void recompose(Cell<T,Descriptor>& cell, std::vector<T> const& rawData, plint order) const; 00085 00087 00091 virtual void rescale(std::vector<T>& rawData, T xDxInv, T xDt, plint order) const; 00092 virtual void rescale(int dxScale, int dtScale) { 00093 Dynamics<T,Descriptor>::rescale(dxScale, dtScale); 00094 } 00095 00096 00097 /* *************** Additional moments, intended for internal use ***** */ 00098 00100 virtual T computeEbar(Cell<T,Descriptor> const& cell) const; 00101 00102 private: 00103 virtual void decomposeOrder0(Cell<T,Descriptor> const& cell, std::vector<T>& rawData) const; 00104 virtual void decomposeOrder1(Cell<T,Descriptor> const& cell, std::vector<T>& rawData) const; 00105 virtual void recomposeOrder0(Cell<T,Descriptor>& cell, std::vector<T> const& rawData) const; 00106 virtual void recomposeOrder1(Cell<T,Descriptor>& cell, std::vector<T> const& rawData) const; 00107 virtual void rescaleOrder0(std::vector<T>& rawData, T xDxInv, T xDt) const; 00108 virtual void rescaleOrder1(std::vector<T>& rawData, T xDxInv, T xDt) const; 00109 }; 00110 00112 template<typename T, template<typename U> class Descriptor> 00113 class BGKdynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00114 public: 00115 /* *************** Construction / Destruction ************************ */ 00116 BGKdynamics(T omega_); 00117 00119 virtual BGKdynamics<T,Descriptor>* clone() const; 00120 00122 virtual int getId() const; 00123 00124 /* *************** Collision and Equilibrium ************************* */ 00125 00127 virtual void collide(Cell<T,Descriptor>& cell, 00128 BlockStatistics& statistics_); 00129 00131 virtual void collide(Cell<T,Descriptor>& cell, T rhoBar, 00132 Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat); 00133 00135 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00136 T jSqr, T thetaBar=T()) const; 00137 private: 00138 static int id; 00139 }; 00140 00141 template<typename T, template<typename U> class Descriptor> 00142 class StoreRhoBarJBGKdynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00143 public: 00144 /* *************** Construction / Destruction ************************ */ 00145 StoreRhoBarJBGKdynamics(T omega_); 00146 00148 virtual StoreRhoBarJBGKdynamics<T,Descriptor>* clone() const; 00149 00151 virtual int getId() const; 00152 00153 /* *************** Collision and Equilibrium ************************* */ 00154 00156 virtual void collide(Cell<T,Descriptor>& cell, 00157 BlockStatistics& statistics_); 00158 00160 virtual void collide(Cell<T,Descriptor>& cell, T rhoBar, 00161 Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat); 00162 00164 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00165 T jSqr, T thetaBar=T()) const; 00166 private: 00167 static int id; 00168 }; 00169 00171 template<typename T, template<typename U> class Descriptor> 00172 class ExternalMomentBGKdynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00173 public: 00174 /* *************** Construction / Destruction ************************ */ 00175 ExternalMomentBGKdynamics(T omega_); 00176 00178 virtual ExternalMomentBGKdynamics<T,Descriptor>* clone() const; 00179 00181 virtual int getId() const; 00182 00183 /* *************** Collision and Equilibrium ************************* */ 00184 00186 virtual void collide(Cell<T,Descriptor>& cell, 00187 BlockStatistics& statistics_); 00188 00190 virtual void collide(Cell<T,Descriptor>& cell, T rhoBar, 00191 Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat); 00192 00194 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00195 T jSqr, T thetaBar=T()) const; 00196 00197 /* *************** Moments ******************************************* */ 00198 00199 // The function computeDensity() is not overridden, and the default 00200 // implementation is kept, for two reasons. First, it is equivalent to access 00201 // rho from the external scalar or to recompute it from the bulk (this 00202 // is not the case for the velocity, in a Shan/Chen multicomponent model). 00203 // Second, the Shan/Chen data-processor needs computeDensity() to be 00204 // default implemented, because it uses this function to treat walls with 00205 // a virtual-density mechanism. 00206 00208 virtual void computeVelocity( Cell<T,Descriptor> const& cell, 00209 Array<T,Descriptor<T>::d>& u ) const; 00211 00212 virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const; 00213 00215 00216 virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell, 00217 T& rhoBar, Array<T,Descriptor<T>::d>& j) const; 00218 00219 private: 00220 static int id; 00221 }; 00222 00224 template<typename T, template<typename U> class Descriptor> 00225 class ExternalVelocityBGKdynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00226 public: 00227 /* *************** Construction / Destruction ************************ */ 00228 ExternalVelocityBGKdynamics(T omega_); 00229 00231 virtual ExternalVelocityBGKdynamics<T,Descriptor>* clone() const; 00232 00234 virtual int getId() const; 00235 00236 /* *************** Collision and Equilibrium ************************* */ 00237 00239 virtual void collide(Cell<T,Descriptor>& cell, 00240 BlockStatistics& statistics_); 00241 00243 virtual void collide(Cell<T,Descriptor>& cell, T rhoBar, 00244 Array<T,Descriptor<T>::d> const& j, T thetaBar=T()); 00245 00247 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00248 T jSqr, T thetaBar=T()) const; 00249 00250 /* *************** Moments ******************************************* */ 00251 00252 // The function computeDensity() is not overridden, and the default 00253 // implementation is kept, for two reasons. First, it is equivalent to access 00254 // rho from the external scalar or to recompute it from the bulk (this 00255 // is not the case for the velocity, in a Shan/Chen multicomponent model). 00256 // Second, the Shan/Chen data-processor needs computeDensity() to be 00257 // default implemented, because it uses this function to treat walls with 00258 // a virtual-density mechanism. 00259 00261 virtual void computeVelocity( Cell<T,Descriptor> const& cell, 00262 Array<T,Descriptor<T>::d>& u ) const; 00264 00265 virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const; 00266 00268 00269 virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell, 00270 T& rhoBar, Array<T,Descriptor<T>::d>& j) const; 00271 00272 private: 00273 static int id; 00274 }; 00275 00277 00280 template<typename T, template<typename U> class Descriptor> 00281 class QuasiIncBGKdynamics : public BGKdynamics<T,Descriptor> { 00282 public: 00283 /* *************** Construction / Destruction ************************ */ 00284 QuasiIncBGKdynamics(T omega_); 00285 00287 virtual QuasiIncBGKdynamics<T,Descriptor>* clone() const; 00288 00290 virtual int getId() const; 00291 00294 virtual bool velIsJ() const; 00295 00296 /* *************** Macroscopic variables ***************************** */ 00297 00299 virtual void computeVelocity( Cell<T,Descriptor> const& cell, 00300 Array<T,Descriptor<T>::d>& u ) const; 00301 00303 virtual void computeRhoBarJPiNeq( Cell<T,Descriptor> const& cell, 00304 T& rhoBar, Array<T,Descriptor<T>::d>& j, 00305 Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const; 00306 private: 00307 static int id; 00308 }; 00309 00311 template<typename T, template<typename U> class Descriptor> 00312 class IncBGKdynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00313 public: 00314 /* *************** Construction / Destruction ************************ */ 00315 IncBGKdynamics(T omega_); 00316 00318 virtual IncBGKdynamics<T,Descriptor>* clone() const; 00319 00321 virtual int getId() const; 00322 00325 virtual bool velIsJ() const; 00326 00327 /* *************** Collision and Equilibrium ************************* */ 00328 00330 virtual void computeVelocity( Cell<T,Descriptor> const& cell, 00331 Array<T,Descriptor<T>::d>& u ) const; 00332 00334 virtual void computeRhoBarJPiNeq( Cell<T,Descriptor> const& cell, 00335 T& rhoBar, Array<T,Descriptor<T>::d>& j, 00336 Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const; 00337 00339 virtual void collide(Cell<T,Descriptor>& cell, 00340 BlockStatistics& statistics_); 00341 00343 virtual void collide(Cell<T,Descriptor>& cell, T rhoBar, 00344 Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat); 00345 00347 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00348 T jSqr, T thetaBar=T()) const; 00349 private: 00350 static int id; 00351 }; 00352 00354 template<typename T, template<typename U> class Descriptor> 00355 class ConstRhoBGKdynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00356 public: 00357 /* *************** Construction / Destruction ************************ */ 00358 ConstRhoBGKdynamics(T omega_); 00359 00361 virtual ConstRhoBGKdynamics<T,Descriptor>* clone() const; 00362 00364 virtual int getId() const; 00365 00366 /* *************** Collision and Equilibrium ************************* */ 00367 00369 virtual void collide(Cell<T,Descriptor>& cell, 00370 BlockStatistics& statistics_); 00371 00373 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00374 T jSqr, T thetaBar=T()) const; 00375 private: 00376 static int id; 00377 }; 00378 00380 00385 template<typename T, template<typename U> class Descriptor> 00386 class RLBdynamics : public BulkCompositeDynamics<T,Descriptor> { 00387 public: 00388 /* *************** Construction / Destruction ************************ */ 00389 RLBdynamics(Dynamics<T,Descriptor>* baseDynamics, bool automaticPrepareCollision=true); 00390 00392 virtual RLBdynamics<T,Descriptor>* clone() const; 00393 00395 virtual int getId() const; 00396 00397 /* *************** Completion algorithm and base dynamics ************ */ 00398 00400 virtual void completePopulations(Cell<T,Descriptor>& cell) const; 00401 private: 00402 static int id; 00403 }; 00404 00406 00409 template<typename T, template<typename U> class Descriptor> 00410 class RegularizedBGKdynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00411 public: 00412 /* *************** Construction / Destruction ************************ */ 00413 RegularizedBGKdynamics(T omega_); 00414 00416 virtual RegularizedBGKdynamics<T,Descriptor>* clone() const; 00417 00419 virtual int getId() const; 00420 00421 /* *************** Collision and Equilibrium ************************* */ 00422 00424 virtual void collide(Cell<T,Descriptor>& cell, 00425 BlockStatistics& statistics_); 00426 00428 virtual void collide(Cell<T,Descriptor>& cell, T rhoBar, 00429 Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat); 00430 00432 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00433 T jSqr, T thetaBar=T()) const; 00434 private: 00435 static int id; 00436 }; 00437 00439 template<typename T, template<typename U> class Descriptor> 00440 class IncRegularizedBGKdynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00441 public: 00442 /* *************** Construction / Destruction ************************ */ 00443 IncRegularizedBGKdynamics(T omega_); 00444 00446 virtual IncRegularizedBGKdynamics<T,Descriptor>* clone() const; 00447 00449 virtual int getId() const; 00450 00451 /* *************** Collision and Equilibrium ************************* */ 00452 00454 virtual void computeVelocity( Cell<T,Descriptor> const& cell, 00455 Array<T,Descriptor<T>::d>& u ) const; 00456 00458 virtual void computeRhoBarJPiNeq( Cell<T,Descriptor> const& cell, 00459 T& rhoBar, Array<T,Descriptor<T>::d>& j, 00460 Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const; 00461 00463 virtual void collide(Cell<T,Descriptor>& cell, 00464 BlockStatistics& statistics_); 00465 00467 virtual void collide(Cell<T,Descriptor>& cell, T rhoBar, 00468 Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat); 00469 00471 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00472 T jSqr, T thetaBar=T()) const; 00473 00476 bool velIsJ() const; 00477 private: 00478 static int id; 00479 }; 00480 00482 template<typename T, template<typename U> class Descriptor> 00483 class ExternalMomentRegularizedBGKdynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00484 public: 00485 /* *************** Construction / Destruction ************************ */ 00486 ExternalMomentRegularizedBGKdynamics(T omega_); 00487 00489 virtual ExternalMomentRegularizedBGKdynamics<T,Descriptor>* clone() const; 00490 00492 virtual int getId() const; 00493 00494 /* *************** Collision and Equilibrium ************************* */ 00495 00497 virtual void collide(Cell<T,Descriptor>& cell, 00498 BlockStatistics& statistics_); 00499 00501 virtual void collide(Cell<T,Descriptor>& cell, T rhoBar, 00502 Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat); 00503 00505 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00506 T jSqr, T thetaBar=T()) const; 00507 00508 /* *************** Moments ******************************************* */ 00509 00510 // The function computeDensity() is not overridden, and the default 00511 // implementation is kept, for two reasons. First, it is equivalent to access 00512 // rho from the external scalar or to recompute it from the bulk (this 00513 // is not the case for the velocity, in a Shan/Chen multicomponent model). 00514 // Second, the Shan/Chen data-processor needs computeDensity() to be 00515 // default implemented, because it uses this function to treat walls with 00516 // a virtual-density mechanism. 00517 00519 virtual void computeVelocity( Cell<T,Descriptor> const& cell, 00520 Array<T,Descriptor<T>::d>& u ) const; 00522 00523 virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const; 00524 00526 00527 virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell, 00528 T& rhoBar, Array<T,Descriptor<T>::d>& j) const; 00529 00530 private: 00531 static int id; 00532 }; 00533 00535 template<typename T, template<typename U> class Descriptor> 00536 class ChopardDynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00537 public: 00538 /* *************** Construction / Destruction ************************ */ 00539 ChopardDynamics(T vs2_, T omega_); 00540 00542 virtual ChopardDynamics<T,Descriptor>* clone() const; 00543 00545 virtual int getId() const; 00546 00548 virtual void serialize(HierarchicSerializer& serializer) const; 00549 00551 virtual void unserialize(HierarchicUnserializer& unserializer); 00552 00553 /* *************** Collision and Equilibrium ************************* */ 00554 00556 virtual void collide(Cell<T,Descriptor>& cell, 00557 BlockStatistics& statistics_); 00558 00560 virtual void collide(Cell<T,Descriptor>& cell, T rhoBar, 00561 Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat); 00562 00564 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00565 T jSqr, T thetaBar=T()) const; 00566 00567 /* *************** Configurable parameters *************************** */ 00568 00570 virtual void setParameter(plint whichParameter, T value); 00572 virtual T getParameter(plint whichParameter) const; 00574 void setVs2(T vs2_); 00576 T getVs2() const; 00577 00578 private: 00579 /* *************** Static implementation methods********************** */ 00580 00582 static T chopardBgkCollision ( 00583 Cell<T,Descriptor>& cell, T rhoBar, Array<T,Descriptor<T>::d> const& j, T vs2, T omega); 00585 static T chopardEquilibrium ( 00586 plint iPop, T rhoBar, T invRho, Array<T,Descriptor<T>::d> const& j, T jSqr, T vs2); 00587 private: 00588 T vs2; 00589 private: 00590 static int id; 00591 }; 00592 00594 template<typename T, template<typename U> class Descriptor> 00595 class PrecondBGKdynamics : public IsoThermalBulkDynamics<T,Descriptor> { 00596 public: 00597 /* *************** Construction / Destruction ************************ */ 00598 PrecondBGKdynamics(T omega_, T invGamma_); 00599 00601 virtual PrecondBGKdynamics<T,Descriptor>* clone() const; 00602 00604 virtual int getId() const; 00605 00607 virtual void serialize(HierarchicSerializer& serializer) const; 00608 00610 virtual void unserialize(HierarchicUnserializer& unserializer); 00611 00612 /* *************** Collision and Equilibrium ************************* */ 00613 00615 virtual void collide(Cell<T,Descriptor>& cell, 00616 BlockStatistics& statistics_); 00617 00619 virtual void collide(Cell<T,Descriptor>& cell, T rhoBar, 00620 Array<T,Descriptor<T>::d> const& j, T thetaBar, BlockStatistics& stat); 00621 00623 virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j, 00624 T jSqr, T thetaBar=T()) const; 00625 private: 00626 static int id; 00627 T invGamma; 00628 }; 00629 00630 } // namespace plb 00631 00632 #endif // ISO_THERMAL_DYNAMICS_H
1.6.3
1.6.3