OpenLB 1.7
Loading...
Searching...
No Matches
entropicLbHelpers3D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2006, 2007 Jonas Latt
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
28#ifndef ENTROPIC_LB_HELPERS_3D_H
29#define ENTROPIC_LB_HELPERS_3D_H
30
31#include "utilities/omath.h"
32
33namespace olb {
34
35template<typename T>
36struct entropicLbHelpers<T, descriptors::D3Q19<>> {
39 static T equilibrium( int iPop, T rho, const T u[3])
40 {
41 typedef descriptors::D3Q19<> L;
42
43 T c_u = descriptors::c<L>(iPop,0)*u[0] + descriptors::c<L>(iPop,1)*u[1] + descriptors::c<L>(iPop,2)*u[2];;
44 T c_u2 = c_u*c_u;
45 T c_u3 = c_u2*c_u;
46 T c_u4 = c_u3*c_u;
47 T c_u5 = c_u4*c_u;
48 T c_u6 = c_u5*c_u;
49 T c_u7 = c_u6*c_u;
50
51 T uSqr = u[0]*u[0] + u[1]*u[1] + u[2]*u[2];
52 T uSqr2 = uSqr*uSqr;
53 T uSqr3 = uSqr2*uSqr;
54
55 T powUx = u[0]*u[0]*u[0]*u[0]*u[0]; // u_x^5
56 T powUy = u[1]*u[1]*u[1]*u[1]*u[1]; // u_y^5
57 T powUz = u[2]*u[2]*u[2]*u[2]*u[2]; // u_z^5
58
59 T C = descriptors::c<L>(iPop,0) * powUx + descriptors::c<L>(iPop,1) * powUy
60 + descriptors::c<L>(iPop,2) * powUz;
61
62 powUx *= u[0]; // u_x^6
63 powUy *= u[1]; // u_y^6
64 powUz *= u[2]; // u_z^6
65
66 T E = powUx + powUy + powUz;
67
68 powUx *= u[0]; // u_x^7
69 powUy *= u[1]; // u_y^7
70 powUz *= u[2]; // u_z^7
71
72 T F = descriptors::c<L>(iPop,0) * powUx + descriptors::c<L>(iPop,1) * powUy + descriptors::c<L>(iPop,2) * powUz;
73
74 return descriptors::t<T,L>(iPop) * rho *
75 ((T)1
76 + c_u*(C*(T)81/(T)20 + uSqr2*(T)27/(T)8 - uSqr*(T)9/(T)2
77 - E*(T)81/(T)24 - uSqr3*(T)81/(T)48 + (T)3)
78
79 + c_u2*(uSqr2*(T)81/(T)16 - uSqr*(T)27/(T)4
80 + C*(T)243/(T)40 + (T)9/(T)2)
81
82 + c_u3*(uSqr2*(T)243/(T)48 - uSqr*(T)81/(T)12 + (T)27/(T)6)
83
84 - c_u4*uSqr*(T)243/(T)48
85 + c_u4*(T)81/(T)24
86
87 - c_u5*uSqr*(T)729/(T)240
88 + c_u5*(T)243/(T)120
89
90 + c_u6*(T)729/(T)720
91
92 + c_u7*(T)2187/(T)5040
93
94 - C*uSqr*(T)81/(T)40
95
96 + C*(T)27/(T)20 - uSqr3*(T)27/(T)48 - E*(T)27/(T)24
97 - F*(T)81/(T)56 - uSqr*(T)3/(T)2 + uSqr2*(T)9/(T)8
98 )
99 - descriptors::t<T,L>(iPop);
100 }
101
102};
103
104}
105
106#endif
Top level namespace for all of OpenLB.
static T equilibrium(int iPop, T rho, const T u[3])
Computation of equilibrium distribution with an expansion with respect to a small velocity u.