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

advectionDiffusionDynamicsTemplates2D.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 
00031 #ifndef ADVECTION_DIFFUSION_DYNAMICS_TEMPLATES_2D_H
00032 #define ADVECTION_DIFFUSION_DYNAMICS_TEMPLATES_2D_H
00033 
00034 namespace plb {
00035 
00037 template<typename T>
00038 struct advectionDiffusionDynamicsTemplatesImpl<T,descriptors::D2Q5DescriptorBase<T> >
00039 {
00040     
00041 typedef descriptors::D2Q5DescriptorBase<T> Descriptor;
00042 
00043 static T bgk_ma1_equilibrium(plint iPop, T rhoBar, Array<T,Descriptor::d> const& jEq) 
00044 {
00045     return Descriptor::t[iPop] * (rhoBar + Descriptor::invCs2 * 
00046             (Descriptor::c[iPop][0]*jEq[0]+Descriptor::c[iPop][1]*jEq[1]));
00047 }
00048 
00050 static void regularize( Array<T,Descriptor::q>& f, T rhoBar,
00051                         Array<T,Descriptor::d> const& jAdvDiff,
00052                         Array<T,Descriptor::d> const& jEq )
00053 {
00054     f[0] = Descriptor::t[0] * rhoBar;
00055     
00056     f[1] = Descriptor::t[1] * (rhoBar - Descriptor::invCs2*jAdvDiff[0]);
00057     f[2] = Descriptor::t[2] * (rhoBar - Descriptor::invCs2*jAdvDiff[1]);
00058     f[3] = Descriptor::t[3] * (rhoBar + Descriptor::invCs2*jAdvDiff[0]);
00059     f[4] = Descriptor::t[4] * (rhoBar + Descriptor::invCs2*jAdvDiff[1]);
00060 }
00061 
00062 static T no_corr_bgk_collision (
00063         Array<T,Descriptor::q>& f, T rhoBar, Array<T,Descriptor::d> const& jEq, 
00064         T omega ) 
00065 {
00066     T invRho = Descriptor::invRho(rhoBar);
00067     const T jSqr = jEq[0]*jEq[0] + jEq[1]*jEq[1];
00068     
00069     const T oneMinusOmega = (T)1 - omega;
00070     const T halfOmega = (T)0.5 * omega;
00071     const T cs2RhoBar = Descriptor::cs2*rhoBar;
00072     
00073     f[0] = oneMinusOmega*f[0]+omega*((T)1-2*Descriptor::cs2)*rhoBar;
00074     
00075     f[1] = oneMinusOmega*f[1]+halfOmega*(cs2RhoBar-jEq[0]);
00076     f[2] = oneMinusOmega*f[2]+halfOmega*(cs2RhoBar-jEq[1]);
00077     f[3] = oneMinusOmega*f[3]+halfOmega*(cs2RhoBar+jEq[0]);
00078     f[4] = oneMinusOmega*f[4]+halfOmega*(cs2RhoBar+jEq[1]);
00079 
00080     
00081     return jSqr*invRho*invRho;
00082 }
00083 
00084 static T no_corr_rlb_collision (
00085     Array<T,Descriptor::q>& f, T rhoBar, Array<T,Descriptor::d> const& jEq,
00086     Array<T,Descriptor::d> const& jNeq,T omega )
00087 {
00088     T invRho = Descriptor::invRho(rhoBar);
00089     const T jSqr = jEq[0]*jEq[0] + jEq[1]*jEq[1];
00090     
00091     const T oneHalfMinusHalfOmega = (T)0.5-(T)0.5*omega;
00092     const T cs2RhoBar = Descriptor::cs2 * rhoBar;
00093     
00094     const T jNeqTerm_0 = oneHalfMinusHalfOmega*jNeq[0];
00095     const T jNeqTerm_1 = oneHalfMinusHalfOmega*jNeq[1];
00096     
00097     f[0] = ((T)1-(T)2*Descriptor::cs2)*rhoBar;
00098     
00099     f[1] = -jNeqTerm_0 + (T)0.5*(cs2RhoBar-jEq[0]);
00100     f[2] = -jNeqTerm_1 + (T)0.5*(cs2RhoBar-jEq[1]);
00101     
00102     f[3] = -f[1] + cs2RhoBar;
00103     f[4] = -f[2] + cs2RhoBar;
00104             
00105     return jSqr*invRho*invRho;
00106 }
00107 
00108 };  // struct advectionDiffusionDynamicsTemplatesImpl
00109 
00110 }  // namespace plb
00111 
00112 #endif