feat(cfd): vorticity standard deviation (variance identity)#419
Merged
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) andrms_vorticity(#406) but no standard deviation.sigma_omegacompletes the mean / rms / std triad — mirroring the pressure family'smean/std_dev(#388) /rms(#394) — and satisfies the variance identitysigma^2 = omega_rms^2 - <omega>^2. It is0exactly for a spatially uniform vorticity and grows as the swirl becomes more non-uniform. Mirrorspressure_std_dev's deviation-sum form (mean viamean_vorticity, then sum(omega - mean)^2); returns0for a grid too small (nx < 3orny < 3).Test
vorticity_std_dev_completes_the_variance_identity:u(y)=gamma*yhas constantomega = -gamma->sigma = 0;u(y)=a*y^2hasomega = -2a*yvarying in space ->sigma > 0, and the variance identitysigma = sqrt(omega_rms^2 - <omega>^2)threadsmean_vorticity+rms_vorticity(three separate loops, non-tautological);0.Pure method on
FlowSolution, nolib.rschange.valenx-cfd-native124 lib tests (was 123);cargo clippy -p valenx-cfd-native --all-targets -- -D warningsclean. Research-grade post-processing reducer.