Mass conservation

The mass conservation is defined at each cell center and described as:

\[\pder{\rho}{t} + \frac{1}{J} \dif{}{\gx} \left( \jhx \rho \ux \right) + \frac{1}{J} \dif{}{\gy} \left( \jhy \rho \uy \right) + \frac{1}{J} \dif{}{\gz} \left( \jhz \rho \uz \right) = 0.\]

Specifically the rescaled version

\[\pder{H}{t} + \frac{1}{J} \dif{}{\gx} \left( \jhx \ux H \right) + \frac{1}{J} \dif{}{\gy} \left( \jhy \uy H \right) + \frac{1}{J} \dif{}{\gz} \left( \jhz \uz H \right) = 0\]

is considered.

src/interface/update/main.c
 86const double hx_xm = HXXF(i  );
 87const double hx_xp = HXXF(i+1);
 88const double jd_xm = JDXF(i  );
 89const double jd_x0 = JDXC(i  );
 90const double jd_xp = JDXF(i+1);
 91const double flux_xm = FLUXX(i  , j  );
 92const double flux_xp = FLUXX(i+1, j  );
 93const double flux_ym = FLUXY(i  , j  );
 94const double flux_yp = FLUXY(i  , j+1);
 95SRC(i, j) = 1. / jd_x0 * (
 96    + jd_xm / hx_xm * flux_xm
 97    - jd_xp / hx_xp * flux_xp
 98    + jd_x0 / hy    * flux_ym
 99    - jd_x0 / hy    * flux_yp
100);
src/interface/update/main.c
108const double hx_xm = HXXF(i  );
109const double hx_xp = HXXF(i+1);
110const double jd_xm = JDXF(i  );
111const double jd_x0 = JDXC(i  );
112const double jd_xp = JDXF(i+1);
113const double flux_xm = FLUXX(i  , j  , k  );
114const double flux_xp = FLUXX(i+1, j  , k  );
115const double flux_ym = FLUXY(i  , j  , k  );
116const double flux_yp = FLUXY(i  , j+1, k  );
117const double flux_zm = FLUXZ(i  , j  , k  );
118const double flux_zp = FLUXZ(i  , j  , k+1);
119SRC(i, j, k) = 1. / jd_x0 * (
120    + jd_xm / hx_xm * flux_xm
121    - jd_xp / hx_xp * flux_xp
122    + jd_x0 / hy    * flux_ym
123    - jd_x0 / hy    * flux_yp
124    + jd_x0 / hz    * flux_zm
125    - jd_x0 / hz    * flux_zp
126);