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

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