Skip to content

Commit

Permalink
SWE: style
Browse files Browse the repository at this point in the history
  • Loading branch information
LeilaGhaffari committed Mar 9, 2021
1 parent d3f95a7 commit 2ccc907
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
17 changes: 11 additions & 6 deletions examples/fluids/shallow-water/shallowwater.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
/// @file
/// Shallow-water equations example using PETSc

const char help[] = "Solve the shallow-water equations using PETSc and libCEED\n";
const char help[] =
"Solve the shallow-water equations using PETSc and libCEED\n";

#include "sw_headers.h"

Expand Down Expand Up @@ -78,7 +79,8 @@ int main(int argc, char **argv) {
PetscScalar R_e = 6.37122e6; // Earth radius (m)
PetscScalar g = 9.81; // gravitational acceleration (m/s^2)
PetscScalar H0 = 0; // constant mean height (m)
PetscScalar gamma = 0; // angle between axis of rotation and polar axis
PetscScalar gamma =
0; // angle between axis of rotation and polar axis
PetscScalar mpersquareds;
// Check PETSc CUDA support
PetscBool petschavecuda, setmemtyperequest = PETSC_FALSE;
Expand All @@ -102,7 +104,8 @@ int main(int argc, char **argv) {

// Parse command line options
comm = PETSC_COMM_WORLD;
ierr = PetscOptionsBegin(comm, NULL, "Shallow-water equations in PETSc with libCEED",
ierr = PetscOptionsBegin(comm, NULL,
"Shallow-water equations in PETSc with libCEED",
NULL); CHKERRQ(ierr);
ierr = PetscOptionsString("-ceed", "CEED resource specifier",
NULL, ceedresource, ceedresource,
Expand Down Expand Up @@ -152,7 +155,8 @@ int main(int argc, char **argv) {
NULL, second, &second, NULL); CHKERRQ(ierr);
second = fabs(second);
outputfreq = 10;
ierr = PetscOptionsInt("-output_freq", "Frequency of output, in number of steps",
ierr = PetscOptionsInt("-output_freq",
"Frequency of output, in number of steps",
NULL, outputfreq, &outputfreq, NULL); CHKERRQ(ierr);
contsteps = 0;
ierr = PetscOptionsInt("-continue", "Continue from previous solution",
Expand All @@ -167,7 +171,8 @@ int main(int argc, char **argv) {
NULL, g, &g, NULL); CHKERRQ(ierr);
ierr = PetscOptionsScalar("-H0", "Mean height",
NULL, H0, &H0, NULL); CHKERRQ(ierr);
ierr = PetscOptionsScalar("-H0", "Angle between axis of rotation and polar axis",
ierr = PetscOptionsScalar("-H0",
"Angle between axis of rotation and polar axis",
NULL, gamma, &gamma, NULL); CHKERRQ(ierr);
PetscStrncpy(user->outputfolder, ".", 2);
ierr = PetscOptionsString("-of", "Output folder",
Expand Down Expand Up @@ -563,7 +568,7 @@ int main(int argc, char **argv) {
ierr = DMDestroy(&dmviz); CHKERRQ(ierr);
ierr = TSDestroy(&ts); CHKERRQ(ierr);
ierr = DMDestroy(&dm); CHKERRQ(ierr);
ierr = MatDestroy(&J);CHKERRQ(ierr);
ierr = MatDestroy(&J); CHKERRQ(ierr);
ierr = PetscFree(units); CHKERRQ(ierr);
ierr = PetscFree(user); CHKERRQ(ierr);
return PetscFinalize();
Expand Down
10 changes: 5 additions & 5 deletions examples/fluids/shallow-water/sw_headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef struct {
CeedQFunctionUser setup, ics, apply_explfunction, apply_implfunction,
apply_jacobian;
const char *setup_loc, *ics_loc, *apply_explfunction_loc,
*apply_implfunction_loc, *apply_jacobian_loc;
*apply_implfunction_loc, *apply_jacobian_loc;
const bool non_zero_time;
} problemData;

Expand Down Expand Up @@ -235,12 +235,12 @@ PetscErrorCode VectorPlacePetscVec(CeedVector c, Vec p);
// Auxiliary function to apply the ICs and eliminate repeated values in initial
// state vector, arising from restriction
PetscErrorCode ICs_FixMultiplicity(CeedOperator op_ics,
CeedVector xcorners, CeedVector q0ceed, DM dm, Vec Qloc, Vec Q,
CeedElemRestriction restrictq, PhysicsContext ctx, CeedScalar time);
CeedVector xcorners, CeedVector q0ceed, DM dm, Vec Qloc, Vec Q,
CeedElemRestriction restrictq, PhysicsContext ctx, CeedScalar time);

// Auxiliary function to compute the lumped mass matrix
PetscErrorCode ComputeLumpedMassMatrix(Ceed ceed, DM dm,
CeedElemRestriction restrictq, CeedBasis basisq,
CeedElemRestriction restrictqdi, CeedVector qdata, Vec M);
CeedElemRestriction restrictq, CeedBasis basisq,
CeedElemRestriction restrictqdi, CeedVector qdata, Vec M);

#endif // sw_headers_h

0 comments on commit 2ccc907

Please sign in to comment.