Skip to content

Commit 95f5ae2

Browse files
committed
SWE: Change panel ordering, following papers convention
1 parent a6185a2 commit 95f5ae2

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

examples/fluids/shallow-water/shallowwater.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ int main(int argc, char **argv) {
229229
ierr = PetscObjectSetName((PetscObject)dm, "Sphere"); CHKERRQ(ierr);
230230
// Define cube panels (charts)
231231
DMLabel label;
232-
PetscInt c, cStart, cEnd, npanel;
232+
PetscInt c, cStart, cEnd, npanel, permidx[6] = {5, 1, 4, 0, 3, 2};
233233
ierr = DMCreateLabel(dm, "panel");
234234
ierr = DMGetLabel(dm, "panel", &label);
235235
// Assign different panel (chart) values to the six faces of the cube
236236
ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd); CHKERRQ(ierr);
237237
for (c = cStart, npanel = 0; c < cEnd; c++) {
238-
ierr = DMLabelSetValue(label, c, npanel++); CHKERRQ(ierr);
238+
ierr = DMLabelSetValue(label, c, permidx[npanel++]); CHKERRQ(ierr);
239239
}
240240
// Distribute mesh over processes
241241
{

examples/fluids/shallow-water/src/setup.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ PetscErrorCode SetupPanelCoordTransformations(DM dm, PhysicsContext phys_ctx,
213213
const PetscScalar theta = asin(x[2] / R); // latitude
214214
const PetscScalar lambda = atan2(x[1], x[0]); // longitude
215215

216-
// For P_1 (east), P_3 (front), P_4 (west), P_5 (back):
216+
// For P_0 (front), P_1 (east), P_2 (back), P_3 (west):
217217
PetscScalar T00 = cos(theta)*cos(lambda) * cos(lambda);
218218
PetscScalar T01 = cos(theta)*cos(lambda) * 0.;
219219
PetscScalar T10 = cos(theta)*cos(lambda) * -sin(theta)*sin(lambda);
@@ -232,7 +232,7 @@ PetscErrorCode SetupPanelCoordTransformations(DM dm, PhysicsContext phys_ctx,
232232
{Tinv10,
233233
Tinv11}
234234
};
235-
// For P2 (north):
235+
// For P4 (north):
236236
T00 = sin(theta) * cos(lambda);
237237
T01 = sin(theta) * sin(lambda);
238238
T10 = sin(theta) * -sin(theta)*sin(lambda);
@@ -252,7 +252,7 @@ PetscErrorCode SetupPanelCoordTransformations(DM dm, PhysicsContext phys_ctx,
252252
Tinv11}
253253
};
254254

255-
// For P0 (south):
255+
// For P5 (south):
256256
T00 = sin(theta) * (-cos(theta));
257257
T01 = sin(theta) * sin(lambda);
258258
T10 = sin(theta) * sin(theta)*sin(lambda);
@@ -272,20 +272,20 @@ PetscErrorCode SetupPanelCoordTransformations(DM dm, PhysicsContext phys_ctx,
272272
Tinv11}
273273
};
274274

275-
const PetscScalar (*transforms[6])[2][2] = {&T_bottom,
275+
const PetscScalar (*transforms[6])[2][2] = {&T_lateral,
276276
&T_lateral,
277-
&T_top,
278277
&T_lateral,
279278
&T_lateral,
280-
&T_lateral
279+
&T_top,
280+
&T_bottom
281281
};
282282

283-
const PetscScalar (*inv_transforms[6])[2][2] = {&T_bottominv,
283+
const PetscScalar (*inv_transforms[6])[2][2] = {&T_lateralinv,
284284
&T_lateralinv,
285-
&T_topinv,
286285
&T_lateralinv,
287286
&T_lateralinv,
288-
&T_lateralinv
287+
&T_topinv,
288+
&T_bottominv
289289
};
290290

291291
for (PetscInt e = 0; e < nedgenodes; e++) {

0 commit comments

Comments
 (0)