Skip to content

Commit 11dfcfe

Browse files
authored
Merge pull request #940 from CEED/jeremy/petsc-options
petsc - update for PetscOptionsBegin/End
2 parents d7dbba2 + 67490bc commit 11dfcfe

14 files changed

Lines changed: 38 additions & 51 deletions

File tree

examples/fluids/problems/advection.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ PetscErrorCode NS_ADVECTION(ProblemData *problem, DM dm, void *setup_ctx,
7575
// ------------------------------------------------------
7676
// Command line Options
7777
// ------------------------------------------------------
78-
ierr = PetscOptionsBegin(comm, NULL, "Options for ADVECTION problem",
79-
NULL); CHKERRQ(ierr);
78+
PetscOptionsBegin(comm, NULL, "Options for ADVECTION problem", NULL);
8079
// -- Physics
8180
ierr = PetscOptionsScalar("-rc", "Characteristic radius of thermal bubble",
8281
NULL, rc, &rc, NULL); CHKERRQ(ierr);
@@ -148,7 +147,7 @@ PetscErrorCode NS_ADVECTION(ProblemData *problem, DM dm, void *setup_ctx,
148147
CHKERRQ(ierr);
149148
}
150149

151-
ierr = PetscOptionsEnd(); CHKERRQ(ierr);
150+
PetscOptionsEnd();
152151

153152
// ------------------------------------------------------
154153
// Set up the PETSc context

examples/fluids/problems/advection2d.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ PetscErrorCode NS_ADVECTION2D(ProblemData *problem, DM dm, void *setup_ctx,
7373
// ------------------------------------------------------
7474
// Command line Options
7575
// ------------------------------------------------------
76-
ierr = PetscOptionsBegin(comm, NULL, "Options for ADVECTION2D problem",
77-
NULL); CHKERRQ(ierr);
76+
PetscOptionsBegin(comm, NULL, "Options for ADVECTION2D problem", NULL);
7877
// -- Physics
7978
ierr = PetscOptionsScalar("-rc", "Characteristic radius of thermal bubble",
8079
NULL, rc, &rc, NULL); CHKERRQ(ierr);
@@ -130,7 +129,7 @@ PetscErrorCode NS_ADVECTION2D(ProblemData *problem, DM dm, void *setup_ctx,
130129
CHKERRQ(ierr);
131130
}
132131

133-
ierr = PetscOptionsEnd(); CHKERRQ(ierr);
132+
PetscOptionsEnd();
134133

135134
// ------------------------------------------------------
136135
// Set up the PETSc context

examples/fluids/problems/densitycurrent.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ PetscErrorCode NS_DENSITY_CURRENT(ProblemData *problem, DM dm, void *setup_ctx,
4040
// ------------------------------------------------------
4141
// Command line Options
4242
// ------------------------------------------------------
43-
ierr = PetscOptionsBegin(comm, NULL, "Options for DENSITY_CURRENT problem",
44-
NULL); CHKERRQ(ierr);
43+
PetscOptionsBegin(comm, NULL, "Options for DENSITY_CURRENT problem", NULL);
4544
ierr = PetscOptionsScalar("-rc", "Characteristic radius of thermal bubble",
4645
NULL, rc, &rc, NULL); CHKERRQ(ierr);
4746
for (int i=0; i<3; i++) center[i] = .5*domain_size[i];
@@ -60,7 +59,7 @@ PetscErrorCode NS_DENSITY_CURRENT(ProblemData *problem, DM dm, void *setup_ctx,
6059
}
6160
}
6261

63-
ierr = PetscOptionsEnd(); CHKERRQ(ierr);
62+
PetscOptionsEnd();
6463

6564
PetscScalar meter = user->units->meter;
6665
rc = fabs(rc) * meter;

examples/fluids/problems/eulervortex.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ PetscErrorCode NS_EULER_VORTEX(ProblemData *problem, DM dm, void *setup_ctx,
7373
// ------------------------------------------------------
7474
// Command line Options
7575
// ------------------------------------------------------
76-
ierr = PetscOptionsBegin(comm, NULL, "Options for EULER_VORTEX problem",
77-
NULL); CHKERRQ(ierr);
76+
PetscOptionsBegin(comm, NULL, "Options for EULER_VORTEX problem", NULL);
7877
// -- Physics
7978
ierr = PetscOptionsScalar("-vortex_strength", "Strength of Vortex",
8079
NULL, vortex_strength, &vortex_strength, NULL);
@@ -120,7 +119,7 @@ PetscErrorCode NS_EULER_VORTEX(ProblemData *problem, DM dm, void *setup_ctx,
120119
CHKERRQ(ierr);
121120
}
122121

123-
ierr = PetscOptionsEnd(); CHKERRQ(ierr);
122+
PetscOptionsEnd();
124123

125124
// ------------------------------------------------------
126125
// Set up the PETSc context

examples/fluids/problems/newtonian.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ PetscErrorCode NS_NEWTONIAN_IG(ProblemData *problem, DM dm, void *setup_ctx,
7777
// ------------------------------------------------------
7878
// Command line Options
7979
// ------------------------------------------------------
80-
ierr = PetscOptionsBegin(comm, NULL,
81-
"Options for Newtonian Ideal Gas based problem",
82-
NULL); CHKERRQ(ierr);
80+
PetscOptionsBegin(comm, NULL, "Options for Newtonian Ideal Gas based problem",
81+
NULL);
82+
8383
// -- Physics
8484
ierr = PetscOptionsScalar("-theta0", "Reference potential temperature",
8585
NULL, theta0, &theta0, NULL); CHKERRQ(ierr);
@@ -133,7 +133,7 @@ PetscErrorCode NS_NEWTONIAN_IG(ProblemData *problem, DM dm, void *setup_ctx,
133133
"Warning! Use -stab supg only with -implicit\n");
134134
CHKERRQ(ierr);
135135
}
136-
ierr = PetscOptionsEnd(); CHKERRQ(ierr);
136+
PetscOptionsEnd();
137137

138138
// ------------------------------------------------------
139139
// Set up the PETSc context

examples/fluids/src/cloptions.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ PetscErrorCode ProcessCommandLineOptions(MPI_Comm comm, AppCtx app_ctx,
4242
PetscErrorCode ierr;
4343
PetscFunctionBeginUser;
4444

45-
ierr = PetscOptionsBegin(comm, NULL, "Navier-Stokes in PETSc with libCEED",
46-
NULL); CHKERRQ(ierr);
45+
PetscOptionsBegin(comm, NULL, "Navier-Stokes in PETSc with libCEED",
46+
NULL);
4747

4848
ierr = PetscOptionsString("-ceed", "CEED resource specifier",
4949
NULL, app_ctx->ceed_resource, app_ctx->ceed_resource,
@@ -148,7 +148,7 @@ PetscErrorCode ProcessCommandLineOptions(MPI_Comm comm, AppCtx app_ctx,
148148
"Face IDs to apply outflow BC",
149149
NULL, bc->outflows, &bc->num_outflow, NULL); CHKERRQ(ierr);
150150

151-
ierr = PetscOptionsEnd(); CHKERRQ(ierr);
151+
PetscOptionsEnd();
152152

153153
PetscFunctionReturn(0);
154154
}

examples/petsc/area.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ int main(int argc, char **argv) {
9292
comm = PETSC_COMM_WORLD;
9393

9494
// Read command line options
95-
ierr = PetscOptionsBegin(comm, NULL, "CEED surface area problem with PETSc",
96-
NULL);
97-
CHKERRQ(ierr);
95+
PetscOptionsBegin(comm, NULL, "CEED surface area problem with PETSc", NULL);
9896
problem_choice = SPHERE;
9997
ierr = PetscOptionsEnum("-problem",
10098
"Problem to solve", NULL,
@@ -116,7 +114,7 @@ int main(int argc, char **argv) {
116114
NULL, simplex, &simplex, NULL); CHKERRQ(ierr);
117115
ierr = PetscOptionsInt("-degree", "Polynomial degree of tensor product basis",
118116
NULL, degree, &degree, NULL); CHKERRQ(ierr);
119-
ierr = PetscOptionsEnd(); CHKERRQ(ierr);
117+
PetscOptionsEnd();
120118

121119
// Setup DM
122120
if (read_mesh) {

examples/petsc/bps.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,7 @@ int main(int argc, char **argv) {
469469
rp->comm = comm;
470470

471471
// Read command line options
472-
ierr = PetscOptionsBegin(comm, NULL, "CEED BPs in PETSc", NULL);
473-
CHKERRQ(ierr);
472+
PetscOptionsBegin(comm, NULL, "CEED BPs in PETSc", NULL);
474473
{
475474
PetscBool set;
476475
ierr = PetscOptionsEnumArray("-problem", "CEED benchmark problem to solve",
@@ -558,8 +557,7 @@ int main(int argc, char **argv) {
558557
if (flg) ranks_per_node = p;
559558
}
560559

561-
ierr = PetscOptionsEnd();
562-
CHKERRQ(ierr);
560+
PetscOptionsEnd();
563561

564562
// Register PETSc logging stage
565563
ierr = PetscLogStageRegister("Solve Stage", &rp->solve_stage);

examples/petsc/bpsraw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ int main(int argc, char **argv) {
439439
comm = PETSC_COMM_WORLD;
440440

441441
// Read command line options
442-
ierr = PetscOptionsBegin(comm, NULL, "CEED BPs in PETSc", NULL); CHKERRQ(ierr);
442+
PetscOptionsBegin(comm, NULL, "CEED BPs in PETSc", NULL);
443443
bp_choice = CEED_BP1;
444444
ierr = PetscOptionsEnum("-problem",
445445
"CEED benchmark problem to solve", NULL,
@@ -480,7 +480,7 @@ int main(int argc, char **argv) {
480480
"Min and max number of iterations to use during benchmarking",
481481
NULL, ksp_max_it_clip, &two, NULL);
482482
CHKERRQ(ierr);
483-
ierr = PetscOptionsEnd(); CHKERRQ(ierr);
483+
PetscOptionsEnd();
484484
P = degree + 1;
485485
Q = P + q_extra;
486486

examples/petsc/bpssphere.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ int main(int argc, char **argv) {
8787
comm = PETSC_COMM_WORLD;
8888

8989
// Read command line options
90-
ierr = PetscOptionsBegin(comm, NULL, "CEED BPs in PETSc", NULL); CHKERRQ(ierr);
90+
PetscOptionsBegin(comm, NULL, "CEED BPs in PETSc", NULL);
9191
bp_choice = CEED_BP1;
9292
ierr = PetscOptionsEnum("-problem",
9393
"CEED benchmark problem to solve", NULL,
@@ -124,7 +124,7 @@ int main(int argc, char **argv) {
124124
simplex = PETSC_FALSE;
125125
ierr = PetscOptionsBool("-simplex", "Use simplices, or tensor product cells",
126126
NULL, simplex, &simplex, NULL); CHKERRQ(ierr);
127-
ierr = PetscOptionsEnd(); CHKERRQ(ierr);
127+
PetscOptionsEnd();
128128

129129
// Setup DM
130130
if (read_mesh) {

0 commit comments

Comments
 (0)