|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Opt-in integration regression for the Newton–Krylov deterministic Cartesian-seed correction on the production-sized straight duct. More...
#include "test_support.h"#include "initialcondition.h"#include "runloop.h"#include "solvers.h"#include "../../src/momentum_newton_krylov.c"Go to the source code of this file.
Data Structures | |
| struct | FpSnapshot |
| struct | SolveMonitorCtx |
| struct | SolveResult |
Macros | |
| #define | MomentumSolver_NewtonKrylov MomentumSolver_NewtonKrylov_BoundaryFixedpointPrivateCopy |
| #define | FP_FIELD_COUNT 16 |
| #define | FP_SCALAR_COUNT 10 |
Functions | |
| static void | FpGetVectors (UserCtx *user, Vec field[16]) |
| Collects the persistent vectors observed by the residual/boundary path. | |
| static void | FpGetScalars (UserCtx *user, PetscReal scalar[10]) |
| Collects the persistent scalar diagnostics maintained by boundary processing. | |
| static PetscErrorCode | FpCapture (UserCtx *user, FpSnapshot *snap) |
| Deep-copies the audited persistent state into a test-owned snapshot. | |
| static PetscErrorCode | FpRestore (UserCtx *user, const FpSnapshot *snap) |
| Restores a previously captured persistent-state snapshot. | |
| static PetscErrorCode | FpDestroy (FpSnapshot *snap) |
| Releases all vectors owned by one persistent-state snapshot. | |
| static PetscErrorCode | CollectiveDifference (Vec a, Vec b, PetscReal *norm_inf, PetscReal *norm_2) |
| Computes collective global difference norms for global or rank-local vectors. | |
| static PetscErrorCode | DifferenceMaxRank (Vec a, Vec b, PetscMPIInt *max_rank) |
| Finds the MPI rank containing the largest local entry difference. | |
| static PetscErrorCode | SeedCartesianFromX (UserCtx *user, Vec X) |
| Reconstructs Ucat/lUcat deterministically from X, mirroring the seed now performed by the production callback. | |
| static PetscErrorCode | ResidualNCalls (MomentumNewtonKrylovContext *ctx, Vec X, PetscInt boundary_calls, Vec F) |
| Deterministic residual at X using an explicit number of boundary-condition calls (each three internal passes), for the boundary-map compatibility test. | |
| static PetscErrorCode | ConfigureNewtonOptions (void) |
| Installs the production Newton, line-search, and GMRES options. | |
| static PetscErrorCode | SolveMonitor (SNES snes, PetscInt it, PetscReal norm, void *vctx) |
| Records per-Newton nonlinear norm, KSP iterations/reason, and accepted lambda. | |
| static PetscErrorCode | CreateProductionSNES (UserCtx *user, MomentumNewtonKrylovContext *pctx, PetscBool use_mgs, SNES *snes, Mat *J, KSP *ksp) |
| Creates a test-owned matrix-free SNES driven by the production residual callback. | |
| static PetscErrorCode | RunProductionFullSolve (UserCtx *user, const FpSnapshot *entry, Vec X0, PetscBool use_mgs, const char *label, SolveResult *res) |
| Runs one complete production-callback step-2 solve from the restored entry state. | |
| static PetscErrorCode | StopAfterOne (SNES snes, PetscInt it, PetscReal xnorm, PetscReal gnorm, PetscReal fnorm, SNESConvergedReason *reason, void *vctx) |
| Stops SNES immediately after its first accepted Newton correction. | |
| static PetscErrorCode | TestNewtonKrylovProductionRegression (void) |
| Builds the production-sized duct, advances the true physical step 1, and exercises purity, full-solve convergence, boundary-map compatibility, and projection using the production Newton–Krylov callback and solver. | |
| int | main (int argc, char **argv) |
| Runs the opt-in Newton–Krylov production regression executable. | |
Opt-in integration regression for the Newton–Krylov deterministic Cartesian-seed correction on the production-sized straight duct.
The diagnostic phase established that the production Newton–Krylov residual must reconstruct Ucat/lUcat from the current SNES trial vector X before the first boundary sweep (see src/momentum_newton_krylov.c). That correction is now in production. This file locks the resulting guarantees in place using the actual production residual callback (included via a privately renamed copy of the production translation unit) – it deliberately does NOT keep a duplicate test-local seeded callback, so it exercises exactly what ships:
The heavy fixture keeps this target out of make check; the cheap seed-removal detector lives in unit-newton-krylov (default suite). Central checks run on one and four MPI ranks.
Definition in file test_momentum_newton_boundary_fixedpoint.c.
| struct FpSnapshot |
Definition at line 43 of file test_momentum_newton_boundary_fixedpoint.c.
| Data Fields | ||
|---|---|---|
| Vec | value[16] | |
| PetscReal | scalar[10] | |
| struct SolveMonitorCtx |
Definition at line 234 of file test_momentum_newton_boundary_fixedpoint.c.
| Data Fields | ||
|---|---|---|
| const char * | label | |
| PetscReal * | initial_norm | |
| struct SolveResult |
Definition at line 260 of file test_momentum_newton_boundary_fixedpoint.c.
| Data Fields | ||
|---|---|---|
| SNESConvergedReason | reason | |
| PetscInt | its | |
| PetscInt | fevals | |
| PetscInt | ksp_total | |
| PetscReal | initial_norm | |
| PetscReal | final_norm | |
| PetscBool | converged | |
| Vec | Xfinal | |
| #define MomentumSolver_NewtonKrylov MomentumSolver_NewtonKrylov_BoundaryFixedpointPrivateCopy |
Definition at line 32 of file test_momentum_newton_boundary_fixedpoint.c.
| #define FP_FIELD_COUNT 16 |
Definition at line 40 of file test_momentum_newton_boundary_fixedpoint.c.
| #define FP_SCALAR_COUNT 10 |
Definition at line 41 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Collects the persistent vectors observed by the residual/boundary path.
Definition at line 49 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Collects the persistent scalar diagnostics maintained by boundary processing.
Definition at line 63 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Deep-copies the audited persistent state into a test-owned snapshot.
Definition at line 74 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Restores a previously captured persistent-state snapshot.
Definition at line 91 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Releases all vectors owned by one persistent-state snapshot.
Definition at line 108 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Computes collective global difference norms for global or rank-local vectors.
Definition at line 120 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Finds the MPI rank containing the largest local entry difference.
Definition at line 148 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Reconstructs Ucat/lUcat deterministically from X, mirroring the seed now performed by the production callback.
Used only by the N-pass compatibility residual (Experiment 3), which needs a boundary-pass count other than the production default of one call (three passes). For a single call it reproduces the production callback exactly.
Definition at line 180 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Deterministic residual at X using an explicit number of boundary-condition calls (each three internal passes), for the boundary-map compatibility test.
Definition at line 197 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Installs the production Newton, line-search, and GMRES options.
Definition at line 216 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Records per-Newton nonlinear norm, KSP iterations/reason, and accepted lambda.
Definition at line 237 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Creates a test-owned matrix-free SNES driven by the production residual callback.
| use_mgs | When false (production default), leaves GMRES orthogonalization at PETSc's default classical Gram–Schmidt – the path the production solver uses. |
Definition at line 273 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Runs one complete production-callback step-2 solve from the restored entry state.
Definition at line 296 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Stops SNES immediately after its first accepted Newton correction.
Definition at line 329 of file test_momentum_newton_boundary_fixedpoint.c.
|
static |
Builds the production-sized duct, advances the true physical step 1, and exercises purity, full-solve convergence, boundary-map compatibility, and projection using the production Newton–Krylov callback and solver.
Definition at line 350 of file test_momentum_newton_boundary_fixedpoint.c.
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Runs the opt-in Newton–Krylov production regression executable.
Definition at line 542 of file test_momentum_newton_boundary_fixedpoint.c.