Symbol

Averages, differentiations, and summations are denotes as follows.

Discrete scale factor and Jacobian determinant

In Cartesian coordinate systems, scale factors are simply equal to the grid sizes:

\[ \begin{align}\begin{aligned}\hx & \equiv \Delta x,\\\hy & \equiv \Delta y,\\\hz & \equiv \Delta z.\end{aligned}\end{align} \]
src/domain.c
276static double * allocate_and_init_hxxf(
277    const int isize,
278    const double * xc
279){
280  double * hxxf = memory_calloc(isize + 1, sizeof(double));
281  for(int i = 1; i <= isize + 1; i++){
282    HXXF(i  ) = XC(i  ) - XC(i-1);
283  }
284  return hxxf;
285}
src/domain.c
288static double * allocate_and_init_hxxc(
289    const int isize,
290    const double * xf
291){
292  double * hxxc = memory_calloc(isize, sizeof(double));
293  for(int i = 1; i <= isize; i++){
294    HXXC(i  ) = XF(i+1) - XF(i  );
295  }
296  return hxxc;
297}

Note that the wall-normal grid sizes are halved on the walls:

\[\vat{\Delta x}{\frac{1}{2}} = \vat{\Delta x}{\nx + \frac{1}{2}} = \frac{1}{2} \Delta x_{\text{rest}}.\]

The Jacobian determinants, which are also defined at cell centers and faces, are simply the product of the local scale factors:

\[J \equiv \hx \hy \hz.\]
src/domain.c
301static double * allocate_and_init_jdxf(
302    const int isize,
303    const double * hxxf,
304    const double hy
305){
306  double * jdxf = memory_calloc(isize + 1, sizeof(double));
307  for(int i = 1; i <= isize + 1; i++){
308    JDXF(i  ) = HXXF(i  ) * hy;
309  }
310  return jdxf;
311}
src/domain.c
314static double * allocate_and_init_jdxf(
315    const int isize,
316    const double * hxxf,
317    const double hy,
318    const double hz
319){
320  double * jdxf = memory_calloc(isize + 1, sizeof(double));
321  for(int i = 1; i <= isize + 1; i++){
322    JDXF(i  ) = HXXF(i  ) * hy * hz;
323  }
324  return jdxf;
325}
src/domain.c
330static double * allocate_and_init_jdxc(
331    const int isize,
332    const double * hxxc,
333    const double hy
334){
335  double * jdxc = memory_calloc(isize, sizeof(double));
336  for(int i = 1; i <= isize; i++){
337    JDXC(i  ) = HXXC(i  ) * hy;
338  }
339  return jdxc;
340}
src/domain.c
343static double * allocate_and_init_jdxc(
344    const int isize,
345    const double * hxxc,
346    const double hy,
347    const double hz
348){
349  double * jdxc = memory_calloc(isize, sizeof(double));
350  for(int i = 1; i <= isize; i++){
351    JDXC(i  ) = HXXC(i  ) * hy * hz;
352  }
353  return jdxc;
354}