OpenLB 1.7
Loading...
Searching...
No Matches
entropicLbHelpers2D.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_2D_H
29#define ENTROPIC_LB_HELPERS_2D_H
30
31#include "utilities/omath.h"
32
33namespace olb {
34
35template<typename T>
36struct entropicLbHelpers<T, descriptors::D2Q9<>> {
39 static T equilibrium( int iPop, T rho, const T u[2])
40 {
41 typedef descriptors::D2Q9<> L;
42
43 T c_u = descriptors::c<L>(iPop,0)*u[0] + descriptors::c<L>(iPop,1)*u[1];
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];
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
58 T C = descriptors::c<L>(iPop,0) * powUx + descriptors::c<L>(iPop,1) * powUy;
59
60 powUx *= u[0]; // u_x^6
61 powUy *= u[1]; // u_y^6
62
63 T E = powUx + powUy;
64
65 powUx *= u[0]; // u_x^7
66 powUy *= u[1]; // u_y^7
67
68 T F = descriptors::c<L>(iPop,0) * powUx + descriptors::c<L>(iPop,1) * powUy;
69
70 return descriptors::t<T,L>(iPop) * rho *
71 ((T)1
72 + c_u*(C*(T)81/(T)20 + uSqr2*(T)27/(T)8 - uSqr*(T)9/(T)2
73 - E*(T)81/(T)24 - uSqr3*(T)81/(T)48 + (T)3)
74
75 + c_u2*(uSqr2*(T)81/(T)16 - uSqr*(T)27/(T)4
76 + C*(T)243/(T)40 + (T)9/(T)2)
77
78 + c_u3*(uSqr2*(T)243/(T)48 - uSqr*(T)81/(T)12 + (T)27/(T)6)
79
80 - c_u4*uSqr*(T)243/(T)48
81 + c_u4*(T)81/(T)24
82
83 - c_u5*uSqr*(T)729/(T)240
84 + c_u5*(T)243/(T)120
85
86 + c_u6*(T)729/(T)720
87
88 + c_u7*(T)2187/(T)5040
89
90 - C*uSqr*(T)81/(T)40
91
92 + C*(T)27/(T)20 - uSqr3*(T)27/(T)48 - E*(T)27/(T)24
93 - F*(T)81/(T)56 - uSqr*(T)3/(T)2 + uSqr2*(T)9/(T)8
94 )
95 - descriptors::t<T,L>(iPop);
96 }
97
98};
99
100}
101
102#endif
Top level namespace for all of OpenLB.
static T equilibrium(int iPop, T rho, const T u[2])
Computation of equilibrium distribution with an expansion with respect to a small velocity u.