$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 /* Orestis Malaspinas designed some of the classes and concepts contained 00026 * in this file. */ 00027 00028 #ifndef SMAGORINSKY_GENERICS_3D_H 00029 #define SMAGORINSKY_GENERICS_3D_H 00030 00031 namespace plb { 00032 00033 template<typename T, template<typename U> class Descriptor, class SmagoFunction> 00034 class StaticSmagorinskyFunctional3D : public BoxProcessingFunctional3D_L<T,Descriptor> { 00035 public: 00036 StaticSmagorinskyFunctional3D(SmagoFunction smagoFunction_, T cSmago0_) 00037 : smagoFunction(smagoFunction_), 00038 cSmago0(cSmago0_) 00039 { } 00040 virtual void process(Box3D domain, BlockLattice3D<T,Descriptor>& lattice) { 00041 Dot3D relativeOffset = lattice.getLocation(); 00042 for (plint iX=domain.x0; iX<=domain.x1; ++iX) { 00043 for (plint iY=domain.y0; iY<=domain.y1; ++iY) { 00044 for (plint iZ=domain.z0; iZ<=domain.z1; ++iZ) { 00045 T cSmago = smagoFunction ( 00046 iX+relativeOffset.x, 00047 iY+relativeOffset.y, 00048 iZ+relativeOffset.z, 00049 cSmago0 ); 00050 T omega0 = lattice.get(iX,iY,iZ).getOmega(); 00051 lattice.attributeDynamics ( iX,iY,iZ, 00052 cloneAndInsertAtTopDynamics ( 00053 lattice.get(iX,iY,iZ).getDynamics(), 00054 new SmagorinskyDynamics<T,Descriptor> ( 00055 new NoDynamics<T,Descriptor>, omega0, cSmago ) ) ); 00056 } 00057 } 00058 } 00059 } 00060 virtual BlockDomain::DomainT appliesTo() const { 00061 // Composite dynamics needs to be instantiated everywhere, including envelope. 00062 return BlockDomain::bulkAndEnvelope; 00063 } 00064 virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const { 00065 modified[0] = modif::staticVariables; 00066 } 00067 virtual StaticSmagorinskyFunctional3D<T,Descriptor,SmagoFunction>* clone() const 00068 { 00069 return new StaticSmagorinskyFunctional3D<T,Descriptor,SmagoFunction>(*this); 00070 } 00071 private: 00072 SmagoFunction smagoFunction; 00073 T cSmago0; 00074 }; 00075 00076 template<typename T> 00077 T constOmegaFromOmega0(plint iX, plint iY, plint iZ, T omega0) { 00078 return omega0; 00079 } 00080 00081 template<typename T, template<typename U> class Descriptor> 00082 void instantiateStaticSmagorinsky(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, T cSmago) { 00083 instantiateStaticSmagorinsky(lattice, domain, constOmegaFromOmega0<T>, cSmago); 00084 } 00085 00086 template<typename T, template<typename U> class Descriptor> 00087 void instantiateStaticSmagorinsky(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, T cSmago) { 00088 instantiateStaticSmagorinsky(lattice, domain, constOmegaFromOmega0<T>, cSmago); 00089 } 00090 00091 template<typename T, template<typename U> class Descriptor, class SmagoFunction> 00092 void instantiateStaticSmagorinsky(BlockLattice3D<T,Descriptor>& lattice, Box3D domain, SmagoFunction smagoFunction, T cSmago0) 00093 { 00094 applyProcessingFunctional ( 00095 new StaticSmagorinskyFunctional3D<T,Descriptor,SmagoFunction>(smagoFunction, cSmago0), 00096 domain, lattice ); 00097 } 00098 00099 template<typename T, template<typename U> class Descriptor, class SmagoFunction> 00100 void instantiateStaticSmagorinsky(MultiBlockLattice3D<T,Descriptor>& lattice, Box3D domain, SmagoFunction smagoFunction, T cSmago0) 00101 { 00102 applyProcessingFunctional ( 00103 new StaticSmagorinskyFunctional3D<T,Descriptor,SmagoFunction>(smagoFunction, cSmago0), 00104 domain, lattice ); 00105 } 00106 00107 } // namespace plb 00108 00109 #endif // SMAGORINSKY_GENERICS_3D_H
1.6.3
1.6.3