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

advectionDiffusionMomentTemplates2D.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 
00025 /* Main author: Orestis Malaspinas
00026  */
00027 
00034 #ifndef ADVECTION_DIFFUSION_MOMENTS_TEMPLATES_2D_H
00035 #define ADVECTION_DIFFUSION_MOMENTS_TEMPLATES_2D_H
00036 
00037 namespace plb {
00038 
00039 // This structure forwards the calls to the appropriate helper class
00040 template<typename T>
00041 struct advectionDiffusionMomentTemplatesImpl<T,descriptors::D2Q5DescriptorBase<T> >
00042 {
00043     
00044 typedef descriptors::D2Q5DescriptorBase<T> Descriptor;
00045     
00046 static void get_rhoBar_jEq(Array<T,Descriptor::q> const& f, T& rhoBar, 
00047                            Array<T,Descriptor::d>& jEq, const T u[Descriptor::d] )
00048 {
00049     rhoBar = momentTemplatesImpl<T,Descriptor>::get_rhoBar(f);
00050     T rho = Descriptor::fullRho(rhoBar);
00051     jEq[0] = rho * u[0];
00052     jEq[1] = rho * u[1];
00053 }
00054     
00055 static void get_rhoBar_jEq_jNeq(Array<T,Descriptor::q> const& f, T& rhoBar, 
00056                                 Array<T,Descriptor::d>& jEq, Array<T,Descriptor::d>& jNeq,
00057                                 const T *u)
00058 {
00059     rhoBar = momentTemplatesImpl<T,Descriptor>::get_rhoBar(f);
00060     T rho = Descriptor::fullRho(rhoBar);
00061     jEq[0] = rho * u[0];
00062     jEq[1] = rho * u[1];
00063     
00064     jNeq[0] = - f[1] + f[3] - jEq[0];
00065     jNeq[1] = - f[2] + f[4] - jEq[1];
00066 }
00067 
00068 static void get_jEq(const T& rhoBar, Array<T,Descriptor::d>& jEq, const T *u)
00069 {
00070     T rho = Descriptor::fullRho(rhoBar);
00071     jEq[0] = rho * u[0];
00072     jEq[1] = rho * u[1];
00073 }
00074 
00075 };  // struct advectionDiffusionMomentTemplatesImpl
00076 
00077 }  // namespace plb
00078 
00079 #endif