16 PetscFunctionBeginUser;
22 SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONG,
23 "Unknown momentum solver type %d. Supported values are EXPLICIT_RK, DUALTIME_PICARD_JAMESON_RK, and NEWTON_KRYLOV.",
111 PETSC_COMM_WORLD, PETSC_ERR_NOT_CONVERGED,
112 "The momentum solve (%s) has committed %" PetscInt_FMT
" consecutive unconverged steps, "
113 "through step %" PetscInt_FMT
", reaching tolerances.max_consecutive_unconverged_steps "
114 "(%" PetscInt_FMT
"). Stopping rather than advancing a field the solver no longer "
115 "converges; the solver's per-step summary names the failure reasons.",
129 SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONG,
130 "Unsupported Poisson solver type %" PetscInt_FMT
". The current runtime supports only the multigrid path (poisson = 0).",
141 for (PetscInt bi = 0; bi < simCtx->
block_number; bi++) {
159 for (PetscInt bi = 0; bi < simCtx->
block_number; bi++) {
193 PetscFunctionReturn(0);
206 PetscFunctionBeginUser;
210 for (PetscInt bi = 0; bi < simCtx->
block_number; bi++) {
215 PetscFunctionReturn(0);
PetscErrorCode LogPrescribedFlowDiagnostics(UserCtx *user)
Appends each prescribed-velocity inlet's flow rate and mean normal speed this step to inlet_flow....
PetscErrorCode LogDrivenFlowDiagnostics(UserCtx *user)
Appends one row of driven-flow controller state to driven_flow.csv.
PetscErrorCode LogWallModelDiagnostics(UserCtx *user)
Appends one row of near-wall statistics to <run.analysis.metrics>/wall_model.csv.
PetscErrorCode LogBoundaryPressureDiagnostics(UserCtx *user)
Records each INLET and OUTLET face's area-weighted mean pressure this step.
PetscErrorCode SynchronizePeriodicStaggeredFields(UserCtx *user, PetscInt num_fields, const FieldId field_ids[])
Synchronizes persistent component-staggered vector fields.
PetscErrorCode SynchronizePeriodicCellFields(UserCtx *user, PetscInt num_fields, const FieldId field_ids[])
Synchronizes periodic endpoint cells for a list of cell-centered fields.
FieldId
Compile-time identity for a catalogued Eulerian field.
PetscErrorCode ComputeEddyViscosityLES(UserCtx *user)
Computes the turbulent eddy viscosity for one block.
PetscErrorCode LogLESDiagnostics(UserCtx *user)
Appends one row of LES coefficient statistics to the run's log directory.
PetscErrorCode ComputeSmagorinskyConstant(UserCtx *user)
Computes the dynamic Smagorinsky coefficient field for one block.
#define LOCAL
Logging scope definitions for controlling message output.
#define GLOBAL
Scope for global logging across all processes.
#define LOG_ALLOW(scope, level, fmt,...)
Logging macro that checks both the log level and whether the calling function is in the allowed-funct...
#define PROFILE_FUNCTION_END
Marks the end of a profiled code block.
PetscErrorCode LOG_CONTINUITY_METRICS(UserCtx *user)
Logs continuity metrics for a single block to a file.
@ LOG_INFO
Informational messages about program execution.
@ LOG_DEBUG
Detailed debugging information.
#define PROFILE_FUNCTION_BEGIN
Marks the beginning of a profiled function: an always-on aggregate timer.
const char * MomentumSolverTypeToString(MomentumSolverType SolverFlag)
Returns the canonical log token for a momentum-solver selector.
PetscErrorCode MomentumSolver_DualTime_Picard_JamesonRK(UserCtx *user, IBMNodes *ibm, FSInfo *fsi)
Solves the momentum equations using dual-time Picard iteration with Jameson RK smoothing.
PetscErrorCode MomentumSolver_Explicit_RungeKutta4(UserCtx *user, IBMNodes *ibm, FSInfo *fsi)
Advances the momentum equations using an explicit 4th-order Runge-Kutta scheme.
PetscErrorCode UpdatePressure(UserCtx *user)
Adds the pressure correction to the pressure, P += Phi, and refreshes both fields' periodic images an...
PetscErrorCode ProjectVelocity(UserCtx *user)
Corrects the contravariant flux with the gradient of Phi.
PetscErrorCode PoissonSolver_Multigrid(UserMG *usermg)
Solves the pressure-correction equation for every block with geometric multigrid.
PetscErrorCode Contra2Cart(UserCtx *user)
Reconstructs Cartesian velocity (Ucat) at cell centers from contravariant velocity (Ucont) defined on...
PetscErrorCode ComputeDivergence(UserCtx *user)
Computes the discrete divergence of the contravariant velocity field.
PetscErrorCode UpdateLocalGhosts(UserCtx *user, FieldId field_id)
Updates the local vector (including ghost points) from its corresponding global vector.
PetscErrorCode FlowSolver_Destroy(SimCtx *simCtx)
Implementation of FlowSolver_Destroy().
PetscErrorCode FlowSolver(SimCtx *simCtx)
Implementation of FlowSolver().
#define MomentumSolver_NewtonKrylov_Destroy
#define MomentumSolver_NewtonKrylov
PetscInt dynamic_frequency
Recompute the dynamic coefficient every N steps.
LESConfig les_config
Parameters of the LES closure selected by les.
PetscBool mom_last_converged
@ MOMENTUM_SOLVER_DUALTIME_PICARD_JAMESON_RK
@ MOMENTUM_SOLVER_EXPLICIT_RK
@ MOMENTUM_SOLVER_NEWTON_KRYLOV
PetscInt mom_unconverged_streak
PetscInt mom_max_unconverged_steps
PetscInt les
Active LES closure; an LESModelType value.
MomentumSolverType mom_solver_type
The master context for the entire simulation.
User-defined context containing data specific to a single computational grid level.
User-level context for managing the entire multigrid hierarchy.