C unit tests for runtime, particle, wall, and walltime-guard helpers. More...
#include "test_support.h"#include "BC_Handlers.h"#include "ParticleMotion.h"#include "ParticlePhysics.h"#include "ParticleSwarm.h"#include "interpolation.h"#include "initialcondition.h"#include "les.h"#include "runloop.h"#include "setup.h"#include "wallfunction.h"#include "walkingsearch.h"Go to the source code of this file.
Functions | |
| static PetscErrorCode | SyncRuntimeFieldGhosts (UserCtx *user) |
| Synchronizes the minimal runtime fixture's global fields into their persistent local ghosts. | |
| static PetscErrorCode | SeedSingleParticle (UserCtx *user, PetscInt ci, PetscInt cj, PetscInt ck, PetscReal x, PetscReal y, PetscReal z, PetscReal wx, PetscReal wy, PetscReal wz, PetscInt status_value) |
| Seeds one localized swarm particle with the cell, position, weight, and status data used by runtime tests. | |
| static PetscErrorCode | TestDistributeParticlesRemainderHandling (void) |
| Tests particle distribution remainder handling across ranks. | |
| static PetscErrorCode | TestIsParticleInBoxBasicCases (void) |
| Tests basic particle-inside-bounding-box classification cases. | |
| static PetscErrorCode | TestUpdateParticleWeightsComputesExpectedRatios (void) |
| Tests particle weight updates against expected ratios. | |
| static PetscErrorCode | TestUpdateParticlePositionWithoutBrownianContribution (void) |
| Tests particle position updates without Brownian forcing. | |
| static PetscErrorCode | TestUpdateParticlePositionDiffusivityGradientOnly (void) |
| Tests particle position updates driven only by diffusivity-gradient drift. | |
| static PetscErrorCode | TestUpdateParticleFieldIEMRelaxation (void) |
| Tests IEM relaxation updates for particle-carried fields. | |
| static PetscErrorCode | TestCart2ContraConvertsCartesianField (void) |
| Tests spatially varying Cartesian-field conversion to contravariant fluxes. | |
| static PetscErrorCode | TestCart2ContraUsesFinalizedPeriodicUcat (void) |
| Verifies periodic Ucat endpoints are repaired before Cart2Contra terminal faces. | |
| static PetscErrorCode | TestPopulateInitialUcontLoadsStagedUcat (void) |
| Tests loading a staged Ucat file IC and converting it to Ucont. | |
| static PetscErrorCode | TestWriteLESFieldsCopiesOwnedPeriodicValues (void) |
| Tests LES output staging from local vectors on a multiply periodic DMDA. | |
| static PetscErrorCode | StagedFourierModeMaxDivergence (UserCtx *user, PetscInt mode_x, PetscInt mode_y, PetscInt mode_z, Cmpnts amplitude, const char *tmpdir, PetscReal *max_divergence) |
| Stages a real Cartesian Fourier mode through the production file-IC path. | |
| static PetscErrorCode | TestStagedUcatFourierModesUsePicurvDiscreteSymbol (void) |
| Cross-checks selected exact Fourier modes against PICurv's native discrete symbol. | |
| static PetscErrorCode | TestPopulateInitialUcontLoadsStagedUcont (void) |
| Tests loading a staged Ucont file IC without Cartesian conversion. | |
| static PetscErrorCode | TestInterpolateAllFieldsToSwarmConstantFields (void) |
| Tests direct interpolation from Eulerian fields to one localized swarm particle. | |
| static PetscErrorCode | TestInterpolateAllFieldsToSwarmCornerAveragedConstantFields (void) |
| Tests the corner-averaged (legacy) interpolation path on constant fields. | |
| static PetscErrorCode | TestInterpolateAllFieldsToSwarmFaceFluxConstantFields (void) |
| FaceFlux: constant face fluxes give that velocity; other fields still interpolate trilinearly. | |
| static PetscErrorCode | TestFaceFluxVelocityIsDivergenceFree (void) |
| FaceFlux: divergence-free fluxes give a divergence-free velocity, zero at a wall face, and the Contra2Cart value at the cell centre. | |
| static PetscErrorCode | TestScatterAllParticleFieldsToEulerFieldsAveragesPsi (void) |
| Tests particle-to-grid scattering using known cell occupancy and scalar values. | |
| static PetscErrorCode | TestCalculateParticleCountPerCellCountsGlobalCellIDs (void) |
| Tests particle counting by geometric cell IDs using the production +1 storage shift. | |
| static PetscErrorCode | TestResetAllParticleStatusesLeavesLostParticlesUntouched (void) |
| Tests localized particle-status reset behavior for restart of the location workflow. | |
| static PetscErrorCode | TestCheckAndRemoveLostParticlesRemovesLostEntries (void) |
| Tests removal of LOST and EXITED particles, their separate tallies, and that survivors keep the one-at-a-time removal order. | |
| static PetscErrorCode | TestSortParticlesByCellKeepsEachPointWhole (void) |
| Tests that sorting by host cell orders points k-slowest, keeps ties and every field together, and puts unlocated points last. | |
| static PetscErrorCode | TestBrownianDisplacementIsKeyedOnSeedParticleAndStep (void) |
| Tests that a Brownian increment is a function of (seed, PID, step) alone. | |
| static PetscErrorCode | TestBrownianDisplacementMoments (void) |
| Tests that increments over many particles have zero mean, variance 2 D dt, and uncorrelated components. | |
| static PetscErrorCode | TestUpdateAllParticlePositionsMovesSwarmEntries (void) |
| Tests swarm-wide particle position updates using the same transport path as the runtime loop. | |
| static PetscErrorCode | TestLocateAllParticlesInGridPriorCellFastPath (void) |
| Tests the location orchestrator fast path when a particle already carries a valid prior cell. | |
| static PetscErrorCode | TestLocateAllParticlesInGridGuessPathResolvesLocalParticle (void) |
| Tests the guess-then-verify orchestrator path for a local particle with an unknown prior cell. | |
| static PetscErrorCode | TestLocateParticleOrFindMigrationTargetCountsReSearch (void) |
| Verifies that later settlement passes increment re-search metrics. | |
| static PetscErrorCode | TestLocateParticleOrFindMigrationTargetReflectsAtWall (void) |
| Tests that a particle beyond a reflecting -Xi face is mirrored back and located, including after a tangential walk. | |
| static PetscErrorCode | TestWallModelScalarHelpers (void) |
| Tests wall-model scalar helper kernels. | |
| static PetscErrorCode | TestWallModelVelocityHelpers (void) |
| Tests closed-form and iterative wall-model velocity helpers against inverse reconstructions. | |
| static PetscErrorCode | TestWallLawBranchesAreContinuous (void) |
| Tests that the wall laws' branches meet, so each reference speed has one friction velocity. | |
| static PetscErrorCode | TestLogLawFrictionVelocityStaysPositiveOnRoughWalls (void) |
| Tests that the log law's friction velocity stays positive on a rough wall. | |
| static PetscErrorCode | TestCabotSignedStressAndIntegralAccuracy (void) |
| Tests Cabot's stress sign and its wall-layer integral at large y+. | |
| static PetscErrorCode | TestValidateDrivenFlowConfigurationNoDrivenHandlers (void) |
| Tests driven-flow validation when no driven handlers are present. | |
| static PetscErrorCode | TestMinimalFixtureMirrorsProductionDMLayout (void) |
| Tests that the shared minimal fixture mirrors the production DA contract. | |
| static PetscErrorCode | TestMinimalFixtureRegistersProductionSwarmFields (void) |
| Tests that the shared swarm fixture registers the production field set. | |
| static PetscErrorCode | TestUpdateSolverHistoryVectorsShiftsStates (void) |
| Tests solver history-vector shifting between time levels. | |
| static PetscErrorCode | TestGetOwnedCellRangeSingleRankAccounting (void) |
| Tests owned-cell range accounting on a single MPI rank. | |
| static PetscErrorCode | TestComputeAndStoreNeighborRanksSingleRank (void) |
| Tests neighbor-rank discovery on a single MPI rank. | |
| static PetscErrorCode | TestRuntimeWalltimeGuardParsesPositiveSeconds (void) |
| Tests parsing of positive runtime walltime metadata values. | |
| static PetscErrorCode | TestRuntimeWalltimeGuardEstimatorHelpers (void) |
| Tests walltime-guard estimator helper calculations. | |
| static PetscErrorCode | TestRuntimeWalltimeGuardTriggerDecision (void) |
| Tests runtime walltime-guard shutdown trigger decisions. | |
| int | main (int argc, char **argv) |
| Runs the unit-runtime PETSc test binary. | |
C unit tests for runtime, particle, wall, and walltime-guard helpers.
Definition in file test_runtime_kernels.c.
|
static |
Synchronizes the minimal runtime fixture's global fields into their persistent local ghosts.
Definition at line 23 of file test_runtime_kernels.c.
|
static |
Seeds one localized swarm particle with the cell, position, weight, and status data used by runtime tests.
Definition at line 44 of file test_runtime_kernels.c.
|
static |
Tests particle distribution remainder handling across ranks.
Definition at line 88 of file test_runtime_kernels.c.
|
static |
Tests basic particle-inside-bounding-box classification cases.
Definition at line 107 of file test_runtime_kernels.c.
|
static |
Tests particle weight updates against expected ratios.
Definition at line 138 of file test_runtime_kernels.c.
|
static |
Tests particle position updates without Brownian forcing.
Definition at line 161 of file test_runtime_kernels.c.
|
static |
Tests particle position updates driven only by diffusivity-gradient drift.
Definition at line 195 of file test_runtime_kernels.c.
|
static |
Tests IEM relaxation updates for particle-carried fields.
Definition at line 229 of file test_runtime_kernels.c.
|
static |
Tests spatially varying Cartesian-field conversion to contravariant fluxes.
Definition at line 254 of file test_runtime_kernels.c.
|
static |
Verifies periodic Ucat endpoints are repaired before Cart2Contra terminal faces.
Definition at line 286 of file test_runtime_kernels.c.
|
static |
Tests loading a staged Ucat file IC and converting it to Ucont.
Definition at line 316 of file test_runtime_kernels.c.
|
static |
Tests LES output staging from local vectors on a multiply periodic DMDA.
Definition at line 351 of file test_runtime_kernels.c.
|
static |
Stages a real Cartesian Fourier mode through the production file-IC path.
The returned maximum is the native face-interpolation/backward-difference divergence. On the uniform periodic fixture its symbol is (sin(theta_x), sin(theta_y), sin(theta_z)).
Definition at line 396 of file test_runtime_kernels.c.
|
static |
Cross-checks selected exact Fourier modes against PICurv's native discrete symbol.
Definition at line 454 of file test_runtime_kernels.c.
|
static |
Tests loading a staged Ucont file IC without Cartesian conversion.
Definition at line 500 of file test_runtime_kernels.c.
|
static |
Tests direct interpolation from Eulerian fields to one localized swarm particle.
Definition at line 530 of file test_runtime_kernels.c.
|
static |
Tests the corner-averaged (legacy) interpolation path on constant fields.
Definition at line 582 of file test_runtime_kernels.c.
|
static |
FaceFlux: constant face fluxes give that velocity; other fields still interpolate trilinearly.
Definition at line 634 of file test_runtime_kernels.c.
|
static |
FaceFlux: divergence-free fluxes give a divergence-free velocity, zero at a wall face, and the Contra2Cart value at the cell centre.
The fluxes come from a stream function psi(i, j) = i^2 j + 0.3 j^2 on cell edges, so every cell's discrete flux divergence is zero and the j = 0 wall face carries no flux. The velocity is linear in each weight, so one-sided differences of the weights give its divergence exactly.
Definition at line 671 of file test_runtime_kernels.c.
|
static |
Tests particle-to-grid scattering using known cell occupancy and scalar values.
Definition at line 740 of file test_runtime_kernels.c.
|
static |
Tests particle counting by geometric cell IDs using the production +1 storage shift.
Definition at line 775 of file test_runtime_kernels.c.
|
static |
Tests localized particle-status reset behavior for restart of the location workflow.
Definition at line 806 of file test_runtime_kernels.c.
|
static |
Tests removal of LOST and EXITED particles, their separate tallies, and that survivors keep the one-at-a-time removal order.
Definition at line 837 of file test_runtime_kernels.c.
|
static |
Tests that sorting by host cell orders points k-slowest, keeps ties and every field together, and puts unlocated points last.
Definition at line 892 of file test_runtime_kernels.c.
|
static |
Tests that a Brownian increment is a function of (seed, PID, step) alone.
The same key reproduces the increment whatever was drawn before it, which is what makes a restart and a different rank layout draw what the uninterrupted run drew; changing any one key changes it.
Definition at line 950 of file test_runtime_kernels.c.
|
static |
Tests that increments over many particles have zero mean, variance 2 D dt, and uncorrelated components.
Definition at line 986 of file test_runtime_kernels.c.
|
static |
Tests swarm-wide particle position updates using the same transport path as the runtime loop.
Definition at line 1020 of file test_runtime_kernels.c.
|
static |
Tests the location orchestrator fast path when a particle already carries a valid prior cell.
Definition at line 1085 of file test_runtime_kernels.c.
|
static |
Tests the guess-then-verify orchestrator path for a local particle with an unknown prior cell.
Definition at line 1140 of file test_runtime_kernels.c.
|
static |
Verifies that later settlement passes increment re-search metrics.
Definition at line 1195 of file test_runtime_kernels.c.
|
static |
Tests that a particle beyond a reflecting -Xi face is mirrored back and located, including after a tangential walk.
Definition at line 1232 of file test_runtime_kernels.c.
|
static |
Tests wall-model scalar helper kernels.
Definition at line 1276 of file test_runtime_kernels.c.
|
static |
Tests closed-form and iterative wall-model velocity helpers against inverse reconstructions.
Definition at line 1300 of file test_runtime_kernels.c.
|
static |
Tests that the wall laws' branches meet, so each reference speed has one friction velocity.
The log law switched from u+ = y+ to its logarithm at a fixed y+ = 11.81, where the two differ by about 2.4%, and Werner-Wengle at the same rounded value, where its branches differ by about 2e-5. Either jump makes the speed-to-u_tau map non-monotone near the switch and the residual non-smooth for a finite-difference Jacobian.
Definition at line 1388 of file test_runtime_kernels.c.
|
static |
Tests that the log law's friction velocity stays positive on a rough wall.
Newton from a small guess could step onto the linear branch's mirror root at -u_tau; a rough wall made that common, and the sign then corrupted u_tau, its minimum and y+.
Definition at line 1449 of file test_runtime_kernels.c.
|
static |
Tests Cabot's stress sign and its wall-layer integral at large y+.
Cabot's momentum balance gives a signed stress; under an adverse pressure gradient strong enough to exceed the reference speed's share it reverses, and the solver applies it in that direction. Its wall-layer integrals were 30 uniform points, about a third off at y+ = 1000; they must now agree with a resolved reference.
Definition at line 1475 of file test_runtime_kernels.c.
|
static |
Tests driven-flow validation when no driven handlers are present.
Definition at line 1514 of file test_runtime_kernels.c.
|
static |
Tests that the shared minimal fixture mirrors the production DA contract.
Definition at line 1529 of file test_runtime_kernels.c.
|
static |
Tests that the shared swarm fixture registers the production field set.
Definition at line 1558 of file test_runtime_kernels.c.
|
static |
Tests solver history-vector shifting between time levels.
Definition at line 1609 of file test_runtime_kernels.c.
|
static |
Tests owned-cell range accounting on a single MPI rank.
Definition at line 1641 of file test_runtime_kernels.c.
|
static |
Tests neighbor-rank discovery on a single MPI rank.
Definition at line 1669 of file test_runtime_kernels.c.
|
static |
Tests parsing of positive runtime walltime metadata values.
Definition at line 1702 of file test_runtime_kernels.c.
|
static |
Tests walltime-guard estimator helper calculations.
Definition at line 1719 of file test_runtime_kernels.c.
|
static |
Tests runtime walltime-guard shutdown trigger decisions.
Definition at line 1745 of file test_runtime_kernels.c.
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Runs the unit-runtime PETSc test binary.
Definition at line 1767 of file test_runtime_kernels.c.