Skip to content

feat(cfd): vorticity standard deviation (variance identity)#419

Merged
nochallenge merged 1 commit into
masterfrom
feat/cfd-vorticity-std-dev
Jun 8, 2026
Merged

feat(cfd): vorticity standard deviation (variance identity)#419
nochallenge merged 1 commit into
masterfrom
feat/cfd-vorticity-std-dev

Conversation

@nochallenge

Copy link
Copy Markdown
Owner

What

Adds FlowSolution::vorticity_std_dev() — the standard deviation of the interior vorticity:

// sigma_omega = sqrt( <(omega - <omega>)^2> )   (1/s)

Why

The vorticity statistics had mean_vorticity (#400) and rms_vorticity (#406) but no standard deviation. sigma_omega completes the mean / rms / std triad — mirroring the pressure family's mean / std_dev (#388) / rms (#394) — and satisfies the variance identity sigma^2 = omega_rms^2 - <omega>^2. It is 0 exactly for a spatially uniform vorticity and grows as the swirl becomes more non-uniform. Mirrors pressure_std_dev's deviation-sum form (mean via mean_vorticity, then sum (omega - mean)^2); returns 0 for a grid too small (nx < 3 or ny < 3).

Test

vorticity_std_dev_completes_the_variance_identity:

  • (a) uniform shearu(y)=gamma*y has constant omega = -gamma -> sigma = 0;
  • (b) quadratic shearu(y)=a*y^2 has omega = -2a*y varying in space -> sigma > 0, and the variance identity sigma = sqrt(omega_rms^2 - <omega>^2) threads mean_vorticity + rms_vorticity (three separate loops, non-tautological);
  • (c) small grid — too small for an interior difference -> 0.

Pure method on FlowSolution, no lib.rs change. valenx-cfd-native 124 lib tests (was 123); cargo clippy -p valenx-cfd-native --all-targets -- -D warnings clean. Research-grade post-processing reducer.

Add FlowSolution::vorticity_std_dev(), the standard deviation of the
interior vorticity:

  sigma_omega = sqrt( <(omega - <omega>)^2> )   (1/s)

the spatial fluctuation of the central-difference vorticity about its
area-average, completing the mean / rms / std vorticity-statistics triad
(mean_vorticity #400, rms_vorticity #406). By the variance identity it
satisfies sigma^2 = omega_rms^2 - <omega>^2. Mirrors pressure_std_dev's
deviation-sum form (mean via mean_vorticity, then sum (omega-mean)^2);
returns 0 for a grid too small (nx < 3 or ny < 3).

Analytic test vorticity_std_dev_completes_the_variance_identity:
(a) uniform shear u(y)=gamma*y has constant omega = -gamma -> sigma = 0;
(b) quadratic shear u(y)=a*y^2 has omega = -2a*y varying in space ->
    sigma > 0, and the variance identity sigma = sqrt(omega_rms^2 -
    <omega>^2) threads mean_vorticity + rms_vorticity (three separate
    loops, non-tautological);
(c) grid too small for an interior difference -> 0.

Pure method on FlowSolution, no lib.rs change. cfd-native 124 lib tests
(was 123), cargo clippy --all-targets -D warnings clean.
@nochallenge nochallenge merged commit cd7fb9f into master Jun 8, 2026
@nochallenge nochallenge deleted the feat/cfd-vorticity-std-dev branch June 8, 2026 21:01
nochallenge added a commit that referenced this pull request Jun 8, 2026
Add beam::circular_polar_second_moment_of_area(diameter), the polar second
moment of a solid round shaft about its longitudinal axis:

  J = pi * d^4 / 32   (m^4)

the torsion constant of a round bar -- the J that feeds polar_section_modulus
(Z_p = J/(d/2)) and torsional_rigidity (GJ), neither of which previously had
a way to compute J for a circle. By the perpendicular-axis theorem it is
exactly twice the bending circular_second_moment_of_area (J = Ix + Iy = 2*I,
since Ix = Iy for a circle). Guard mirrors the bending companion.

Analytic test circular_polar_second_moment_of_area_is_pi_d4_over_32:
(a) worked d=0.1 -> J = pi*0.1^4/32 ~= 9.8175e-6 m^4;
(b) threads circular_second_moment_of_area (#419) (non-tautological,
    perpendicular-axis theorem): J = 2*I;
(c) threads polar_section_modulus: Z_p = J/(d/2) = pi*d^3/16;
(d) threads torsional_rigidity (#410): GJ of a steel shaft;
(e) quartic in diameter;
(f) 0-sentinel guards for non-positive d and non-finite input.

Re-exported from lib.rs alphabetically in the beam block. valenx-fem 261
lib tests (was 260), cargo clippy --all-targets -D warnings clean.
nochallenge added a commit that referenced this pull request Jun 8, 2026
Add beam::circular_plastic_section_modulus(diameter), the plastic section
modulus of a solid round section:

  Z = d^3 / 6   (m^3)

the section property for fully-plastic limit bending of a shaft
(M_plastic = sigma_y * Z) -- the circular companion to
rectangular_plastic_section_modulus (#426). For a solid circle the shape
factor is Z/S = 16/(3*pi) ~= 1.698 (Z = d^3/6 vs the elastic S = pi*d^3/32).
Guard mirrors circular_second_moment_of_area.

Analytic test circular_plastic_section_modulus_is_d3_over_6:
(a) worked d=0.1 -> Z = 1.6667e-4 m^3;
(b) threads elastic_section_modulus + circular_second_moment_of_area
    (#419) (non-tautological): Z = (16/3pi)*S and the shape factor
    Z/S = 16/(3pi);
(c) cubic in diameter;
(d) 0-sentinel guards for non-positive d and non-finite input.

Re-exported from lib.rs alphabetically in the beam block. valenx-fem 263
lib tests (was 262), cargo clippy --all-targets -D warnings clean.
nochallenge added a commit that referenced this pull request Jun 9, 2026
…442)

Add beam::hollow_circular_second_moment_of_area(outer_diameter,
inner_diameter), the bending second moment of a tube/pipe cross-section:

  I = pi * (D^4 - d^4) / 64   (m^4)

the annulus = outer disc minus inner disc -- the I of structural tubing,
far stiffer per unit weight than a solid bar since the removed core carries
little bending stress. Guard: D > 0, 0 <= d < D, finite.

Analytic test hollow_circular_second_moment_of_area_is_pi_d4_minus_d4_over_64:
(a) worked D=0.1, d=0.05 -> I ~= 4.6019e-6 m^4;
(b) threads circular_second_moment_of_area (#419) (non-tautological): the
    annulus is I(D) - I(d);
(c) solid limit: a zero bore is a solid circle;
(d) monotonicity: a larger bore removes more material so I drops;
(e) 0-sentinel guards for D<=0, d>=D, non-finite, negative bore.

Re-exported from lib.rs alphabetically in the beam block. valenx-fem 265
lib tests (was 264), cargo clippy --all-targets -D warnings clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant