diff --git a/examples/fluids/navierstokes.h b/examples/fluids/navierstokes.h index 44cec87bb0..30c0a82047 100644 --- a/examples/fluids/navierstokes.h +++ b/examples/fluids/navierstokes.h @@ -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; }; diff --git a/examples/fluids/src/cloptions.c b/examples/fluids/src/cloptions.c index 1c64450b4a..d0b7358f1f 100644 --- a/examples/fluids/src/cloptions.c +++ b/examples/fluids/src/cloptions.c @@ -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); diff --git a/examples/fluids/src/setuplibceed.c b/examples/fluids/src/setuplibceed.c index 6cdebb34e5..f967303adb 100644 --- a/examples/fluids/src/setuplibceed.c +++ b/examples/fluids/src/setuplibceed.c @@ -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); diff --git a/examples/fluids/src/setupts.c b/examples/fluids/src/setupts.c index 130e202589..dc571a8334 100644 --- a/examples/fluids/src/setupts.c +++ b/examples/fluids/src/setupts.c @@ -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;