$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 00025 #ifndef DYNAMIC_SMAGORINSKY_PROCESSOR_3D_HH 00026 #define DYNAMIC_SMAGORINSKY_PROCESSOR_3D_HH 00027 00028 #include "complexDynamics/dynamicSmagorinskyProcessor3D.h" 00029 #include "latticeBoltzmann/momentTemplates.h" 00030 00031 namespace plb { 00032 00033 template<typename T, template<typename U> class Descriptor> 00034 ComputeSmagoViscosityFunctional3D<T,Descriptor>::ComputeSmagoViscosityFunctional3D(T omega0_, T cSmago_) 00035 : omega0(omega0_), 00036 preFactor(computePreFactor(omega0_, cSmago_)) 00037 { } 00038 00039 template<typename T, template<typename U> class Descriptor> 00040 void ComputeSmagoViscosityFunctional3D<T,Descriptor>::process ( 00041 Box3D domain, BlockLattice3D<T,Descriptor>& lattice ) 00042 { 00043 for (plint iX=domain.x0; iX<=domain.x1; ++iX) { 00044 for (plint iY=domain.y0; iY<=domain.y1; ++iY) { 00045 for (plint iZ=domain.z0; iZ<=domain.z1; ++iZ) { 00046 Cell<T,Descriptor>& cell = lattice.get(iX,iY,iZ); 00047 T rhoBar; 00048 Array<T,Descriptor<T>::d> j; 00049 Array<T,SymmetricTensor<T,Descriptor>::n> PiNeq; 00050 momentTemplates<T,Descriptor>::compute_rhoBar_j_PiNeq(cell, rhoBar, j, PiNeq); 00051 T PiNeqNormSqr = SymmetricTensor<T,Descriptor>::tensorNormSqr(PiNeq); 00052 T PiNeqNorm = sqrt(PiNeqNormSqr); 00053 T alpha = preFactor * Descriptor<T>::invRho(rhoBar); 00054 T linearTerm = alpha*PiNeqNorm; 00055 T squareTerm = (T)2*alpha*alpha*PiNeqNormSqr; 00056 // In the following formula, the square-root appearing in the explicit form of omega 00057 // is developed to second-order. 00058 T omega = omega0*(1-linearTerm+squareTerm); 00059 *cell.getExternal(Descriptor<T>::ExternalField::omegaBeginsAt) = omega; 00060 } 00061 } 00062 } 00063 } 00064 00065 template<typename T, template<typename U> class Descriptor> 00066 ComputeSmagoViscosityFunctional3D<T,Descriptor>* ComputeSmagoViscosityFunctional3D<T,Descriptor>::clone() const 00067 { 00068 return new ComputeSmagoViscosityFunctional3D<T,Descriptor>(*this); 00069 } 00070 00071 template<typename T, template<typename U> class Descriptor> 00072 void ComputeSmagoViscosityFunctional3D<T,Descriptor>::getTypeOfModification(std::vector<modif::ModifT>& modified) const { 00073 modified[0] = modif::nothing; 00074 modified[1] = modif::staticVariables; 00075 } 00076 00077 template<typename T, template<typename U> class Descriptor> 00078 BlockDomain::DomainT ComputeSmagoViscosityFunctional3D<T,Descriptor>::appliesTo() const { 00079 return BlockDomain::bulkAndEnvelope; 00080 } 00081 00082 template<typename T, template<typename U> class Descriptor> 00083 T ComputeSmagoViscosityFunctional3D<T,Descriptor>::computePreFactor(T omega0, T cSmago) 00084 { 00085 return (T)0.5 * util::sqr(cSmago*omega0*Descriptor<T>::invCs2); 00086 } 00087 00088 } // namespace plb 00089 00090 #endif // DYNAMIC_SMAGORINSKY_PROCESSOR_3D_HH
1.6.3
1.6.3