4#define __FUNCT__ "FlowSolver"
18 PetscFunctionBeginUser;
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.",
72 const char *staggered_fields[] = {
"Ucont"};
76 const char *cell_fields[] = {
"Ucat"};
128 SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONG,
129 "Unsupported Poisson solver type %d. The current runtime supports only the multigrid path (poisson = 0).",
140 for (PetscInt bi = 0; bi < simCtx->
block_number; bi++) {
158 for (PetscInt bi = 0; bi < simCtx->
block_number; bi++) {
191 PetscFunctionReturn(0);
PetscErrorCode SynchronizePeriodicStaggeredFields(UserCtx *user, PetscInt num_fields, const char *field_names[])
Synchronizes persistent component-staggered vector fields.
PetscErrorCode SynchronizePeriodicCellFields(UserCtx *user, PetscInt num_fields, const char *field_names[])
Synchronizes periodic endpoint cells for a list of cell-centered fields.
PetscErrorCode ComputeEddyViscosityLES(UserCtx *user)
Computes the turbulent eddy viscosity (Nu_t) for the LES model.
PetscErrorCode ComputeSmagorinskyConstant(UserCtx *user)
Computes the dynamic Smagorinsky constant (Cs) for the LES model.
#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)
Helper function to convert Momentum Solver flag to a string representation.
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 Projection(UserCtx *user)
Corrects the contravariant velocity field Ucont to be divergence-free using the gradient of the press...
PetscErrorCode UpdatePressure(UserCtx *user)
Updates the pressure field P with the pressure correction Phi computed by the Poisson solver.
PetscErrorCode PoissonSolver_MG(UserMG *usermg)
Solves the pressure-Poisson equation using a geometric multigrid method.
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, const char *fieldName)
Updates the local vector (including ghost points) from its corresponding global vector.
PetscErrorCode FlowSolver(SimCtx *simCtx)
Implementation of FlowSolver().
#define MomentumSolver_NewtonKrylov
@ MOMENTUM_SOLVER_DUALTIME_PICARD_JAMESON_RK
@ MOMENTUM_SOLVER_EXPLICIT_RK
@ MOMENTUM_SOLVER_NEWTON_KRYLOV
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.