Skip to content

Commit

Permalink
fluids: Add -sgs_train_enable flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwrigh committed May 31, 2023
1 parent 635288d commit aa84b68
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/fluids/navierstokes.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ struct AppCtx_private {
} wall_forces;
// Subgrid Stress Model
SGSModelType sgs_model_type;
PetscBool sgs_train_enable;
// Differential Filtering
PetscBool diff_filter_monitor;
};
Expand Down
3 changes: 3 additions & 0 deletions examples/fluids/src/cloptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ PetscErrorCode ProcessCommandLineOptions(MPI_Comm comm, AppCtx app_ctx, SimpleBC
PetscCall(PetscOptionsBool("-diff_filter_monitor", "Enable differential filtering TSMonitor", NULL, app_ctx->diff_filter_monitor,
&app_ctx->diff_filter_monitor, NULL));

PetscCall(
PetscOptionsBool("-sgs_train_enable", "Enable Data-Driven SGS training", NULL, app_ctx->sgs_train_enable, &app_ctx->sgs_train_enable, NULL));

PetscOptionsEnd();

PetscFunctionReturn(0);
Expand Down
1 change: 1 addition & 0 deletions examples/fluids/src/setuplibceed.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ PetscErrorCode SetupLibceed(Ceed ceed, CeedData ceed_data, DM dm, User user, App

if (app_ctx->turb_spanstats_enable) PetscCall(TurbulenceStatisticsSetup(ceed, user, ceed_data, problem));
if (app_ctx->diff_filter_monitor && !user->diff_filter) PetscCall(DifferentialFilterSetup(ceed, user, ceed_data, problem));
if (app_ctx->sgs_train_enable) PetscCall(SGS_DD_TrainingSetup(ceed, user, ceed_data, problem));

CeedElemRestrictionDestroy(&elem_restr_jd_i);
CeedOperatorDestroy(&op_ijacobian_vol);
Expand Down
4 changes: 4 additions & 0 deletions examples/fluids/src/setupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ PetscErrorCode TSSolve_NS(DM dm, User user, AppCtx app_ctx, Physics phys, Vec *Q
}
if (app_ctx->diff_filter_monitor) PetscCall(TSMonitorSet(*ts, TSMonitor_DifferentialFilter, user, NULL));

if (app_ctx->sgs_train_enable) {
PetscCall(TSMonitorSet(*ts, TSMonitor_SGS_DD_Training, user, NULL));
PetscCall(TSSetPostStep(*ts, TSPostStep_SGS_DD_Training));
}
// Solve
PetscReal start_time;
PetscInt start_step;
Expand Down

0 comments on commit aa84b68

Please sign in to comment.