/
formulae_mpdata_dfl_3d.hpp
116 lines (111 loc) · 3.41 KB
/
formulae_mpdata_dfl_3d.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/** @file
* @copyright University of Warsaw
* @section LICENSE
* GPLv3+ (see the COPYING file or http://www.gnu.org/licenses/)
*/
#pragma once
#include <libmpdata++/formulae/mpdata/formulae_mpdata_common.hpp>
#include <libmpdata++/formulae/mpdata/formulae_mpdata_g_3d.hpp>
#include <libmpdata++/formulae/mpdata/formulae_mpdata_psi_3d.hpp>
namespace libmpdataxx
{
namespace formulae
{
namespace mpdata
{
// divergent flow correction - no correction
template<opts_t opts, int dim, class arr_3d_t, class ix_t>
inline auto DFL(
const arr_3d_t &psi,
const arrvec_t<arr_3d_t> &GC,
const arr_3d_t &G,
const ix_t &i,
const ix_t &j,
const ix_t &k,
typename std::enable_if<!opts::isset(opts, opts::dfl)>::type* = 0
)
{
return 0;
}
// divergent flow correction - general case
template<opts_t opts, int dim, class arr_3d_t, class ix_t>
inline auto DFL(
const arr_3d_t &psi, //to have the same arguments as in iga option
const arrvec_t<arr_3d_t> &GC,
const arr_3d_t &G,
const ix_t &i,
const ix_t &j,
const ix_t &k,
typename std::enable_if<opts::isset(opts, opts::dfl) && !opts::isset(opts, opts::iga)>::type* = 0
)
{
return return_helper<ix_t>(
- fconst<arr_3d_t>(0.25) * GC[dim](pi<dim>(i+h, j, k))
/
G_bar_x<opts, dim>(G, i, j, k)
*
(
(
GC[dim](pi<dim>((i+1)+h, j, k)) -
GC[dim](pi<dim>(i-h , j, k))
)
+
(
GC[dim+1](pi<dim>(i+1, j+h, k)) +
GC[dim+1](pi<dim>(i, j+h, k)) -
GC[dim+1](pi<dim>(i+1, j-h, k)) -
GC[dim+1](pi<dim>(i, j-h, k))
)
+
(
GC[dim-1](pi<dim>(i+1, j, k+h)) +
GC[dim-1](pi<dim>(i, j, k+h)) -
GC[dim-1](pi<dim>(i+1, j, k-h)) -
GC[dim-1](pi<dim>(i, j, k-h))
)
)
);
}
// divergent flow correction - infinite gauge version
template<opts_t opts, int dim, class arr_3d_t, class ix_t>
inline auto DFL(
const arr_3d_t &psi,
const arrvec_t<arr_3d_t> &GC,
const arr_3d_t &G,
const ix_t &i,
const ix_t &j,
const ix_t &k,
typename std::enable_if<opts::isset(opts, opts::dfl) && opts::isset(opts, opts::iga)>::type* = 0
)
{
return return_helper<ix_t>(
- fconst<arr_3d_t>(0.25) * GC[dim](pi<dim>(i+h, j, k))
/
G_bar_x<opts, dim>(G, i, j, k)
*
(
(
GC[dim](pi<dim>((i+1)+h, j, k)) -
GC[dim](pi<dim>(i-h , j, k))
)
+
(
GC[dim+1](pi<dim>(i+1, j+h, k)) +
GC[dim+1](pi<dim>(i, j+h, k)) -
GC[dim+1](pi<dim>(i+1, j-h, k)) -
GC[dim+1](pi<dim>(i, j-h, k))
)
+
(
GC[dim-1](pi<dim>(i+1, j, k+h)) +
GC[dim-1](pi<dim>(i, j, k+h)) -
GC[dim-1](pi<dim>(i+1, j, k-h)) -
GC[dim-1](pi<dim>(i, j, k-h))
)
)
* psi_bar_x<opts, dim>(psi, i, j, k)
);
}
} // namespace mpdata
} // namespace formulae
} // namespace libmpdataxx