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

variableOmegaDynamics.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 /* Orestis Malaspinas designed some of the classes and concepts contained
00026  * in this file. */
00027 
00028 #ifndef VARIABLE_OMEGA_DYNAMICS_HH
00029 #define VARIABLE_OMEGA_DYNAMICS_HH
00030 
00031 #include "complexDynamics/variableOmegaDynamics.h"
00032 #include "latticeBoltzmann/momentTemplates.h"
00033 
00034 namespace plb {
00035 
00036 template<typename T, template<typename U> class Descriptor>
00037 VariableOmegaDynamics<T,Descriptor>::VariableOmegaDynamics (
00038         Dynamics<T,Descriptor>* baseDynamics_, bool automaticPrepareCollision_ )
00039     : CompositeDynamics<T,Descriptor>(baseDynamics_, automaticPrepareCollision_)
00040 { }
00041 
00042 template<typename T, template<typename U> class Descriptor>
00043 void VariableOmegaDynamics<T,Descriptor>::serialize(HierarchicSerializer& serializer) const
00044 {
00045     CompositeDynamics<T,Descriptor>::serialize(serializer);
00046 }
00047 
00048 template<typename T, template<typename U> class Descriptor>
00049 void VariableOmegaDynamics<T,Descriptor>::unserialize(HierarchicUnserializer& unserializer)
00050 {
00051     CompositeDynamics<T,Descriptor>::unserialize(unserializer);
00052 }
00053 
00054 template<typename T, template<typename U> class Descriptor>
00055 void VariableOmegaDynamics<T,Descriptor>::prepareCollision(Cell<T,Descriptor>& cell) {
00056     // Remember: it's the baseDynamics that holds omega=omega0+deltaOmega.
00057     // The value of this->getOmega() is omega0, and this should not be modified here.
00058     this->getBaseDynamics().setOmega(getOmegaFromCell(cell));
00059 }
00060 
00061 template<typename T, template<typename U> class Descriptor>
00062 OmegaFromPiDynamics<T,Descriptor>::OmegaFromPiDynamics(Dynamics<T,Descriptor>* baseDynamics_, bool automaticPrepareCollision_)
00063     : VariableOmegaDynamics<T,Descriptor>(baseDynamics_, automaticPrepareCollision_)
00064 { }
00065 
00066 template<typename T, template<typename U> class Descriptor>
00067 void OmegaFromPiDynamics<T,Descriptor>::serialize(HierarchicSerializer& serializer) const
00068 {
00069     VariableOmegaDynamics<T,Descriptor>::serialize(serializer);
00070 }
00071 
00072 template<typename T, template<typename U> class Descriptor>
00073 void OmegaFromPiDynamics<T,Descriptor>::unserialize(HierarchicUnserializer& unserializer)
00074 {
00075     VariableOmegaDynamics<T,Descriptor>::unserialize(unserializer);
00076 }
00077 
00078 template<typename T, template<typename U> class Descriptor>
00079 T OmegaFromPiDynamics<T,Descriptor>::getOmegaFromCell(Cell<T,Descriptor> const& cell) const {
00080     Dynamics<T,Descriptor> const& dynamics=cell.getDynamics();
00081 
00082     T rhoBar;
00083     Array<T,Descriptor<T>::d> j;
00084     Array<T,SymmetricTensor<T,Descriptor>::n> PiNeq;
00085     dynamics.computeRhoBarJPiNeq(cell, rhoBar, j, PiNeq);
00086     return getOmegaFromPiAndRhoBar(PiNeq, rhoBar);
00087 }
00088 
00089 } // namespace plb
00090 
00091 #endif  // VARIABLE_OMEGA_DYNAMICS_HH