C unit tests for the LES subgrid-scale closure. More...
Go to the source code of this file.
Functions | |
| static PetscErrorCode | TestSymTensorAlgebra (void) |
| Tests the symmetric-tensor primitives against hand-computed values. | |
| static PetscErrorCode | TestStrainRateFromGradients (void) |
| Tests strain-rate assembly and its magnitude for a known velocity gradient. | |
| static PetscErrorCode | TestFilterWidthModelsSeparateOnStretchedCell (void) |
| Tests that the three filter-width models separate on an anisotropic cell. | |
| static PetscErrorCode | TestLeonardStressVanishesOnUniformFlow (void) |
| Tests that the Leonard stress vanishes on a uniform velocity field. | |
| static PetscErrorCode | TestGermanoModelTensorOnConstantStrain (void) |
| Tests the model tensor where the two filter terms provably coincide. | |
| static PetscErrorCode | TestGermanoModelTensorUsesFilteredProduct (void) |
| Tests that the model tensor uses the filtered product, not the filtered factors. | |
| static PetscErrorCode | TestClipModelCoefficientModes (void) |
| Tests each limiting mode, including the sign that carries backscatter. | |
| static PetscErrorCode | TestEddyViscosityFloorBoundsTotalViscosity (void) |
| Tests eddy-viscosity assembly and the total-viscosity floor. | |
| static PetscErrorCode | TestSubgridKineticEnergy (void) |
| Tests the Yoshizawa subgrid kinetic energy against its closed form. | |
| static PetscErrorCode | FillLocalScalar (UserCtx *user, Vec local, PetscReal value) |
| Fills a ghosted local scalar field over the whole local array. | |
| static PetscErrorCode | SetInteriorScalar (UserCtx *user, Vec local, PetscReal value) |
| Writes a scalar into every cell the closure treats as owned and interior. | |
| static PetscErrorCode | ReadLocalScalar (UserCtx *user, Vec local, PetscInt i, PetscInt j, PetscInt k, PetscReal *value) |
| Reads one cell of a ghosted local scalar field. | |
| static void | DeclarePeriodicFaces (UserCtx *user, PetscBool xi, PetscBool eta, PetscBool zeta) |
| Declares periodic boundary pairs on the axes a test wants homogeneous. | |
| static PetscErrorCode | TestAverageRatioLocalIsPointwise (void) |
| Tests that an empty direction set reproduces the pointwise local model. | |
| static PetscErrorCode | TestAverageRatioDividesSummedFields (void) |
| Tests that averaging divides summed numerators by summed denominators. | |
| static PetscErrorCode | TestAverageRatioRetainsUnaveragedDirection (void) |
| Tests that averaging over two directions leaves a profile along the third. | |
| static PetscErrorCode | TestAverageRatioIgnoresPeriodicDuplicatePlanes (void) |
| Tests that a spatial average ignores the periodic duplicate planes. | |
| static PetscErrorCode | TestHomogeneousAveragingDerivesPeriodicAxes (void) |
| Tests that homogeneous averaging falls back to the block's periodic axes. | |
| static PetscErrorCode | TestAveragingModesSelectTheirOwnDirections (void) |
| Tests that local and global averaging ignore the configured direction list. | |
| static PetscErrorCode | TestConstantModelNeedsNoCoefficientField (void) |
| Tests that the constant model builds its viscosity without a coefficient field. | |
| static PetscErrorCode | TestDynamicProcedureRejectsConstantModel (void) |
| Tests that the dynamic procedure refuses to run for the constant model. | |
| static PetscErrorCode | TestDynamicProcedureVanishesOnUniformFlow (void) |
| Tests that the dynamic procedure returns a zero coefficient on uniform flow. | |
| static PetscErrorCode | TestDynamicProcedureGlobalAverageIsUniform (void) |
| Tests the dynamic procedure end to end on a periodic sheared field. | |
| int | main (int argc, char **argv) |
| Entry point for the LES closure suite. | |
C unit tests for the LES subgrid-scale closure.
The suite is layered the way the module is. Pure kernels are checked against hand computed values with no PETSc objects at all; the Germano pieces are checked on fields whose answers are known in closed form; and the driver routines are checked on a small DMDA fixture.
Two of the cases exist because of specific defects and are worth naming. The "filtered-product" case pins the distinction between the filter of a product and the product of filtered factors, which the model tensor once collapsed. The "duplicate-plane" case pins the requirement that a spatial average count each physical cell once on a periodic block, where the two layout boundary planes are copies of interior cells.
Definition in file test_les.c.
|
static |
Tests the symmetric-tensor primitives against hand-computed values.
Definition at line 29 of file test_les.c.
|
static |
Tests strain-rate assembly and its magnitude for a known velocity gradient.
Definition at line 68 of file test_les.c.
|
static |
Tests that the three filter-width models separate on an anisotropic cell.
Definition at line 93 of file test_les.c.
|
static |
Tests that the Leonard stress vanishes on a uniform velocity field.
Definition at line 123 of file test_les.c.
|
static |
Tests the model tensor where the two filter terms provably coincide.
On a constant strain field the test filter is the identity, so the filter of the product equals the product of the filtered factors and the model tensor collapses to a closed form, -2 Delta^2 (alpha - 1) |S| S_ij, made trace free. This is the one configuration in which the corrected tensor and the collapsed expression that preceded it agree, which is what makes it a clean analytic anchor.
Definition at line 147 of file test_les.c.
|
static |
Tests that the model tensor uses the filtered product, not the filtered factors.
Builds a stencil whose strain magnitude varies across it, so the test filter of |S| S_ij genuinely differs from |S|^ S^_ij. The model tensor must be built from the former. Collapsing it onto the latter yields -2 Delta^2 (alpha - 1) |S|^ S^_ij, which is well scaled, responds to the flow, and is not the Germano-Lilly tensor; this case fails if the two are ever conflated again.
Definition at line 180 of file test_les.c.
|
static |
Tests each limiting mode, including the sign that carries backscatter.
Definition at line 232 of file test_les.c.
|
static |
Tests eddy-viscosity assembly and the total-viscosity floor.
Definition at line 265 of file test_les.c.
|
static |
Tests the Yoshizawa subgrid kinetic energy against its closed form.
Definition at line 290 of file test_les.c.
|
static |
Fills a ghosted local scalar field over the whole local array.
Writes the halo as well as the owned cells, so a test can poison the layout boundary planes and observe whether an averaging routine counts them.
Definition at line 309 of file test_les.c.
|
static |
Writes a scalar into every cell the closure treats as owned and interior.
Definition at line 320 of file test_les.c.
|
static |
Reads one cell of a ghosted local scalar field.
Definition at line 344 of file test_les.c.
|
static |
Declares periodic boundary pairs on the axes a test wants homogeneous.
The shared fixture builds a periodic DMDA from the SimCtx flags but leaves the boundary face configuration untouched. The periodic field synchronization reads the faces rather than the flags, so a test that synchronizes has to declare them. The closure's own periodicity questions are answered from the flags, so tests that only ask those do not call this.
Definition at line 365 of file test_les.c.
|
static |
Tests that an empty direction set reproduces the pointwise local model.
Definition at line 379 of file test_les.c.
|
static |
Tests that averaging divides summed numerators by summed denominators.
The distinction matters: the mean of the quotients differs from the quotient of the means, and Lilly's least-squares closure calls for the latter. Separating them needs a denominator that varies too. Three cells carry 1/1 and two carry 6/2, so every pointwise quotient is 1 or 3 and their mean is 9/5, while the ratio of the sums is 15/7. Only the second answer can come from averaging the two fields first.
Definition at line 434 of file test_les.c.
|
static |
Tests that averaging over two directions leaves a profile along the third.
Definition at line 493 of file test_les.c.
|
static |
Tests that a spatial average ignores the periodic duplicate planes.
On a periodic block, index 0 and index m-1 hold copies of interior cells. Counting them would weight those cells twice. The test poisons both planes and requires the average not to move.
Definition at line 550 of file test_les.c.
|
static |
Tests that homogeneous averaging falls back to the block's periodic axes.
Definition at line 615 of file test_les.c.
|
static |
Tests that local and global averaging ignore the configured direction list.
Definition at line 649 of file test_les.c.
|
static |
Tests that the constant model builds its viscosity without a coefficient field.
UserCtx::CS and UserCtx::lCs are deliberately left unallocated. If the constant path ever reaches for them again this case crashes rather than silently reintroducing a field of one repeated number.
Definition at line 680 of file test_les.c.
|
static |
Tests that the dynamic procedure refuses to run for the constant model.
Definition at line 728 of file test_les.c.
|
static |
Tests that the dynamic procedure returns a zero coefficient on uniform flow.
Exercises the whole path: the strain precompute and its halo, the stencil gather, every test filter, both contractions, the averaging, and the limiting. A uniform field has no strain and no stress between the two filter widths, so the Germano identity has nothing to fit and the coefficient must come out exactly zero.
Definition at line 760 of file test_les.c.
|
static |
Tests the dynamic procedure end to end on a periodic sheared field.
Runs the full procedure on a block that is periodic in all three directions, where the strain precompute has to reach across the wrap correctly, and asks for global averaging. Two things must hold: every cell receives the same finite coefficient, because a global average is one number for the block; and the coefficient stays inside the configured ceiling.
Definition at line 816 of file test_les.c.
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Entry point for the LES closure suite.
Definition at line 880 of file test_les.c.