$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

thermalDataAnalysis3D.hh

Go to the documentation of this file.
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 
00031 #ifndef THERMAL_DATA_ANALYSIS_3D_HH
00032 #define THERMAL_DATA_ANALYSIS_3D_HH
00033 
00034 #include "core/blockStatistics.h"
00035 #include "atomicBlock/blockLattice3D.h"
00036 #include "atomicBlock/reductiveDataProcessorWrapper3D.h"
00037 #include "latticeBoltzmann/momentTemplates.h"
00038 #include "latticeBoltzmann/geometricOperationTemplates.h"
00039 #include "multiPhysics/thermalDataAnalysis3D.h"
00040 #include <cmath>
00041 
00042 namespace plb {
00043     
00044 template< typename T,
00045           template<typename U1> class FluidDescriptor, 
00046           template<typename U2> class TemperatureDescriptor
00047         >
00048 T computeNusseltNumber(BlockLattice3D<T,FluidDescriptor>& fluid,
00049                        BlockLattice3D<T,TemperatureDescriptor>& temperature,
00050                        Box3D domain,
00051                        int direction, T deltaX, T kappa, T deltaTemperature)
00052 {
00053     BoxSumVelocityTemperatureFunctional3D<T,FluidDescriptor,TemperatureDescriptor> functional(direction);
00054     applyProcessingFunctional(functional, domain, fluid, temperature);
00055     return (T)1 + functional.getSumVelocityTemperature() / 
00056             ((T) domain.nCells() * deltaX * deltaTemperature * kappa);
00057 }
00058 
00059 template< typename T,
00060           template<typename U1> class FluidDescriptor, 
00061           template<typename U2> class TemperatureDescriptor
00062         >
00063 T computeNusseltNumber(MultiBlockLattice3D<T,FluidDescriptor>& fluid,
00064                        MultiBlockLattice3D<T,TemperatureDescriptor>& temperature,
00065                        Box3D domain,
00066                        int direction, T deltaX, T kappa, T deltaTemperature)
00067 {
00068     BoxSumVelocityTemperatureFunctional3D<T,FluidDescriptor,TemperatureDescriptor> functional(direction);
00069     applyProcessingFunctional(functional, domain, fluid, temperature);
00070     return (T)1 + functional.getSumVelocityTemperature() / 
00071             ((T) domain.nCells() * deltaX * deltaTemperature * kappa);
00072 }
00073 
00074     
00075 template< typename T,
00076           template<typename U1> class FluidDescriptor, 
00077           template<typename U2> class TemperatureDescriptor
00078         >
00079 BoxSumVelocityTemperatureFunctional3D<T,FluidDescriptor,TemperatureDescriptor>::BoxSumVelocityTemperatureFunctional3D(int direction_)
00080     : direction(direction_),
00081       sumVelocityTemperatureId(this->getStatistics().subscribeSum())
00082 { }
00083 
00084 template< typename T,
00085           template<typename U1> class FluidDescriptor, 
00086           template<typename U2> class TemperatureDescriptor
00087         >
00088 void BoxSumVelocityTemperatureFunctional3D<T,FluidDescriptor,TemperatureDescriptor>::process (
00089         Box3D domain,
00090         BlockLattice3D<T,FluidDescriptor>& fluid,
00091         BlockLattice3D<T,TemperatureDescriptor>& temperature )
00092 {
00093     BlockStatistics& statistics = this->getStatistics();
00094     for (plint iX=domain.x0; iX<=domain.x1; ++iX) 
00095     {
00096         for (plint iY=domain.y0; iY<=domain.y1; ++iY) 
00097         {
00098             for (plint iZ=domain.z0; iZ<=domain.z1; ++iZ) 
00099             {
00100                 Array<T,FluidDescriptor<T>::d> velocity;
00101                 fluid.get(iX,iY,iZ).computeVelocity(velocity);
00102                 T localTemperature = temperature.get(iX,iY,iZ).computeDensity();
00103                 
00104                 T velocityTemperature = localTemperature * velocity[direction];
00105                 statistics.gatherSum(sumVelocityTemperatureId, velocityTemperature);
00106             }
00107         }
00108     }
00109 }
00110 
00111 template< typename T,
00112           template<typename U1> class FluidDescriptor, 
00113           template<typename U2> class TemperatureDescriptor
00114         >
00115 BoxSumVelocityTemperatureFunctional3D<T,FluidDescriptor,TemperatureDescriptor>*
00116         BoxSumVelocityTemperatureFunctional3D<T,FluidDescriptor,TemperatureDescriptor>::clone() const
00117 {
00118     return new BoxSumVelocityTemperatureFunctional3D<T,FluidDescriptor,TemperatureDescriptor>(*this);
00119 }
00120 
00121 template< typename T,
00122           template<typename U1> class FluidDescriptor, 
00123           template<typename U2> class TemperatureDescriptor
00124         >
00125 T BoxSumVelocityTemperatureFunctional3D<T,FluidDescriptor,TemperatureDescriptor>::getSumVelocityTemperature() const 
00126 {
00127     return this->getStatistics().getSum(sumVelocityTemperatureId);
00128 }
00129 
00130 }  // namespace plb
00131 
00132 #endif  // THERMAL_DATA_ANALYSIS_3D_HH