|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
This page documents how the PETSc-backed C testing layer is structured and how to extend it safely.
Key directories:
tests/c/: C test sources and shared fixture helperstests/smoke/: executable smoke runner for tiny end-to-end flat/bent/brownian solve/post/restart/analytical workflows (single-rank and multi-rank, including particle restart branches)tests/fixtures/: Python/control-plane YAML fixturesCurrent C files:
test_support.htest_support.ctest_install_check.ctest_geometry.ctest_setup_lifecycle.ctest_solver_kernels.ctest_particle_kernels.ctest_io.ctest_logging.ctest_postprocessing.ctest_vtk_io.ctest_postprocessor.ctest_statistics.ctest_grid.ctest_metric.ctest_boundaries.ctest_periodic_dev.ctest_poisson_rhs.ctest_runtime_kernels.ctest_mpi_kernels.cRepresentative named cases by suite (exact strings used in PicurvTestCase arrays):
test_install_check.c:environment-visiblebasic-petsc-objectstest_geometry.c:scalar-interpolation-constantvector-interpolation-constantsigned-distance-and-classificationtest_setup_lifecycle.c:shared-runtime-fixture-contractssetup-lifecycle-core-solver-setupsetup-lifecycle-particle-initializationsetup-lifecycle-random-generators-and-cleanupsetup-lifecycle-cleanup-across-initialization-statestest_solver_kernels.c:les-filter-pathsanalytical-geometry-selectionanalytical-solution-engine-dispatchanalytical-particle-dispatchcompute-eddy-viscosity-les-deterministic-fieldanalytical-solution-engine-taylor-green-samplesflow-solver-rejects-unsupported-momentum-solver-typedriven-channel-flow-sourcetest_particle_kernels.c:check-cell-within-local-gridinitialize-traversal-parametersretrieve-current-celltest_io.c:should-write-data-outputverify-path-existencewrite-and-read-simulation-fieldsparse-post-processing-settingstrim-whitespacebc-string-parsersvalidate-bc-handler-for-typeparse-scaling-informationdisplay-banner-startup-summarytest_logging.c:string-conversion-helpersget-log-level-from-environmentallowed-functions-filterparticle-console-snapshot-cadencelogging-file-parsing-and-formatting-helperslogging-continuity-and-field-diagnosticsinterpolation-error-loggingparticle-field-table-loggingparticle-console-snapshot-loggingparticle-metrics-loggingfield-anatomy-loggingprofiling-lifecycle-helperstest_postprocessing.c:compute-specific-kecompute-displacementcompute-nodal-average-scalarnormalize-relative-fielddimensionalize-pressure-fieldcompute-qcriterion-zero-flowtest_vtk_io.c:prepare-output-coordinates-subsamples-interior-gridprepare-output-eulerian-field-data-subsamples-scalarprepare-output-particle-data-subsamplingcreate-vtk-file-from-metadata-writes-structured-gridtest_postprocessor.c:setup-postprocess-swarm-registers-pipeline-fieldseulerian-data-processing-pipeline-runs-configured-kernelsparticle-data-processing-pipeline-computes-specific-keglobal-statistics-pipeline-writes-msd-csvwrite-eulerian-file-writes-vtswrite-particle-file-writes-vtptest_statistics.c:compute-particle-msd-writes-csvcompute-particle-msd-empty-swarm-no-outputtest_grid.c:compute-local-bbox-uniform-gridgather-and-broadcast-bboxestest_metric.c:invert-covariant-metric-diagonalmetric-velocity-contravariant-identitymetric-velocity-contravariant-scaled-axesface-normal-and-area-axis-alignedcharacteristic-length-scale-axis-alignedtest_boundaries.c:can-rank-service-face-matches-inlet-when-definedcan-rank-service-inlet-face-requires-definitionboundary-condition-factory-assignmentsboundary-condition-factory-implemented-handler-matrixboundary-condition-factory-rejects-unsupported-handlerdeterministic-face-grid-location-matrixrandom-inlet-face-location-matrixinlet-constant-velocity-handler-behaviorinlet-parabolic-profile-handler-behavioroutlet-conservation-handler-behaviortest_periodic_dev.c:periodic-geometric-factory-assignmenttransfer-periodic-face-field-copies-x-facesapply-metrics-periodic-bcs-copies-aj-facesperiodic-driven-constant-handler-behaviorperiodic-driven-constant-rejects-non-periodic-facetest_poisson_rhs.c:update-pressure-adds-phipoisson-rhs-zero-divergencecompute-body-forces-dispatchercompute-eulerian-diffusivity-molecular-onlyconvection-zero-fieldviscous-uniform-fieldcompute-rhs-zero-field-no-forcingcompute-eulerian-diffusivity-gradient-constant-fieldpoisson-null-space-function-removes-meanpoisson-lhsnew-assembles-operatorprojection-zero-phi-leaves-velocity-unchangedprojection-linear-phi-corrects-velocitytest_runtime_kernels.c:distribute-particles-remainder-handlingis-particle-inside-bbox-basic-casesupdate-particle-weights-computes-expected-ratiosupdate-particle-position-without-brownian-contributionupdate-particle-field-iem-relaxationset-initial-interior-field-ignores-non-ucont-requestset-initial-interior-field-constant-profile-on-z-inletinterpolate-all-fields-to-swarm-constant-fieldsinterpolate-all-fields-to-swarm-corner-averaged-constant-fieldsscatter-all-particle-fields-to-euler-fields-averages-psicalculate-particle-count-per-cell-counts-global-cell-idsreset-all-particle-statuses-leaves-lost-particles-untouchedcheck-and-remove-out-of-bounds-particles-removes-escaped-particlecheck-and-remove-lost-particles-removes-lost-entriescalculate-brownian-displacement-deterministic-seedupdate-all-particle-positions-moves-swarm-entrieslocate-all-particles-in-grid-prior-cell-fast-pathlocate-all-particles-in-grid-guess-path-resolves-local-particlewall-noslip-and-freeslip-helperswall-model-scalar-helperswall-model-velocity-helperswall-function-vector-wrappersvalidate-driven-flow-configuration-no-driven-handlerscompute-smagorinsky-constant-constant-modelupdate-solver-history-vectors-shifts-statesget-owned-cell-range-single-rank-accountingcompute-and-store-neighbor-ranks-single-rankruntime-walltime-guard-parses-positive-secondsruntime-walltime-guard-estimator-helpersruntime-walltime-guard-trigger-decisiontest_mpi_kernels.c:distribute-particles-collective-consistencybounding-box-collectives-multi-rankrestart-cellid-migration-moves-particle-to-ownerCanonical user-facing targets:
make doctormake unitmake unit-geometrymake unit-setupmake unit-solvermake unit-particlesmake unit-iomake unit-loggingmake unit-postmake unit-gridmake unit-metricmake unit-boundariesmake unit-poisson-rhsmake unit-runtimemake unit-simulationmake unit-mpimake unit-periodic-devmake smokemake smoke-mpimake smoke-mpi-matrixmake smoke-stressmake smoke-periodic-devmake coverage-cmake checkmake check-mpimake check-mpi-matrixmake check-fullmake check-stressCompatibility aliases (install-check, ctest*) should be preserved for continuity, but documentation and new contributor guidance should always prefer the canonical names.
Use this rule set:
doctor:unit-*:smoke:test-python:scripts/picurv, schema, and repository metadata behaviorIf a test can run against a small local fixture without invoking the full executables, it almost always belongs in unit-*.
Aggregate gate guidance for C contributors:
make check for default local branch gatingmake check-mpi or make check-mpi-matrix for targeted MPI validationmake check-full when you need one command that runs all MPI layers (unit-mpi, smoke-mpi, and smoke-mpi-matrix) after baseline checktests/smoke/run_smoke.sh is not a C unit file, but it is the integration bridge that verifies how C executables behave under real launcher orchestration.
Smoke checks include:
-help viability62 (PETSC_ERR_ARG_WRONG) after printing helpload and init)make smoke-stress) for longer particle cycling, chained restarts, parabolic-inlet runtime coverage, periodic constant-flux validate/dry-run coverage, and extra-rank MPI particle runsmake smoke-periodic-dev) for the in-progress periodic constant-flux path; not part of the default gateEnvironment knobs relevant to C contributors:
TEST_MPI_NPROCS (for unit-mpi)SMOKE_MPI_NPROCS (for smoke-mpi)SMOKE_MPI_MATRIX_NPROCS (for smoke-mpi-matrix)KEEP_SMOKE_TMP=1 (retain smoke workspace)tests/c/test_support.* provides the shared PETSc-backed fixture layer.
Current responsibilities:
SimCtx and UserCtx fixtures for fast kernel-level testsDMDA objects using the production node contract (da sized as IM+1/JM+1/KM+1)fda from the da coordinate-DM path and keep user->info aligned with daDMSwarm objects with the production solver field set (position, velocity, DMSwarm_CellID, weight, Diffusivity, DiffusivityGradient, Psi, DMSwarm_location_status)0..1 convention used by the main grid path/tmpFuture C tests should reuse these helpers instead of rebuilding fixtures inline unless a suite truly needs a specialized setup. Periodic boundary harnesses belong in the dedicated development targets until the product implementation is stable enough for the default gate.
The current highest-value additions are:
LocateParticleOrFindMigrationTargetLOST and MIGRATING_OUT outcomesGuessParticleOwnerWithBBox heuristicMomentumSolver_Explicit_RungeKutta4 and one small invariant case for MomentumSolver_DualTime_Picard_RK4PoissonSolver_MG and periodic/IBM stencil behavior checks beyond the current helper-level unit-poisson-rhs surfaceNaming:
test_io.c -> make unit-io)Assertions:
Tolerances:
1e-12 for algebraic invariants1e-10 to 1e-9 for interpolation and I/O round-tripsRules:
/tmp/tmp/picurv-test-*) so a failed test can be debugged manuallyRecommended workflow:
tests/c/test_<area>.c filetest_support.*Makefileunit-<area> targetThis page describes C Test Suite Developer Guide within the PICurv workflow. For CFD users, the most reliable reading strategy is to map the page content to a concrete run decision: what is configured, what runtime stage it influences, and which diagnostics should confirm expected behavior.
Treat this page as both a conceptual reference and a runbook. If you are debugging, pair the method/procedure described here with monitor output, generated runtime artifacts under runs/<run_id>/config, and the associated solver/post logs so numerical intent and implementation behavior stay aligned.