Skip to content

Commit 9b91d0b

Browse files
committed
fix(examples): Update examples for latest PETSc changes
1 parent 5a7ad6a commit 9b91d0b

9 files changed

Lines changed: 13 additions & 13 deletions

File tree

examples/fluids/navierstokes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#include "./include/petsc_ops.h"
1818
#include "qfunctions/newtonian_types.h"
1919

20-
#if PETSC_VERSION_LT(3, 23, 0)
21-
#error "PETSc v3.23 or later is required"
20+
#if PETSC_VERSION_LT(3, 24, 0)
21+
#error "PETSc v3.24 or later is required"
2222
#endif
2323

2424
// -----------------------------------------------------------------------------

examples/fluids/src/dm_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ PetscErrorCode DMSetupByOrderBegin_FEM(PetscBool setup_faces, PetscBool setup_co
456456
if (coord_order != PETSC_DECIDE) fe_coord_order = coord_order;
457457
PetscCall(PetscFECreateLagrange(comm, dim, num_comp_coord, is_simplex, fe_coord_order, q_order, &fe_coord_new));
458458
if (setup_faces) PetscCall(PetscFEGetHeightSubspace(fe_coord_new, 1, &fe_coord_face_new));
459-
PetscCall(DMSetCoordinateDisc(dm, fe_coord_new, PETSC_TRUE));
459+
PetscCall(DMSetCoordinateDisc(dm, fe_coord_new, PETSC_FALSE, PETSC_TRUE));
460460
PetscCall(PetscFEDestroy(&fe_coord_new));
461461
}
462462
PetscFunctionReturn(PETSC_SUCCESS);

examples/fluids/src/turb_spanstats.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ PetscErrorCode CreateStatsDM(User user, ProblemData problem, PetscInt degree) {
7171
}
7272

7373
PetscCall(DMPlexLabelComplete(user->dm, label));
74-
PetscCall(DMPlexFilter(user->dm, label, 1, PETSC_FALSE, PETSC_FALSE, NULL, &user->spanstats.dm));
75-
PetscCall(DMSetCoordinateDisc(user->spanstats.dm, NULL, PETSC_TRUE)); // Ensure that a coordinate FE exists
74+
PetscCall(DMPlexFilter(user->dm, label, 1, PETSC_FALSE, PETSC_FALSE, PetscObjectComm((PetscObject)user->dm), NULL, &user->spanstats.dm));
75+
PetscCall(DMSetCoordinateDisc(user->spanstats.dm, NULL, PETSC_FALSE, PETSC_TRUE)); // Ensure that a coordinate FE exists
7676

7777
PetscCall(DMPlexDistribute(user->spanstats.dm, 0, NULL, &parent_distributed_dm));
7878
PetscCallMPI(MPI_Comm_size(comm, &size));

examples/petsc/dmswarm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ int main(int argc, char **argv) {
154154
PetscFE fe_coord;
155155

156156
PetscCall(PetscFECreateLagrange(comm, dim, dim, PETSC_FALSE, mesh_order, solution_order + q_extra, &fe_coord));
157-
PetscCall(DMSetCoordinateDisc(dm_mesh, fe_coord, PETSC_TRUE));
157+
PetscCall(DMSetCoordinateDisc(dm_mesh, fe_coord, PETSC_FALSE, PETSC_TRUE));
158158
PetscCall(PetscFEDestroy(&fe_coord));
159159
}
160160

examples/petsc/include/petscversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
/// Petsc version check
1010
#pragma once
1111

12-
#if PETSC_VERSION_LT(3, 23, 0)
13-
#error "PETSc v3.23 or later is required"
12+
#if PETSC_VERSION_LT(3, 24, 0)
13+
#error "PETSc v3.24 or later is required"
1414
#endif

examples/petsc/src/petscutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ PetscErrorCode SetupDMByDegree(DM dm, PetscInt p_degree, PetscInt q_extra, Petsc
153153
PetscInt num_comp_coord;
154154
PetscCall(DMGetCoordinateDim(dm, &num_comp_coord));
155155
PetscCall(PetscFECreateLagrange(comm, dim, num_comp_coord, is_simplex, 1, q_degree, &fe_coords));
156-
PetscCall(DMSetCoordinateDisc(dm, fe_coords, PETSC_TRUE));
156+
PetscCall(DMSetCoordinateDisc(dm, fe_coords, PETSC_FALSE, PETSC_TRUE));
157157
PetscCall(PetscFEDestroy(&fe_coords));
158158
}
159159

examples/solids/elasticity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ int main(int argc, char **argv) {
507507
// ---------- Smoother KSP
508508
PetscCall(PCMGGetSmoother(pc, level, &ksp_smoother));
509509
PetscCall(KSPSetDM(ksp_smoother, level_dms[level]));
510-
PetscCall(KSPSetDMActive(ksp_smoother, PETSC_FALSE));
510+
PetscCall(KSPSetDMActive(ksp_smoother, KSP_DMACTIVE_ALL, PETSC_FALSE));
511511

512512
// ---------- Chebyshev options
513513
PetscCall(KSPSetType(ksp_smoother, KSPCHEBYSHEV));

examples/solids/elasticity.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
#include "include/utils.h"
2222
#include "problems/problems.h"
2323

24-
#if PETSC_VERSION_LT(3, 23, 0)
25-
#error "PETSc v3.23 or later is required"
24+
#if PETSC_VERSION_LT(3, 24, 0)
25+
#error "PETSc v3.24 or later is required"
2626
#endif

examples/solids/src/setup-dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ PetscErrorCode SetupDMByDegree(DM dm, AppCtx app_ctx, PetscInt order, PetscBool
8686
PetscInt num_comp_coord;
8787
PetscCall(DMGetCoordinateDim(dm, &num_comp_coord));
8888
PetscCall(PetscFECreateLagrange(comm, dim, num_comp_coord, PETSC_FALSE, 1, 1, &fe_coords));
89-
PetscCall(DMSetCoordinateDisc(dm, fe_coords, PETSC_TRUE));
89+
PetscCall(DMSetCoordinateDisc(dm, fe_coords, PETSC_FALSE, PETSC_TRUE));
9090
PetscCall(PetscFEDestroy(&fe_coords));
9191
}
9292

0 commit comments

Comments
 (0)