Skip to content

Commit

Permalink
fluids: Print correct Mat Types
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwrigh committed May 3, 2024
1 parent 24078fc commit 9b121dd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/fluids/navierstokes.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ extern PetscErrorCode PRINT_ADVECTION(User user, ProblemData problem, AppCtx app

extern PetscErrorCode PRINT_ADVECTION2D(User user, ProblemData problem, AppCtx app_ctx);

PetscErrorCode PrintRunInfo(User user, Physics phys_ctx, ProblemData problem, MPI_Comm comm);
PetscErrorCode PrintRunInfo(User user, Physics phys_ctx, ProblemData problem, TS ts, MPI_Comm comm);

// -----------------------------------------------------------------------------
// libCEED functions
Expand Down
13 changes: 9 additions & 4 deletions examples/fluids/src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ PetscErrorCode RegisterLogEvents() {
}

// Print information about the given simulation run
PetscErrorCode PrintRunInfo(User user, Physics phys_ctx, ProblemData problem, MPI_Comm comm) {
PetscErrorCode PrintRunInfo(User user, Physics phys_ctx, ProblemData problem, TS ts, MPI_Comm comm) {
Ceed ceed = user->ceed;
PetscFunctionBeginUser;
// Header and rank
Expand Down Expand Up @@ -430,10 +430,15 @@ PetscErrorCode PrintRunInfo(User user, Physics phys_ctx, ProblemData problem, MP
char box_faces_str[PETSC_MAX_PATH_LEN] = "3,3,3";
if (problem->dim == 2) box_faces_str[3] = '\0';
PetscCall(PetscOptionsGetString(NULL, NULL, "-dm_plex_box_faces", box_faces_str, sizeof(box_faces_str), NULL));
MatType amat_type = user->app_ctx->amat_type, pmat_type;
MatType amat_type, pmat_type;
VecType vec_type;
PetscCall(DMGetMatType(user->dm, &pmat_type));
if (!amat_type) amat_type = pmat_type;
{
Mat Amat, Pmat;

PetscCall(TSGetIJacobian(ts, &Amat, &Pmat, NULL, NULL));
PetscCall(MatGetType(Amat, &amat_type));
PetscCall(MatGetType(Pmat, &pmat_type));
}
PetscCall(DMGetVecType(user->dm, &vec_type));
PetscCall(PetscPrintf(comm,
" PETSc:\n"
Expand Down
2 changes: 1 addition & 1 deletion examples/fluids/src/setupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ PetscErrorCode TSSolve_NS(DM dm, User user, AppCtx app_ctx, Physics phys, Proble
PetscCall(TSSetPostStep(*ts, TSPostStep_SGS_DD_Training));
}

if (app_ctx->test_type == TESTTYPE_NONE) PetscCall(PrintRunInfo(user, user->phys, problem, comm));
if (app_ctx->test_type == TESTTYPE_NONE) PetscCall(PrintRunInfo(user, user->phys, problem, *ts, comm));
// Solve
PetscReal start_time;
PetscInt start_step;
Expand Down

0 comments on commit 9b121dd

Please sign in to comment.