$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 REGULARIZED_BOUNDARY_DYNAMICS_2D_HH 00030 #define REGULARIZED_BOUNDARY_DYNAMICS_2D_HH 00031 00032 #include "boundaryCondition/regularizedBoundaryDynamics2D.h" 00033 00034 namespace plb { 00035 00036 template<typename T, template<typename U> class Descriptor, 00037 int normalX, int normalY> 00038 RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>:: 00039 RegularizedVelocityInnerCornerDynamics2D(Dynamics<T,Descriptor>* baseDynamics_, 00040 bool automaticPrepareCollision_) 00041 : BoundaryCompositeDynamics<T,Descriptor>(baseDynamics_, automaticPrepareCollision_), 00042 xDynamics(baseDynamics_->clone()), 00043 yDynamics(baseDynamics_->clone()) 00044 00045 { } 00046 00047 template<typename T, template<typename U> class Descriptor, 00048 int normalX, int normalY> 00049 RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>* 00050 RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>::clone() const 00051 { 00052 return new RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>(*this); 00053 } 00054 00055 template<typename T, template<typename U> class Descriptor, 00056 int normalX, int normalY> 00057 void RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>:: 00058 replaceBaseDynamics(Dynamics<T,Descriptor>* newBaseDynamics) 00059 { 00060 BoundaryCompositeDynamics<T,Descriptor>::replaceBaseDynamics(newBaseDynamics); 00061 xDynamics.replaceBaseDynamics(newBaseDynamics->clone()); 00062 yDynamics.replaceBaseDynamics(newBaseDynamics->clone()); 00063 } 00064 00065 template<typename T, template<typename U> class Descriptor, 00066 int normalX, int normalY> 00067 void RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>:: 00068 computeVelocity(Cell<T,Descriptor> const& cell, Array<T,Descriptor<T>::d>& u_ ) const 00069 { 00070 xDynamics.computeVelocity(cell, u_); 00071 } 00072 00073 template<typename T, template<typename U> class Descriptor, 00074 int normalX, int normalY> 00075 void RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>:: 00076 defineVelocity(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& u_ ) 00077 { 00078 xDynamics.defineVelocity(cell, u_); 00079 yDynamics.defineVelocity(cell, u_); 00080 } 00081 00082 template<typename T, template<typename U> class Descriptor, 00083 int normalX, int normalY> 00084 T RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>:: 00085 computeDensity(Cell<T,Descriptor> const& cell) const 00086 { 00087 return (xDynamics.computeDensity(cell) + yDynamics.computeDensity(cell) ) / (T)2; 00088 } 00089 00090 template<typename T, template<typename U> class Descriptor, 00091 int normalX, int normalY> 00092 T RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>:: 00093 computeRhoBar(Cell<T,Descriptor> const& cell) const 00094 { 00095 return (xDynamics.computeRhoBar(cell) + yDynamics.computeRhoBar(cell) ) / (T)2; 00096 } 00097 00098 template<typename T, template<typename U> class Descriptor, 00099 int normalX, int normalY> 00100 void RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>:: 00101 computeRhoBarJ(Cell<T,Descriptor> const& cell, T& rhoBar_, Array<T,Descriptor<T>::d>& j_ ) const 00102 { 00103 rhoBar_ = this->computeRhoBar(cell); 00104 T rho = Descriptor<T>::fullRho(rhoBar_); 00105 this -> computeVelocity(cell, j_); 00106 if (!this->velIsJ()) { 00107 for (int iD=0; iD<Descriptor<T>::d; ++iD) { 00108 j_[iD] *= rho; 00109 } 00110 } 00111 } 00112 00113 template<typename T, template<typename U> class Descriptor, 00114 int normalX, int normalY> 00115 void RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>::computeRhoBarJPiNeq ( 00116 Cell<T,Descriptor> const& cell, T& rhoBar, Array<T,Descriptor<T>::d>& j, 00117 Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const 00118 { 00119 T tmpRhoBar; 00120 Array<T,Descriptor<T>::d> tmpJ; 00121 Array<T,SymmetricTensor<T,Descriptor>::n> tmpPiNeq; 00122 xDynamics.computeRhoBarJPiNeq(cell, rhoBar, j, PiNeq); 00123 yDynamics.computeRhoBarJPiNeq(cell, tmpRhoBar, tmpJ, tmpPiNeq); 00124 00125 rhoBar = (rhoBar+tmpRhoBar) / (T)2; 00126 for (int iD=0; iD<Descriptor<T>::d; ++iD) { 00127 j[iD] = (j[iD] + tmpJ[iD]) / (T)2; 00128 } 00129 for (int iPi=0; iPi<Descriptor<T>::d; ++iPi) { 00130 PiNeq[iPi] = (PiNeq[iPi] + tmpPiNeq[iPi]) / (T)2; 00131 } 00132 } 00133 00134 template<typename T, template<typename U> class Descriptor, 00135 int normalX, int normalY> 00136 void RegularizedVelocityInnerCornerDynamics2D<T,Descriptor,normalX,normalY>:: 00137 completePopulations(Cell<T,Descriptor>& cell) const 00138 { 00139 // 1. Assign "bounce-back of off-equilibrium" to the unknown population 00140 Array<int,Descriptor<T>::d> v ( -normalX, -normalY ); 00141 plint unknownF = indexTemplates::findVelocity<Descriptor<T> >(v); 00142 00143 T rhoBar; 00144 Array<T,Descriptor<T>::d> j; 00145 this -> computeRhoBarJ(cell, rhoBar, j); 00146 T jSqr = VectorTemplate<T,Descriptor>::normSqr(j); 00147 // Do nothing if there is no unknown population 00148 if (unknownF != Descriptor<T>::q) { 00149 plint oppositeF = indexTemplates::opposite<Descriptor<T> >(unknownF); 00150 cell[unknownF] = cell[oppositeF] 00151 - this->computeEquilibrium(oppositeF, rhoBar, j, jSqr) 00152 + this->computeEquilibrium(unknownF, rhoBar, j, jSqr); 00153 } 00154 00155 // 2. Regularize all populations 00156 Array<T,SymmetricTensor<T,Descriptor>::n> PiNeq; 00157 this -> getBaseDynamics().computeDeviatoricStress(cell, PiNeq);; 00158 this -> getBaseDynamics().regularize(cell, rhoBar, j, jSqr, PiNeq); 00159 } 00160 00161 } // namespace plb 00162 00163 #endif // REGULARIZED_BOUNDARY_DYNAMICS_2D_HH
1.6.3
1.6.3