Skip to content

Commit da12e01

Browse files
committed
SWE: some comments on the div operations
1 parent 3c01fc9 commit da12e01

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

examples/fluids/shallow-water/qfunctions/advection.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,13 @@ CEED_QFUNCTION(SWExplicit_Advection)(void *ctx, CeedInt Q,
185185
// -- Height:
186186
// Evaluate the strong form using
187187
// div((h + H0) u) = u . grad(h) + (h + H0) div(u), with H0 constant
188-
// or in index notation: (u_j h)_{,j} = u_j h_j + (h + H0) u_{j,j}
188+
// or in index notation: (u_j h)_{,j} = u_j h_{,j} + (h + H0) u_{j,j}
189189
CeedScalar div_u = 0, u_dot_grad_h = 0;
190-
for (CeedInt j=0; j<2; j++) {
190+
for (CeedInt j=0; j<2; j++) { // we skip j=2 since dqdx[2] is zero
191191
CeedScalar dhdx_j = 0;
192-
for (CeedInt k=0; k<2; k++) { // TODO: check indices! in this case dXdx is 2x3
192+
for (CeedInt k=0; k<2; k++) {
193193
div_u += du[j][k] * dXdx[k][j]; // u_{j,j} = u_{j,K} X_{K,j}
194-
dhdx_j += dh[k] * dXdx[k][j];
194+
dhdx_j += dh[k] * dXdx[k][j]; // h_{,j} = h_K X_{K,j}
195195
}
196196
u_dot_grad_h += u[j] * dhdx_j;
197197
}
@@ -310,13 +310,13 @@ CEED_QFUNCTION(SWImplicit_Advection)(void *ctx, CeedInt Q,
310310
// -- Height:
311311
// Evaluate the strong form using
312312
// div((h + H0) u) = u . grad(h) + (h + H0) div(u), with H0 constant
313-
// or in index notation: (u_j h)_{,j} = u_j h_j + (h + H0) u_{j,j}
313+
// or in index notation: (u_j h)_{,j} = u_j h_{,j} + (h + H0) u_{j,j}
314314
CeedScalar div_u = 0, u_dot_grad_h = 0;
315-
for (CeedInt j=0; j<2; j++) {
315+
for (CeedInt j=0; j<2; j++) { // we skip j=2 since dqdx[2] is zero
316316
CeedScalar dhdx_j = 0;
317-
for (CeedInt k=0; k<2; k++) { // TODO: check indices! in this case dXdx is 2x3
317+
for (CeedInt k=0; k<2; k++) {
318318
div_u += du[j][k] * dXdx[k][j]; // u_{j,j} = u_{j,K} X_{K,j}
319-
dhdx_j += dh[k] * dXdx[k][j];
319+
dhdx_j += dh[k] * dXdx[k][j]; // h_{,j} = h_K X_{K,j}
320320
}
321321
u_dot_grad_h += u[j] * dhdx_j;
322322
}
@@ -461,13 +461,13 @@ CEED_QFUNCTION(SWJacobian_Advection)(void *ctx, CeedInt Q,
461461
// -- Height:
462462
// Evaluate the strong form of the action of the Jacobian using
463463
// div((h + H0) delta u) = delta u . grad(h) + (h + H0) div(delta u), with H0 constant
464-
// or in index notation: (delta u_j h)_{,j} = delta u_j h_j + (h + H0) delta u_{j,j}
464+
// or in index notation: (delta u_j h)_{,j} = delta u_j h_{,j} + (h + H0) delta u_{j,j}
465465
CeedScalar div_deltau = 0, deltau_dot_grad_h = 0;
466-
for (CeedInt j=0; j<2; j++) {
466+
for (CeedInt j=0; j<2; j++) { // we skip j=2 since dqdx[2] is zero
467467
CeedScalar dhdx_j = 0;
468-
for (CeedInt k=0; k<2; k++) { // TODO: check indices! in this case dXdx is 2x3
469-
div_deltau += deltadu[j][k] * dXdx[k][j]; // u_{j,j} = u_{j,K} X_{K,j}
470-
dhdx_j += dh[k] * dXdx[k][j];
468+
for (CeedInt k=0; k<2; k++) {
469+
div_deltau += deltadu[j][k] * dXdx[k][j]; // deltau_{j,j} = deltau_{j,K} X_{K,j}
470+
dhdx_j += dh[k] * dXdx[k][j]; // h_{,j} = h_K X_{K,j}
471471
}
472472
deltau_dot_grad_h += deltau[j] * dhdx_j;
473473
}

0 commit comments

Comments
 (0)