|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
C unit tests for per-window accumulator storage and pointwise application. More...
#include "test_support.h"#include "statistics_accumulator.h"#include "statistics_moments.h"#include "field_catalog.h"#include "statistics_window.h"#include "statistics_target.h"Go to the source code of this file.
Macros | |
| #define | ACC_N 6 /* fixture size; cell domain is 5x5x5 */ |
| #define | ACC_CELLS 125 |
Functions | |
| static PicurvWindowDefinition | AccDefinition (PetscBool want_second) |
| Builds a definition requesting Ucat and P with second moments. | |
| static PetscErrorCode | SetUniform (UserCtx *user, PetscReal x, PetscReal y, PetscReal z, PetscReal p) |
| Sets Ucat to a uniform vector and P to a uniform scalar. | |
| static PetscErrorCode | ReadScalarAt (UserCtx *user, Vec v, PetscInt i, PetscInt j, PetscInt k, PetscReal *out) |
| Reads one interior point of a scalar accumulator vector. | |
| static PetscErrorCode | ReadComponentAt (UserCtx *user, Vec v, PetscInt components, PetscInt component, PetscInt i, PetscInt j, PetscInt k, PetscReal *out) |
| Reads one component of a multi-component accumulator vector at an interior point. | |
| static PetscErrorCode | TestComponentCounts (void) |
| Component counts follow the documented product shapes. | |
| static PetscErrorCode | TestStorageShape (void) |
| Storage allocates one mean per field and the right number of product components. | |
| static PetscErrorCode | TestKnownAccumulationAcrossField (void) |
| Three accepted states reproduce the analytically known moments at every point. | |
| static PetscErrorCode | TestValidFractionRange (void) |
| The valid-fraction range reports mask coverage, including a never-valid point. | |
| static PetscErrorCode | TestValidFractionDetectsNeverValidPoint (void) |
| A point blanked from the start is reported as never valid. | |
| static PetscErrorCode | TestCovarianceAccumulation (void) |
| A vector-scalar covariance reproduces its analytically known components. | |
| static PetscErrorCode | TestScalarSelfCovarianceMatchesSecondMoment (void) |
| A field's covariance with itself reduces exactly to its own second moment. | |
| static PetscErrorCode | TestCovarianceRequiresFieldMembership (void) |
| A covariance member missing from the field list is rejected, not silently skipped. | |
| static PetscErrorCode | TestDerivedQuantities (void) |
| Derived quantities reproduce the analytic values the accumulated state implies. | |
| static PetscErrorCode | TestSpatialMeanExcludesUnsampledPoints (void) |
| The spatial mean divides by sampled points, not by the whole vector. | |
| static PetscErrorCode | TestPayloadEnumeration (void) |
| Payload enumeration covers every vector exactly once with stable names. | |
| static PetscErrorCode | TestWeightedAccumulation (void) |
| Unequal weights reproduce the weighted result the kernels define. | |
| static PetscErrorCode | TestMaskedPointsAreExcluded (void) |
| Masked points accumulate nothing, and remain distinguishable from unsampled ones. | |
| static PetscErrorCode | TestConstantFieldZeroProduct (void) |
| A constant field yields exactly zero product at every point. | |
| static PetscErrorCode | TestRunloopDriverAppliesScheduledStates (void) |
| The runloop entry point applies exactly the states the schedule accepts. | |
| int | main (int argc, char **argv) |
| Entry point for the accumulator suite. | |
C unit tests for per-window accumulator storage and pointwise application.
The field series reuses the values verified analytically by the moment-kernel suite, so a failure here isolates the field-to-accumulator wiring rather than the numerics: three samples of (1,2,3), (3,6,5), (5,4,7) have means (3,4,5) and symmetric centered products (8,4,8,8,4,8) in (xx,xy,xz,yy,yz,zz) order.
Definition in file test_statistics_accumulator.c.
| #define ACC_N 6 /* fixture size; cell domain is 5x5x5 */ |
Definition at line 19 of file test_statistics_accumulator.c.
| #define ACC_CELLS 125 |
Definition at line 20 of file test_statistics_accumulator.c.
|
static |
Builds a definition requesting Ucat and P with second moments.
Definition at line 23 of file test_statistics_accumulator.c.
|
static |
Sets Ucat to a uniform vector and P to a uniform scalar.
Definition at line 38 of file test_statistics_accumulator.c.
|
static |
Reads one interior point of a scalar accumulator vector.
Definition at line 59 of file test_statistics_accumulator.c.
|
static |
Reads one component of a multi-component accumulator vector at an interior point.
Definition at line 70 of file test_statistics_accumulator.c.
|
static |
Component counts follow the documented product shapes.
Definition at line 84 of file test_statistics_accumulator.c.
|
static |
Storage allocates one mean per field and the right number of product components.
Definition at line 108 of file test_statistics_accumulator.c.
|
static |
Three accepted states reproduce the analytically known moments at every point.
Definition at line 146 of file test_statistics_accumulator.c.
|
static |
The valid-fraction range reports mask coverage, including a never-valid point.
This is the mask-health indicator the console snapshot prints, and it is the only signal that distinguishes a mean built from every state from one built from none. A blanked point keeps a zero mean that looks like a legitimate value, so the range has to surface it.
Definition at line 211 of file test_statistics_accumulator.c.
|
static |
A point blanked from the start is reported as never valid.
Definition at line 256 of file test_statistics_accumulator.c.
|
static |
A vector-scalar covariance reproduces its analytically known components.
Definition at line 288 of file test_statistics_accumulator.c.
|
static |
A field's covariance with itself reduces exactly to its own second moment.
Definition at line 341 of file test_statistics_accumulator.c.
|
static |
A covariance member missing from the field list is rejected, not silently skipped.
Definition at line 380 of file test_statistics_accumulator.c.
|
static |
Derived quantities reproduce the analytic values the accumulated state implies.
The series is the one the moment suite verifies by hand, so a failure here isolates the normalization and component selection rather than the accumulation: with three unit-weight samples, R_ij = C_ij / 3, and the diagonal of the Ucat tensor is 8/3 in each direction, giving TKE = 4 and an RMS of sqrt(8/3) per component.
Definition at line 419 of file test_statistics_accumulator.c.
|
static |
The spatial mean divides by sampled points, not by the whole vector.
A derived field is zero outside the target domain and wherever the mask never admitted a point. Those zeros are absences, and averaging over them silently scales the answer down by the fraction of the vector the window never covered — a wrong number that still looks plausible.
Definition at line 535 of file test_statistics_accumulator.c.
|
static |
Payload enumeration covers every vector exactly once with stable names.
Definition at line 603 of file test_statistics_accumulator.c.
|
static |
Unequal weights reproduce the weighted result the kernels define.
Definition at line 678 of file test_statistics_accumulator.c.
|
static |
Masked points accumulate nothing, and remain distinguishable from unsampled ones.
Definition at line 712 of file test_statistics_accumulator.c.
|
static |
A constant field yields exactly zero product at every point.
Definition at line 749 of file test_statistics_accumulator.c.
|
static |
The runloop entry point applies exactly the states the schedule accepts.
Drives FieldStatisticsUpdateWindows directly, so the scheduling decision and the field accumulation are exercised through the same path the solver uses rather than being tested only in isolation.
Definition at line 786 of file test_statistics_accumulator.c.
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Entry point for the accumulator suite.
Definition at line 848 of file test_statistics_accumulator.c.