Skip to content

Commit

Permalink
SWE: Change panel ordering, following papers convention
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriabarra committed Jul 28, 2020
1 parent a6185a2 commit 95f5ae2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/fluids/shallow-water/shallowwater.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ int main(int argc, char **argv) {
ierr = PetscObjectSetName((PetscObject)dm, "Sphere"); CHKERRQ(ierr);
// Define cube panels (charts)
DMLabel label;
PetscInt c, cStart, cEnd, npanel;
PetscInt c, cStart, cEnd, npanel, permidx[6] = {5, 1, 4, 0, 3, 2};
ierr = DMCreateLabel(dm, "panel");
ierr = DMGetLabel(dm, "panel", &label);
// Assign different panel (chart) values to the six faces of the cube
ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd); CHKERRQ(ierr);
for (c = cStart, npanel = 0; c < cEnd; c++) {
ierr = DMLabelSetValue(label, c, npanel++); CHKERRQ(ierr);
ierr = DMLabelSetValue(label, c, permidx[npanel++]); CHKERRQ(ierr);
}
// Distribute mesh over processes
{
Expand Down
18 changes: 9 additions & 9 deletions examples/fluids/shallow-water/src/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ PetscErrorCode SetupPanelCoordTransformations(DM dm, PhysicsContext phys_ctx,
const PetscScalar theta = asin(x[2] / R); // latitude
const PetscScalar lambda = atan2(x[1], x[0]); // longitude

// For P_1 (east), P_3 (front), P_4 (west), P_5 (back):
// For P_0 (front), P_1 (east), P_2 (back), P_3 (west):
PetscScalar T00 = cos(theta)*cos(lambda) * cos(lambda);
PetscScalar T01 = cos(theta)*cos(lambda) * 0.;
PetscScalar T10 = cos(theta)*cos(lambda) * -sin(theta)*sin(lambda);
Expand All @@ -232,7 +232,7 @@ PetscErrorCode SetupPanelCoordTransformations(DM dm, PhysicsContext phys_ctx,
{Tinv10,
Tinv11}
};
// For P2 (north):
// For P4 (north):
T00 = sin(theta) * cos(lambda);
T01 = sin(theta) * sin(lambda);
T10 = sin(theta) * -sin(theta)*sin(lambda);
Expand All @@ -252,7 +252,7 @@ PetscErrorCode SetupPanelCoordTransformations(DM dm, PhysicsContext phys_ctx,
Tinv11}
};

// For P0 (south):
// For P5 (south):
T00 = sin(theta) * (-cos(theta));
T01 = sin(theta) * sin(lambda);
T10 = sin(theta) * sin(theta)*sin(lambda);
Expand All @@ -272,20 +272,20 @@ PetscErrorCode SetupPanelCoordTransformations(DM dm, PhysicsContext phys_ctx,
Tinv11}
};

const PetscScalar (*transforms[6])[2][2] = {&T_bottom,
const PetscScalar (*transforms[6])[2][2] = {&T_lateral,
&T_lateral,
&T_top,
&T_lateral,
&T_lateral,
&T_lateral
&T_top,
&T_bottom
};

const PetscScalar (*inv_transforms[6])[2][2] = {&T_bottominv,
const PetscScalar (*inv_transforms[6])[2][2] = {&T_lateralinv,
&T_lateralinv,
&T_topinv,
&T_lateralinv,
&T_lateralinv,
&T_lateralinv
&T_topinv,
&T_bottominv
};

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

0 comments on commit 95f5ae2

Please sign in to comment.