Resulting schemes¶
We discretize the mentioned equations as follows. Note that we define several symbols for notational convenience.
The advective terms are implemented in tri-diagonal-like ways to insist the advective operators are skew-symmetric (c.f., Verstappen and Veldman, J. Comput. Phys. (187), 2003). Since the diffusive terms are given by the vector Laplacian of the velocity vector, the discrete Laplace operators are pre-computed.
Incompressibility constraint¶
We define this relation for each cell center \(\left( \ccidx{i}, \ccidx{j}, \ccidx{k} \right)\):
The left-hand side is monitored to confirm if the maximum divergence of the flow field is sufficiently small (\(\approx 0\)):
69 double divmax = 0.;
70 BEGIN
71 const double hx_xm = HXXF(i );
72 const double hx_xp = HXXF(i+1);
73 const double jd_xm = JDXF(i );
74 const double jd_x0 = JDXC(i );
75 const double jd_xp = JDXF(i+1);
76#if NDIMS == 2
77 const double ux_xm = UX(i , j );
78 const double ux_xp = UX(i+1, j );
79 const double uy_ym = UY(i , j );
80 const double uy_yp = UY(i , j+1);
81#else
82 const double ux_xm = UX(i , j , k );
83 const double ux_xp = UX(i+1, j , k );
84 const double uy_ym = UY(i , j , k );
85 const double uy_yp = UY(i , j+1, k );
86 const double uz_zm = UZ(i , j , k );
87 const double uz_zp = UZ(i , j , k+1);
88#endif
89 const double div = 1. / jd_x0 * (
90 - jd_xm / hx_xm * ux_xm + jd_xp / hx_xp * ux_xp
91 - jd_x0 / hy * uy_ym + jd_x0 / hy * uy_yp
92#if NDIMS == 3
93 - jd_x0 / hz * uz_zm + jd_x0 / hz * uz_zp
94#endif
95 );
96 // check maximum
97 divmax = fmax(divmax, fabs(div));
98 END
Momentum balance¶
The following relations are defined at the corresponding cell faces.
The implementations are elaborated below.
Internal energy balance¶
We define this relation for each cell center \(\left( \ccidx{i}, \ccidx{j}, \ccidx{k} \right)\):
The implementations are elaborated below.