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

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