OpenLB 1.7
Loading...
Searching...
No Matches
interactionPotential.cse.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2024 Tim Bingert, Luiz Czelusniak,
4 * Maximilian Schecher, Adrian Kummerlaender
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23*/
24
25#ifndef DYNAMICS_INTERACTION_POTENTIAL_CSE_H
26#define DYNAMICS_INTERACTION_POTENTIAL_CSE_H
27
28
29#ifndef DISABLE_CSE
30
31namespace olb {
32
33namespace interaction {
34
35template <>
36struct MCPRpseudoPotential<3> {
37
38template <typename _RHOFIELD, typename __T, typename _K, typename _A_C, typename _B, typename _T_C, typename _M, typename _ALPHA, typename _G_I, typename _G_II, typename _BIGM, typename V=typename _RHOFIELD::value_t>
39auto compute(const _RHOFIELD& rhoField, const __T& _T, const _K& k, const _A_C& a_c, const _B& b, const _T_C& T_c, const _M& m, const _ALPHA& alpha, const _G_I& g_I, const _G_II& g_II, const _BIGM& bigM) any_platform
40{
41auto x0 = rhoField[0]/bigM[0];
42auto x1 = x0*b[0];
43auto x2 = rhoField[1]/bigM[1];
44auto x3 = x2*b[1];
45auto x4 = rhoField[2]/bigM[2];
46auto x5 = x4*b[2];
47auto x6 = x1 + x3 + x5;
48auto x7 = _T*g_II[0] + g_I[0];
49auto x8 = V{1}/_T;
50auto x9 = x0*util::exp(-x7*x8*alpha[0]);
51auto x10 = _T*g_II[3] + g_I[3];
52auto x11 = x2*util::exp(-x10*x8*alpha[3]);
53auto x12 = _T*g_II[6] + g_I[6];
54auto x13 = x4*util::exp(-x12*x8*alpha[6]);
55auto x14 = _T*g_II[1] + g_I[1];
56auto x15 = x0*util::exp(-x14*x8*alpha[1]);
57auto x16 = _T*g_II[4] + g_I[4];
58auto x17 = x2*util::exp(-x16*x8*alpha[4]);
59auto x18 = _T*g_II[7] + g_I[7];
60auto x19 = x4*util::exp(-x18*x8*alpha[7]);
61auto x20 = _T*g_II[2] + g_I[2];
62auto x21 = x0*util::exp(-x20*x8*alpha[2]);
63auto x22 = _T*g_II[5] + g_I[5];
64auto x23 = x2*util::exp(-x22*x8*alpha[5]);
65auto x24 = _T*g_II[8] + g_I[8];
66auto x25 = x4*util::exp(-x24*x8*alpha[8]);
67return V{2.44948974278318}*util::sqrt(k*(V{1}*_T*(x0 + x2 + x4)/(x6 + V{-1}) + x6*(x0*((-(util::sqrt(_T/T_c[0]) + V{-1})*m[0] + V{1})*(-(util::sqrt(_T/T_c[0]) + V{-1})*m[0] + V{1}))*a_c[0]/b[0] - V{1.60455694171447}*x0*(x10*x11 + x12*x13 + x7*x9)/(x11 + x13 + x9) + x2*((-(util::sqrt(_T/T_c[1]) + V{-1})*m[1] + V{1})*(-(util::sqrt(_T/T_c[1]) + V{-1})*m[1] + V{1}))*a_c[1]/b[1] - V{1.60455694171447}*x2*(x14*x15 + x16*x17 + x18*x19)/(x15 + x17 + x19) + x4*((-(util::sqrt(_T/T_c[2]) + V{-1})*m[2] + V{1})*(-(util::sqrt(_T/T_c[2]) + V{-1})*m[2] + V{1}))*a_c[2]/b[2] - V{1.60455694171447}*x4*(x20*x21 + x22*x23 + x24*x25)/(x21 + x23 + x25))*V{1} / (V{2}*x1 + V{2}*x3 + V{2}*x5 + V{1} - (x6*x6))) + V{0.333333333333333}*rhoField[0] + V{0.333333333333333}*rhoField[1] + V{0.333333333333333}*rhoField[2]);
68}
69
70template <typename _RHOFIELD, typename __T, typename _A_C, typename _B, typename _T_C, typename _M, typename _ALPHA, typename _G_I, typename _G_II, typename _BIGM, typename V=typename _RHOFIELD::value_t>
71auto computeP(const _RHOFIELD& rhoField, const __T& _T, const _A_C& a_c, const _B& b, const _T_C& T_c, const _M& m, const _ALPHA& alpha, const _G_I& g_I, const _G_II& g_II, const _BIGM& bigM) any_platform
72{
73auto x0 = rhoField[0]/bigM[0];
74auto x1 = x0*b[0];
75auto x2 = rhoField[1]/bigM[1];
76auto x3 = x2*b[1];
77auto x4 = rhoField[2]/bigM[2];
78auto x5 = x4*b[2];
79auto x6 = x1 + x3 + x5;
80auto x7 = _T*g_II[0] + g_I[0];
81auto x8 = V{1}/_T;
82auto x9 = x0*util::exp(-x7*x8*alpha[0]);
83auto x10 = _T*g_II[3] + g_I[3];
84auto x11 = x2*util::exp(-x10*x8*alpha[3]);
85auto x12 = _T*g_II[6] + g_I[6];
86auto x13 = x4*util::exp(-x12*x8*alpha[6]);
87auto x14 = _T*g_II[1] + g_I[1];
88auto x15 = x0*util::exp(-x14*x8*alpha[1]);
89auto x16 = _T*g_II[4] + g_I[4];
90auto x17 = x2*util::exp(-x16*x8*alpha[4]);
91auto x18 = _T*g_II[7] + g_I[7];
92auto x19 = x4*util::exp(-x18*x8*alpha[7]);
93auto x20 = _T*g_II[2] + g_I[2];
94auto x21 = x0*util::exp(-x20*x8*alpha[2]);
95auto x22 = _T*g_II[5] + g_I[5];
96auto x23 = x2*util::exp(-x22*x8*alpha[5]);
97auto x24 = _T*g_II[8] + g_I[8];
98auto x25 = x4*util::exp(-x24*x8*alpha[8]);
99return -(V{1}*_T*(x0 + x2 + x4)/(x6 + V{-1}) + x6*(x0*((-(util::sqrt(_T/T_c[0]) + V{-1})*m[0] + V{1})*(-(util::sqrt(_T/T_c[0]) + V{-1})*m[0] + V{1}))*a_c[0]/b[0] - V{1.60455694171447}*x0*(x10*x11 + x12*x13 + x7*x9)/(x11 + x13 + x9) + x2*((-(util::sqrt(_T/T_c[1]) + V{-1})*m[1] + V{1})*(-(util::sqrt(_T/T_c[1]) + V{-1})*m[1] + V{1}))*a_c[1]/b[1] - V{1.60455694171447}*x2*(x14*x15 + x16*x17 + x18*x19)/(x15 + x17 + x19) + x4*((-(util::sqrt(_T/T_c[2]) + V{-1})*m[2] + V{1})*(-(util::sqrt(_T/T_c[2]) + V{-1})*m[2] + V{1}))*a_c[2]/b[2] - V{1.60455694171447}*x4*(x20*x21 + x22*x23 + x24*x25)/(x21 + x23 + x25))*V{1} / (V{2}*x1 + V{2}*x3 + V{2}*x5 + V{1} - (x6*x6)));
100}
101
102};
103
104}
105
106}
107
108#endif
109
110#endif
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100
ADf< T, DIM > exp(const ADf< T, DIM > &a)
Definition aDiff.h:455
Top level namespace for all of OpenLB.
#define any_platform
Define preprocessor macros for device-side functions, constant storage.
Definition platform.h:78
V compute(const RHO_FIELD &rhoField, const __T &_T, const K &k, const A_C &a_c, const B &b, const T_C &T_c, const M &m, const ALPHA &alpha, const G_I &g_I, const G_II &g_II, const BIG_M &_M) any_platform
V computeP(const RHO_FIELD &rhoField, V _T, const A_C &a_c, const B &b, const T_C &T_c, const M &m, const ALPHA &alpha, const G_I &g_I, const G_II &g_II, const BIG_M &_M) any_platform