Skip to content

Commit

Permalink
update examples for petsc-next (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
balos1 committed Jul 26, 2022
1 parent 10d127c commit 9ae48a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 9 additions & 1 deletion examples/arkode/C_petsc/ark_petsc_ex25.c
Expand Up @@ -117,7 +117,11 @@ int main(int argc, char **argv)
if (check_retval((void *)nvecx,"N_VMake_Petsc",0)) return 1;

/* Initialize user application context */
ierr = PetscOptionsBegin(PETSC_COMM_WORLD,NULL,"Advection-reaction options","");
#if PETSC_VERSION_GE(3,17,99)
PetscOptionsBegin(PETSC_COMM_WORLD,NULL,"Advection-reaction options","");
#else
ierr = PetscOptionsBegin(PETSC_COMM_WORLD,NULL,"Advection-reaction options","");CHKERRQ(ierr);
#endif
{
rtol = 1e-4;
atol = 1e-4;
Expand All @@ -138,7 +142,11 @@ int main(int argc, char **argv)
ierr = PetscOptionsReal("-vleft","Dirichlet boundary condition","",user.vleft,&user.vleft,NULL);CHKERRQ(ierr);
ierr = PetscOptionsReal("-vright","Dirichlet boundary condition","",user.vright,&user.vright,NULL);CHKERRQ(ierr);
}
#if PETSC_VERSION_GE(3,17,99)
PetscOptionsEnd();
#else
ierr = PetscOptionsEnd();CHKERRQ(ierr);
#endif

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Set initial conditions
Expand Down
11 changes: 9 additions & 2 deletions examples/ida/petsc/idaHeat2D_petsc_snes.c
Expand Up @@ -169,15 +169,22 @@ int main(int argc, char *argv[])
if(check_retval(&ierr, "SUNContext_Create", 1, thispe)) MPI_Abort(comm, 1);

/* Initialize user application context */
ierr = PetscOptionsBegin(PETSC_COMM_WORLD, NULL, "Heat2D options", "");
#if PETSC_VERSION_GE(3,17,99)
PetscOptionsBegin(PETSC_COMM_WORLD, NULL, "Heat2D options", "");
#else
ierr = PetscOptionsBegin(PETSC_COMM_WORLD, NULL, "Heat2D options", "");CHKERRQ(ierr);
#endif
{
jac = PETSC_FALSE;
pre = PETSC_FALSE;
ierr = PetscOptionsBool("-jac", "Utilize user-supplied Jacobian", "", jac, &jac, NULL); CHKERRQ(ierr);
ierr = PetscOptionsBool("-pre", "Utilize user-supplied preconditioner", "", pre, &pre, NULL); CHKERRQ(ierr);
}
#if PETSC_VERSION_GE(3,17,99)
PetscOptionsEnd();
#else
ierr = PetscOptionsEnd(); CHKERRQ(ierr);

#endif
/* Allocate and initialize the data structure and N-vectors. */
data = (UserData) malloc(sizeof *data);
if(check_retval((void *)data, "malloc", 2, thispe))
Expand Down

0 comments on commit 9ae48a1

Please sign in to comment.