$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 /* Main author: Orestis Malaspinas 00026 */ 00027 00028 #ifndef BOUSSINESQ_THERMAL_PROCESSOR_2D_HH 00029 #define BOUSSINESQ_THERMAL_PROCESSOR_2D_HH 00030 00031 #include "multiPhysics/boussinesqThermalProcessor2D.h" 00032 #include "atomicBlock/blockLattice2D.h" 00033 #include "core/util.h" 00034 #include "finiteDifference/finiteDifference2D.h" 00035 #include "latticeBoltzmann/geometricOperationTemplates.h" 00036 00037 namespace plb { 00038 00039 template< typename T, 00040 template<typename U1> class FluidDescriptor, 00041 template<typename U2> class TemperatureDescriptor 00042 > 00043 BoussinesqThermalProcessor2D<T,FluidDescriptor,TemperatureDescriptor>:: 00044 BoussinesqThermalProcessor2D(T gravity_, T T0_, T deltaTemp_, Array<T,FluidDescriptor<T>::d> dir_) 00045 : gravity(gravity_), T0(T0_), deltaTemp(deltaTemp_), 00046 dir(dir_) 00047 { 00048 // We normalize the direction of the force vector. 00049 T normDir = sqrt(VectorTemplate<T,FluidDescriptor>::normSqr(dir)); 00050 for (pluint iD = 0; iD < FluidDescriptor<T>::d; ++iD) { 00051 dir[iD] /= normDir; 00052 } 00053 } 00054 00055 template< typename T, 00056 template<typename U1> class FluidDescriptor, 00057 template<typename U2> class TemperatureDescriptor 00058 > 00059 void BoussinesqThermalProcessor2D<T,FluidDescriptor,TemperatureDescriptor>::process ( 00060 Box2D domain, 00061 BlockLattice2D<T,FluidDescriptor>& fluid, 00062 BlockLattice2D<T,TemperatureDescriptor>& temperature ) 00063 { 00064 typedef FluidDescriptor<T> D; 00065 enum { 00066 velOffset = TemperatureDescriptor<T>::ExternalField::velocityBeginsAt, 00067 forceOffset = FluidDescriptor<T>::ExternalField::forceBeginsAt 00068 }; 00069 Dot3D offset = computeRelativeDisplacement(fluid, temperature); 00070 00071 Array<T,D::d> gravOverDeltaTemp ( 00072 gravity*dir[0]/deltaTemp, 00073 gravity*dir[1]/deltaTemp ); 00074 00075 for (plint iX=domain.x0; iX<=domain.x1; ++iX) 00076 { 00077 for (plint iY=domain.y0; iY<=domain.y1; ++iY) 00078 { 00079 // Velocity coupling 00080 T *u = temperature.get(iX+offset.x,iY+offset.y).getExternal(velOffset); 00081 Array<T,FluidDescriptor<T>::d> vel; 00082 fluid.get(iX,iY).computeVelocity(vel); 00083 vel.to_cArray(u); 00084 00085 // Computation of the Boussinesq force 00086 T *force = fluid.get(iX,iY).getExternal(forceOffset); 00087 // Temperature is the order-0 moment of the advection-diffusion lattice. 00088 // You can compute it with the method computeDensity(). 00089 T localTemperature = temperature.get(iX+offset.x,iY+offset.y).computeDensity(); 00090 const T diffT = localTemperature - T0; 00091 for (pluint iD = 0; iD < D::d; ++iD) 00092 { 00093 force[iD] = gravOverDeltaTemp[iD] * diffT; 00094 } 00095 } 00096 } 00097 } 00098 00099 template< typename T, 00100 template<typename U1> class FluidDescriptor, 00101 template<typename U2> class TemperatureDescriptor 00102 > 00103 BoussinesqThermalProcessor2D<T,FluidDescriptor,TemperatureDescriptor>* 00104 BoussinesqThermalProcessor2D<T,FluidDescriptor,TemperatureDescriptor>::clone() const 00105 { 00106 return new BoussinesqThermalProcessor2D<T,FluidDescriptor,TemperatureDescriptor>(*this); 00107 } 00108 00109 00110 00111 template< typename T, 00112 template<typename U1> class FluidDescriptor, 00113 template<typename U2> class ScalarDescriptor 00114 > 00115 LatticeToPassiveAdvDiff2D<T,FluidDescriptor,ScalarDescriptor>::LatticeToPassiveAdvDiff2D(T scaling_) 00116 : scaling(scaling_) 00117 { } 00118 00119 template< typename T, 00120 template<typename U1> class FluidDescriptor, 00121 template<typename U2> class ScalarDescriptor 00122 > 00123 void LatticeToPassiveAdvDiff2D<T,FluidDescriptor,ScalarDescriptor>::process ( 00124 Box2D domain, 00125 BlockLattice2D<T,FluidDescriptor>& fluid, 00126 BlockLattice2D<T,ScalarDescriptor>& scalar ) 00127 { 00128 const int velOffset = ScalarDescriptor<T>::ExternalField::velocityBeginsAt; 00129 for (plint iX=domain.x0; iX<=domain.x1; ++iX) { 00130 for (plint iY=domain.y0; iY<=domain.y1; ++iY) { 00131 T *u = scalar.get(iX,iY).getExternal(velOffset); 00132 Array<T,2> velocity; 00133 fluid.get(iX,iY).computeVelocity(velocity); 00134 velocity *= scaling; 00135 velocity.to_cArray(u); 00136 } 00137 } 00138 } 00139 00140 template< typename T, 00141 template<typename U1> class FluidDescriptor, 00142 template<typename U2> class ScalarDescriptor 00143 > 00144 LatticeToPassiveAdvDiff2D<T,FluidDescriptor,ScalarDescriptor>* 00145 LatticeToPassiveAdvDiff2D<T,FluidDescriptor,ScalarDescriptor>::clone() const 00146 { 00147 return new LatticeToPassiveAdvDiff2D<T,FluidDescriptor,ScalarDescriptor>(*this); 00148 } 00149 00150 template< typename T, 00151 template<typename U1> class FluidDescriptor, 00152 template<typename U2> class ScalarDescriptor 00153 > 00154 BlockDomain::DomainT LatticeToPassiveAdvDiff2D<T,FluidDescriptor,ScalarDescriptor>::appliesTo() const { 00155 return BlockDomain::bulk; 00156 } 00157 00158 template< typename T, 00159 template<typename U1> class FluidDescriptor, 00160 template<typename U2> class ScalarDescriptor 00161 > 00162 void LatticeToPassiveAdvDiff2D<T,FluidDescriptor,ScalarDescriptor>::getTypeOfModification ( 00163 std::vector<modif::ModifT>& modified ) const 00164 { 00165 modified[0] = modif::nothing; 00166 modified[1] = modif::staticVariables; 00167 } 00168 00169 } // namespace plb 00170 00171 #endif
1.6.3
1.6.3