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

parallelDynamics.h

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 
00029 #ifndef PARALLEL_DYNAMICS_H
00030 #define PARALLEL_DYNAMICS_H
00031 
00032 #include "core/globalDefs.h"
00033 #include "core/dynamics.h"
00034 #include "core/cell.h"
00035 
00036 
00037 namespace plb {
00038 
00039 #ifdef PLB_MPI_PARALLEL
00040 
00041 template<typename T, template<typename U> class Descriptor>
00042 class ParallelDynamics : public Dynamics<T,Descriptor> {
00043 public:
00044     ParallelDynamics(std::vector<Cell<T,Descriptor>*>& baseCells_, bool hasBulkCell_);
00045     virtual Dynamics<T,Descriptor>* clone() const;
00046     virtual void collide(Cell<T,Descriptor>& cell,
00047                          BlockStatistics& statistics_);
00048     virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00049                                  T jSqr, T thetaBar=T()) const;
00050     virtual void regularize(Cell<T,Descriptor>& cell, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00051                             T jSqr, Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq, T thetaBar=T() ) const;
00052     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00053     virtual T computePressure(Cell<T,Descriptor> const& cell) const;
00054     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00055                                   Array<T,Descriptor<T>::d>& u ) const;
00056     virtual T computeTemperature(Cell<T,Descriptor> const& cell) const;
00057     virtual void computeDeviatoricStress (
00058         Cell<T,Descriptor> const& cell, Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const;
00059     virtual void computeHeatFlux( Cell<T,Descriptor> const& cell,
00060                                   Array<T,Descriptor<T>::d>& q ) const;
00061     virtual void computeMoment( Cell<T,Descriptor> const& cell,
00062                                 plint momentId, T* moment ) const;
00063     virtual T getOmega() const;
00064     virtual void setOmega(T omega_);
00065     virtual T getParameter(plint whichParameter) const;
00066     virtual void setParameter(plint whichParameter, T value);
00067     virtual plint numDecomposedVariables(plint order) const;
00068     virtual void decompose(Cell<T,Descriptor> const& cell, std::vector<T>& rawData, plint order) const;
00069     virtual void recompose(Cell<T,Descriptor>& cell, std::vector<T> const& rawData, plint order) const;
00070     virtual void rescale(std::vector<T>& rawData, T xDxInv, T xDt, plint order) const;
00071     virtual void getPopulations(Cell<T,Descriptor> const& cell, Array<T,Descriptor<T>::q>& f) const;
00072     virtual void getExternalField (
00073             Cell<T,Descriptor> const& cell, plint pos, plint size, T* ext ) const;
00074     virtual void setPopulations(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::q> const& f);
00075     virtual void setExternalField (
00076             Cell<T,Descriptor>& cell, plint pos, plint size, const T* ext);
00077     virtual void defineDensity(Cell<T,Descriptor>& cell, T density);
00078     virtual void defineVelocity(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& u);
00079     virtual void defineTemperature(Cell<T,Descriptor>& cell, T temperature);
00080     virtual void defineHeatFlux(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& q);
00081     virtual void defineDeviatoricStress(Cell<T,Descriptor>& cell,
00082                                         Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq);
00083     virtual void defineMoment(Cell<T,Descriptor>& cell, plint momentId, T const* value);
00084     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00085     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00086                                 T& rhoBar, Array<T,Descriptor<T>::d>& j) const;
00087     virtual void computeRhoBarJPiNeq(Cell<T,Descriptor> const& cell,
00088                                      T& rhoBar, Array<T,Descriptor<T>::d>& j,
00089                                      Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq) const;
00090     virtual T computeEbar(Cell<T,Descriptor> const& cell) const;
00091 private:
00092     std::vector<Cell<T,Descriptor>*>& baseCells;
00093     bool hasBulkCell;
00094 };
00095 
00096 template<typename T, template<typename U> class Descriptor>
00097 class ConstParallelDynamics : public Dynamics<T,Descriptor> {
00098 public:
00099     ConstParallelDynamics(std::vector<Cell<T,Descriptor> const*>& baseCells_, bool hasBulkCell_);
00100     virtual Dynamics<T,Descriptor>* clone() const;
00101     virtual void collide(Cell<T,Descriptor>& cell,
00102                          BlockStatistics& statistics_);
00103     virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00104                                  T jSqr, T thetaBar=T()) const;
00105     virtual void regularize(Cell<T,Descriptor>& cell, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00106                             T jSqr, Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq, T thetaBar=T() ) const;
00107     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00108     virtual T computePressure(Cell<T,Descriptor> const& cell) const;
00109     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00110                                   Array<T,Descriptor<T>::d>& u ) const;
00111     virtual T computeTemperature(Cell<T,Descriptor> const& cell) const;
00112     virtual void computeDeviatoricStress (
00113         Cell<T,Descriptor> const& cell, Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const;
00114     virtual void computeHeatFlux( Cell<T,Descriptor> const& cell,
00115                                   Array<T,Descriptor<T>::d>& q ) const;
00116     virtual void computeMoment( Cell<T,Descriptor> const& cell,
00117                                 plint momentId, T* moment ) const;
00118     virtual T getOmega() const;
00119     virtual void setOmega(T omega_);
00120     virtual T getParameter(plint whichParameter) const;
00121     virtual void setParameter(plint whichParameter, T value);
00122     virtual plint numDecomposedVariables(plint order) const;
00123     virtual void decompose(Cell<T,Descriptor> const& cell, std::vector<T>& rawData, plint order) const;
00124     virtual void recompose(Cell<T,Descriptor>& cell, std::vector<T> const& rawData, plint order) const;
00125     virtual void rescale(std::vector<T>& rawData, T xDxInv, T xDt, plint order) const;
00126     virtual void getPopulations(Cell<T,Descriptor> const& cell, Array<T,Descriptor<T>::q>& f) const;
00127     virtual void getExternalField (
00128             Cell<T,Descriptor> const& cell, plint pos, plint size, T* ext ) const;
00129     virtual void setPopulations(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::q> const& f);
00130     virtual void setExternalField (
00131             Cell<T,Descriptor>& cell, plint pos, plint size, const T* ext);
00132     virtual void defineDensity(Cell<T,Descriptor>& cell, T density);
00133     virtual void defineVelocity(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& u);
00134     virtual void defineTemperature(Cell<T,Descriptor>& cell, T temperature);
00135     virtual void defineHeatFlux(Cell<T,Descriptor>& cell, Array<T,Descriptor<T>::d> const& q);
00136     virtual void defineDeviatoricStress(Cell<T,Descriptor>& cell,
00137                                         Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq);
00138     virtual void defineMoment(Cell<T,Descriptor>& cell, plint momentId, T const* value);
00139     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00140     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00141                                 T& rhoBar, Array<T,Descriptor<T>::d>& j) const;
00142     virtual void computeRhoBarJPiNeq(Cell<T,Descriptor> const& cell,
00143                                      T& rhoBar, Array<T,Descriptor<T>::d>& j,
00144                                      Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq) const;
00145     virtual T computeEbar(Cell<T,Descriptor> const& cell) const;
00146 private:
00147     std::vector<Cell<T,Descriptor> const*>& baseCells;
00148     bool hasBulkCell;
00149 };
00150 
00151 
00152 #endif // PLB_MPI_PARALLEL
00153 
00154 }  // namespace plb
00155 
00156 #endif // defined PARALLEL_DYNAMICS_H