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

bounceBackModels.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 BOUNCE_BACK_MODELS_H
00030 #define BOUNCE_BACK_MODELS_H
00031 
00032 #include "core/dynamics.h"
00033 #include <vector>
00034 
00035 namespace plb {
00036 
00038 
00050 template<typename T, template<typename U> class Descriptor>
00051 class MomentumExchangeBounceBack : public Dynamics<T,Descriptor> {
00052 public:
00053 /* *************** Construction / Destruction ************************ */
00054 
00062     MomentumExchangeBounceBack(Array<plint, Descriptor<T>::d> forceIds_, T rho_=T() );
00063     
00064     MomentumExchangeBounceBack(HierarchicUnserializer& unserializer);
00065 
00067     virtual MomentumExchangeBounceBack<T,Descriptor>* clone() const;
00068     
00070     virtual int getId() const;
00071     
00072     virtual void serialize(HierarchicSerializer& serializer) const;
00073 
00074     virtual void unserialize(HierarchicUnserializer& unserializer);
00075     
00076 /* *************** Collision, Equilibrium, and Non-equilibrium ******* */
00077 
00079     virtual void collide(Cell<T,Descriptor>& cell,
00080                          BlockStatistics& statistics_);
00081 
00083     virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00084                                  T jSqr, T thetaBar=T()) const;
00085 
00087     virtual void regularize(Cell<T,Descriptor>& cell, T rhoBar, Array<T,Descriptor<T>::d> const& j,
00088                             T jSqr, Array<T,SymmetricTensor<T,Descriptor>::n> const& PiNeq, T thetaBar=T() ) const;
00089 
00090 /* *************** Computation of macroscopic variables ************** */
00091 
00093     virtual T computeDensity(Cell<T,Descriptor> const& cell) const;
00095     virtual T computePressure(Cell<T,Descriptor> const& cell) const;
00097     virtual void computeVelocity( Cell<T,Descriptor> const& cell,
00098                                   Array<T,Descriptor<T>::d>& u ) const;
00100     virtual T computeTemperature(Cell<T,Descriptor> const& cell) const;
00102     virtual void computeDeviatoricStress (
00103         Cell<T,Descriptor> const& cell, Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq ) const;
00105     virtual void computeHeatFlux( Cell<T,Descriptor> const& cell,
00106                                   Array<T,Descriptor<T>::d>& q ) const;
00107 
00109     virtual void computeMoment( Cell<T,Descriptor> const& cell,
00110                                 plint momentId, T* moment ) const;
00111 
00112 /* *************** Access to Dynamics variables, e.g. omega ********** */
00113 
00115     virtual T getOmega() const;
00116 
00118     virtual void setOmega(T omega_);
00119 
00120 /* *************** Switch between population and moment representation ****** */
00121 
00123     virtual plint numDecomposedVariables(plint order) const;
00124 
00126     virtual void decompose(Cell<T,Descriptor> const& cell, std::vector<T>& rawData, plint order) const;
00127 
00129     virtual void recompose(Cell<T,Descriptor>& cell, std::vector<T> const& rawData, plint order) const;
00130 
00132     virtual void rescale(std::vector<T>& rawData, T xDxInv, T xDt, plint order) const;
00133 
00134 /* *************** Additional moments, intended for internal use ***** */
00135 
00137     virtual T computeRhoBar(Cell<T,Descriptor> const& cell) const;
00138 
00140     virtual void computeRhoBarJ(Cell<T,Descriptor> const& cell,
00141                                 T& rhoBar, Array<T,Descriptor<T>::d>& j) const;
00142 
00145     virtual void computeRhoBarJPiNeq(Cell<T,Descriptor> const& cell,
00146                                      T& rhoBar, Array<T,Descriptor<T>::d>& j,
00147                                      Array<T,SymmetricTensor<T,Descriptor>::n>& PiNeq) const;
00149     virtual T computeEbar(Cell<T,Descriptor> const& cell) const;
00150 public:
00152     void setFluidDirections(std::vector<plint> const& fluidDirections_);
00154     std::vector<plint> const& getFluidDirections() const;
00155 private:
00156     std::vector<plint> fluidDirections;
00157     Array<plint, Descriptor<T>::d> forceIds;
00158     T rho;
00159 private:
00160     static int id;
00161 };
00162 
00163 }  // namespace plb
00164 
00165 #endif  // BOUNCE_BACK_MODELS_H