Orchestrates a single time step of the Eulerian fluid solver.
This is the refactored, high-level entry point for advancing the fluid state from time t_n to t_{n+1}. It takes the master SimCtx as its primary argument.
Orchestrates a single time step of the Eulerian fluid solver.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/solvers.h.
12{
13 PetscErrorCode ierr;
15 PetscInt level;
17
18 PetscFunctionBeginUser;
20
24 SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONG,
25 "Unknown momentum solver type %d. Supported values are EXPLICIT_RK, DUALTIME_PICARD_JAMESON_RK, and NEWTON_KRYLOV.",
27 }
28
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
57
58
61
66
67
68
69
70
71
72
73
78 }
79
80
81
86 }
87
90 }
91 }
92
93
94
95
96
97
98
99
101
102
103
104
108
112 }
113
114
115
116
117
118
120
123 } else {
124 SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONG,
125 "Unsupported Poisson solver type %d. The current runtime supports only the multigrid path (poisson = 0).",
127 }
128
129
130
131
132
133
134
136 for (PetscInt bi = 0; bi < simCtx->
block_number; bi++) {
139
141
143
144
146 }
147
148
149
150
151
152
153
154 for (PetscInt bi = 0; bi < simCtx->
block_number; bi++) {
156
157
158
160
161
163
164
165
166
168
170
171
172
173
174
175
176
177
178
179
180
181
182 }
183
186 PetscFunctionReturn(0);
187}
PetscErrorCode LogDrivenFlowDiagnostics(UserCtx *user)
Appends one row of driven-flow controller state to driven_flow.csv.
PetscErrorCode ApplyWallFunction(UserCtx *user)
Applies wall function modeling to near-wall velocities for all wall-type boundaries.
PetscErrorCode LogWallModelDiagnostics(UserCtx *user)
Appends one row of near-wall statistics to <run.analysis.metrics>/wall_model.csv.
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 code block (typically a function).
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.
#define MomentumSolver_NewtonKrylov
PetscInt dynamic_frequency
Recompute the dynamic coefficient every N steps.
LESConfig les_config
Parameters of the LES closure selected by les.
@ MOMENTUM_SOLVER_DUALTIME_PICARD_JAMESON_RK
@ MOMENTUM_SOLVER_EXPLICIT_RK
@ MOMENTUM_SOLVER_NEWTON_KRYLOV
PetscInt wallfunction
Enable wall functions on WALL faces.
PetscInt les
Active LES closure; an LESModelType value.
MomentumSolverType mom_solver_type
User-defined context containing data specific to a single computational grid level.
User-level context for managing the entire multigrid hierarchy.