|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Go to the source code of this file.
Data Structures | |
| struct | MomStabilityReport |
| Diagnostic report produced by ComputeMomentumStabilityEstimate(). More... | |
Macros | |
| #define | MomentumSolver_DualTime_Picard_RK4 MomentumSolver_DualTime_Picard_JamesonRK |
Enumerations | |
| enum | MomStabCandidate { MOM_STAB_CAND_B = 0 , MOM_STAB_CAND_C = 1 , MOM_STAB_CAND_D = 2 } |
| Convective-estimate candidate selector. More... | |
| enum | MomStabLimiter { MOM_STAB_LIMITER_TIME = 0 , MOM_STAB_LIMITER_CONVECTION = 1 , MOM_STAB_LIMITER_VISCOSITY = 2 } |
| Dominant stiffness contributor at the controlling cell. More... | |
Functions | |
| PetscErrorCode | MomentumSolver_Explicit_RungeKutta4 (UserCtx *user, IBMNodes *ibm, FSInfo *fsi) |
| Advances the momentum equations using an explicit 4th-order Runge-Kutta scheme. | |
| PetscErrorCode | MomentumSolver_NewtonKrylov (UserCtx *user, IBMNodes *ibm, FSInfo *fsi) |
| Solves one physical momentum step with matrix-free Newton–Krylov. | |
| PetscErrorCode | MomentumSolver_DualTime_Picard_JamesonRK (UserCtx *user, IBMNodes *ibm, FSInfo *fsi) |
| Solves the momentum equations using dual-time Picard iteration with Jameson RK smoothing. | |
| PetscBool | MomentumUsesBDF2 (SimCtx *simCtx) |
| Returns whether the current physical step uses the BDF2 discretization. | |
| PetscReal | MomentumBDFCoefficient (SimCtx *simCtx) |
| Returns the BDF physical-time coefficient a0 for the current step. | |
| PetscErrorCode | ComputeTotalResidual (UserCtx *user) |
| Computes the shared spatial-plus-BDF momentum residual in user->Rhs. | |
| PetscErrorCode | ComputeMomentumStabilityEstimate (UserCtx *user, PetscInt block_number, PetscReal dt, MomStabCandidate candidate, MomStabilityReport *rep) |
| Compute the momentum pseudo-time stability estimate (shadow/diagnostic). | |
| PetscInt | MomCellActiveRows (PetscReal ***nvert, PetscInt k, PetscInt j, PetscInt i, PetscInt mx, PetscInt my, PetscInt mz, PetscBool np_x1, PetscBool np_y1, PetscBool np_z1, PetscInt twoD) |
| Active staggered-momentum row mask for a cell (exposed for unit testing). | |
| struct MomStabilityReport |
Diagnostic report produced by ComputeMomentumStabilityEstimate().
This is a PRACTICAL CONSERVATIVE STABILITY ESTIMATE (operator-scaled pseudo-time estimate), not a proven spectral radius. All lambda_* are global maxima in [1/s].
Definition at line 165 of file momentumsolvers.h.
| Data Fields | ||
|---|---|---|
| PetscReal | lambda | |
| PetscReal | lambda_t | |
| PetscReal | lambda_c | |
| PetscReal | lambda_v | |
| PetscReal | lambda_B | |
| PetscReal | lambda_C | |
| PetscReal | lambda_D | |
| PetscInt | ci | |
| PetscInt | cj | |
| PetscInt | ck | |
| PetscInt | cblock | |
| PetscInt | cclass | |
| PetscInt | one_sided | |
| PetscInt | active_cells | |
| PetscBool | estimate_incomplete | |
| MomStabLimiter | limiter | |
| #define MomentumSolver_DualTime_Picard_RK4 MomentumSolver_DualTime_Picard_JamesonRK |
Definition at line 94 of file momentumsolvers.h.
| enum MomStabCandidate |
Convective-estimate candidate selector.
See ComputeMomentumStabilityEstimate().
B: six-face transport scale (f_c * Aj * sum|U_f| / 2). C: B + frozen-advector discrete-divergence diagonal term. D: C + nonlinear velocity-gradient row-norm term (lambda_grad_u).
| Enumerator | |
|---|---|
| MOM_STAB_CAND_B | |
| MOM_STAB_CAND_C | |
| MOM_STAB_CAND_D | |
Definition at line 144 of file momentumsolvers.h.
| enum MomStabLimiter |
Dominant stiffness contributor at the controlling cell.
| Enumerator | |
|---|---|
| MOM_STAB_LIMITER_TIME | |
| MOM_STAB_LIMITER_CONVECTION | |
| MOM_STAB_LIMITER_VISCOSITY | |
Definition at line 153 of file momentumsolvers.h.
|
extern |
Advances the momentum equations using an explicit 4th-order Runge-Kutta scheme.
| user | Array of UserCtx structs for all blocks. |
| ibm | (Optional) Pointer to IBM data. Pass NULL if disabled. |
| fsi | (Optional) Pointer to FSI data. Pass NULL if disabled. |
Advances the momentum equations using an explicit 4th-order Runge-Kutta scheme.
Local to this translation unit.
Definition at line 93 of file momentumsolvers.c.
Solves one physical momentum step with matrix-free Newton–Krylov.
Version one uses a finite-difference matrix-free Jacobian, GMRES, and no preconditioner. All PETSc solver objects are local to this call. Rows removed by legacy boundary residual enforcement are made explicit: conditioned normal rows use X-Uconditioned, untouched dummy/tangential rows use X, and periodic duplicates use Xdup-Xrepresentative. Unsupported masked, interface, and component-disabled rows are rejected before setup.
| user | Single-block momentum context. |
| ibm | Must be NULL; immersed boundaries are not supported in version one. |
| fsi | Must be NULL; moving-body coupling is not supported in version one. |
Solves one physical momentum step with matrix-free Newton–Krylov.
| user | Single-block momentum context. |
| ibm | Must be NULL in version one. |
| fsi | Must be NULL in version one. |
Definition at line 461 of file momentum_newton_krylov.c.
| PetscErrorCode MomentumSolver_DualTime_Picard_JamesonRK | ( | UserCtx * | user, |
| IBMNodes * | ibm, | ||
| FSInfo * | fsi | ||
| ) |
Solves the momentum equations using dual-time Picard iteration with Jameson RK smoothing.
– Physics Variables (Legacy Names Kept) – ti : Physical Time Step Index. dt : Physical Time Step size (Delta t). st : Pseudo-Time Step size (Delta tau). alfa : Runge-Kutta stage coefficients {1/4, 1/3, 1/2, 1}. – Convergence & Solver Control (Renamed) – pseudo_iter : Counter for the inner dual-time loop. pseudo_dtau : Adaptive pseudo-time step [physical time], = pseudo_cfl / lambda_max. lambda_max : Global max convective spectral radius [1/s] from the current field. delta_sol_norm : The L_inf norm of the change in solution (dU).
| user | Primary UserCtx input for the operation. |
| ibm | Parameter ibm passed to MomentumSolver_DualTime_Picard_JamesonRK(). |
| fsi | Parameter fsi passed to MomentumSolver_DualTime_Picard_JamesonRK(). |
Solves the momentum equations using dual-time Picard iteration with Jameson RK smoothing.
Local to this translation unit.
Definition at line 742 of file momentumsolvers.c.
| PetscBool MomentumUsesBDF2 | ( | SimCtx * | simCtx | ) |
Returns whether the current physical step uses the BDF2 discretization.
Single source of truth for the BDF1/BDF2 selection. The predicate is identical to the one historically inlined in ComputeTotalResidual(): BDF2 when COEF_TIME_ACCURACY > 1.1 AND step != StartStep AND step != 1, otherwise BDF1 (startup step and the first step after a restart).
| simCtx | Master simulation context (reads step, StartStep). |
Returns whether the current physical step uses the BDF2 discretization.
See header.
This reproduces exactly the predicate historically inlined in ComputeTotalResidual(): BDF1 on the cold-start first step (ti == 1) and on the first step after a restart (ti == tistart); BDF2 thereafter (when the second- order time accuracy is enabled). Restart-history validity is a separate concern and is intentionally not addressed here.
Definition at line 19 of file momentumsolvers.c.
| PetscReal MomentumBDFCoefficient | ( | SimCtx * | simCtx | ) |
Returns the BDF physical-time coefficient a0 for the current step.
a0 = 1.5 (== COEF_TIME_ACCURACY) for BDF2, a0 = 1.0 for BDF1. Used both as the leading coefficient of the physical-time term in the residual and as the additive temporal contribution lambda_t = a0/dt in the momentum stability estimate, keeping the two numerically consistent.
| simCtx | Master simulation context. |
Returns the BDF physical-time coefficient a0 for the current step.
See header.
Definition at line 31 of file momentumsolvers.c.
| PetscErrorCode ComputeTotalResidual | ( | UserCtx * | user | ) |
Computes the shared spatial-plus-BDF momentum residual in user->Rhs.
| user | Block context with an allocated Rhs vector. |
Computes the shared spatial-plus-BDF momentum residual in user->Rhs.
Definition at line 42 of file momentumsolvers.c.
| PetscErrorCode ComputeMomentumStabilityEstimate | ( | UserCtx * | user, |
| PetscInt | block_number, | ||
| PetscReal | dt, | ||
| MomStabCandidate | candidate, | ||
| MomStabilityReport * | rep | ||
| ) |
Compute the momentum pseudo-time stability estimate (shadow/diagnostic).
Conservative, operator-scaled estimate: lambda = max_cell (a0/dt + lambda_c + lambda_nu), over active, non-solid cells, blocks, and MPI ranks, where lambda_c already includes the per-direction QUICK scheme factors. Read-only; performs no halo exchange, but does perform global scalar collectives (see implementation). This is a PRACTICAL CONSERVATIVE estimate, not a proven spectral radius. See the Workstream-A design.
Call-site preconditions (NOT enforced internally): lUcont, lUcat, lNu_t, lNvert must be fresh; lAj, face Jacobians and face metrics are static after grid init.
| [in] | user | Array of UserCtx (one per block). |
| [in] | block_number | Number of blocks. |
| [in] | dt | Physical time step. |
| [in] | candidate | Convective candidate driving rep->lambda (B, C or D). |
| [out] | rep | Filled diagnostic report (global maxima + breakdown). |
Compute the momentum pseudo-time stability estimate (shadow/diagnostic).
See header.
Operator-scaled estimate lambda = max_cell (a0/dt + lambda_c + lambda_nu) over active, non-solid interior cells, blocks and MPI ranks (lambda_c already carries the per-direction QUICK scheme factors – it is NOT multiplied by f_c again here). Read-only; no halo exchange, 5 global scalar collectives. NOT a proven spectral radius. Drives nothing in shadow mode.
Definition at line 396 of file momentumsolvers.c.
| PetscInt MomCellActiveRows | ( | PetscReal *** | nvert, |
| PetscInt | k, | ||
| PetscInt | j, | ||
| PetscInt | i, | ||
| PetscInt | mx, | ||
| PetscInt | my, | ||
| PetscInt | mz, | ||
| PetscBool | np_x1, | ||
| PetscBool | np_y1, | ||
| PetscBool | np_z1, | ||
| PetscInt | twoD | ||
| ) |
Active staggered-momentum row mask for a cell (exposed for unit testing).
Returns a 3-bit mask (xi=1, eta=2, zeta=4). A solid cell yields 0 (all inactive); a positive solid neighbour or a positive non-periodic physical face clears the corresponding normal row; TwoD (1/2/3) clears the homogeneous direction's row.
| nvert | Local nvert array (ghosted). |
| k | Cell k index. |
| j | Cell j index. |
| i | Cell i index. |
| mx | Global x dimension. |
| my | Global y dimension. |
| mz | Global z dimension. |
| np_x1 | True if the positive-x face is non-periodic. |
| np_y1 | True if the positive-y face is non-periodic. |
| np_z1 | True if the positive-z face is non-periodic. |
| twoD | TwoD homogeneous-direction selector (0 none, 1 xi, 2 eta, 3 zeta). |
Definition at line 368 of file momentumsolvers.c.