Navier–Stokes: the Lean blow-up proof, cleaned up together
OpenAI's 2026 Lean proofs of blowup for forced Navier–Stokes and Euler, rerun by others, not refereed, no ruling from Clay; cleaned up together: more readable, faster to build

| 1 | import NavierStokes.CylindricalResidual |
| 2 | import NavierStokes.TransportPrimitive |
| 3 | |
| 4 | /-! |
| 5 | # Exact angularly averaged Navier--Stokes balances |
| 6 | |
| 7 | The average is a normalized actual interval integral. All coordinate derivatives |
| 8 | are Fréchet derivatives on spacetime, and the Reynolds products include the |
| 9 | entire oscillatory velocity. |
| 10 | -/ |
| 11 | |
| 12 | namespace NavierStokes.MeanResidual |
| 13 | |
| 14 | noncomputable section |
| 15 | |
| 16 | open ProblemStatement Set Filter MeasureTheory |
| 17 | open AxisymmetricFields (projection) |
| 18 | open AxisymmetricResidual (pack pack_zero pack_one pack_two) |
| 19 | open scoped ContDiff Topology Interval |
| 20 | |
| 21 | abbrev Scalar := SpaceTime → ℝ |
| 22 | abbrev Components := Fin 3 → Scalar |
| 23 | |
| 24 | noncomputable def period : ℝ := 2 * Real.pi |
| 25 | noncomputable def angularVector : SpaceTime := (0, coordinateVector 1) |
| 26 | noncomputable def angularShift (q : SpaceTime) (a : ℝ) : SpaceTime := q + a • angularVector |
| 27 | noncomputable def radius (q : SpaceTime) : ℝ := q.2 0 |
| 28 | |
| 29 | theorem period_pos : 0 < period := mul_pos (by norm_num) Real.pi_pos |
| 30 | theorem period_ne_zero : period ≠ 0 := ne_of_gt period_pos |
| 31 | |
| 32 | @[simp] theorem angularShift_zero (q : SpaceTime) : angularShift q 0 = q := by |
| 33 | simp [angularShift] |
| 34 | |
| 35 | @[simp] theorem radius_angularShift (q : SpaceTime) (a : ℝ) : |
| 36 | radius (angularShift q a) = radius q := by |
| 37 | simp [radius, angularShift, angularVector, coordinateVector] |
| 38 | |
| 39 | variable {E F : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 40 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 41 | |
| 42 | noncomputable def direction (v : SpaceTime) (f : SpaceTime → E) (q : SpaceTime) : E := |
| 43 | fderiv ℝ f q v |
| 44 | |
| 45 | noncomputable def dt (f : SpaceTime → E) := direction (1, 0) f |
| 46 | noncomputable def dr (f : SpaceTime → E) := direction (0, coordinateVector 0) f |
| 47 | noncomputable def dtheta (f : SpaceTime → E) := direction angularVector f |
| 48 | noncomputable def dz (f : SpaceTime → E) := direction (0, coordinateVector 2) f |
| 49 | |
| 50 | noncomputable def average (f : SpaceTime → E) (q : SpaceTime) : E := |
| 51 | period⁻¹ • ∫ a in (0 : ℝ)..period, f (angularShift q a) |
| 52 | |
| 53 | def AngularContinuous (f : SpaceTime → E) : Prop := |
| 54 | ∀ q, Continuous (fun a => f (angularShift q a)) |
| 55 | |
| 56 | def AngularPeriodic (f : SpaceTime → E) : Prop := |
| 57 | ∀ q, f (angularShift q period) = f q |
| 58 | |
| 59 | def AngularInvariant (f : SpaceTime → E) : Prop := |
| 60 | ∀ q a, f (angularShift q a) = f q |
| 61 | |
| 62 | theorem contDiff_angularShift : |
| 63 | ContDiff ℝ ∞ (fun qa : SpaceTime × ℝ => angularShift qa.1 qa.2) := |
| 64 | contDiff_fst.add (contDiff_snd.smul contDiff_const) |
| 65 | |
| 66 | theorem direction_smooth (v : SpaceTime) {f : SpaceTime → E} (hf : ContDiff ℝ ∞ f) : |
| 67 | ContDiff ℝ ∞ (direction v f) := |
| 68 | (hf.fderiv_right (by simp)).clm_apply contDiff_const |
| 69 | |
| 70 | @[fun_prop] theorem direction_continuous (v : SpaceTime) {f : SpaceTime → E} |
| 71 | (hf : ContDiff ℝ ∞ f) : Continuous (direction v f) := (direction_smooth v hf).continuous |
| 72 | |
| 73 | @[fun_prop] theorem continuous_angularShift (q : SpaceTime) : Continuous (angularShift q) := |
| 74 | continuous_const.add (continuous_id.smul continuous_const) |
| 75 | |
| 76 | omit [NormedSpace ℝ E] in |
| 77 | theorem angularContinuous_of_continuous {f : SpaceTime → E} (hf : Continuous f) : |
| 78 | AngularContinuous f := by |
| 79 | intro q |
| 80 | exact hf.comp (continuous_const.add (continuous_id.smul continuous_const)) |
| 81 | |
| 82 | omit [NormedSpace ℝ E] in |
| 83 | theorem AngularContinuous.add {f g : SpaceTime → E} |
| 84 | (hf : AngularContinuous f) (hg : AngularContinuous g) : |
| 85 | AngularContinuous (fun q => f q + g q) := fun q => (hf q).add (hg q) |
| 86 | |
| 87 | omit [NormedSpace ℝ E] in |
| 88 | theorem AngularContinuous.sub {f g : SpaceTime → E} |
| 89 | (hf : AngularContinuous f) (hg : AngularContinuous g) : |
| 90 | AngularContinuous (fun q => f q - g q) := fun q => (hf q).sub (hg q) |
| 91 | |
| 92 | theorem AngularContinuous.mul {f g : Scalar} |
| 93 | (hf : AngularContinuous f) (hg : AngularContinuous g) : |
| 94 | AngularContinuous (fun q => f q * g q) := fun q => (hf q).mul (hg q) |
| 95 | |
| 96 | theorem AngularContinuous.div_radius {f : Scalar} (hf : AngularContinuous f) (n : ℕ) : |
| 97 | AngularContinuous (fun q => f q / radius q ^ n) := by |
| 98 | intro q |
| 99 | simpa only [radius_angularShift] using (hf q).div_const (radius q ^ n) |
| 100 | |
| 101 | theorem AngularContinuous.const_mul {f : Scalar} (hf : AngularContinuous f) (c : ℝ) : |
| 102 | AngularContinuous (fun q => c * f q) := fun q => continuous_const.mul (hf q) |
| 103 | |
| 104 | omit [NormedSpace ℝ E] in |
| 105 | theorem AngularInvariant.angularContinuous {f : SpaceTime → E} (hf : AngularInvariant f) : |
| 106 | AngularContinuous f := by |
| 107 | intro q |
| 108 | change ∀ q a, f (angularShift q a) = f q at hf |
| 109 | simpa only [hf] using (continuous_const : Continuous (fun _ : ℝ => f q)) |
| 110 | |
| 111 | theorem average_add {f g : SpaceTime → E} (hf : AngularContinuous f) |
| 112 | (hg : AngularContinuous g) (q : SpaceTime) : |
| 113 | average (fun y => f y + g y) q = average f q + average g q := by |
| 114 | unfold average |
| 115 | rw [intervalIntegral.integral_add ((hf q).intervalIntegrable _ _) |
| 116 | ((hg q).intervalIntegrable _ _), smul_add] |
| 117 | |
| 118 | theorem average_sub {f g : SpaceTime → E} (hf : AngularContinuous f) |
| 119 | (hg : AngularContinuous g) (q : SpaceTime) : |
| 120 | average (fun y => f y - g y) q = average f q - average g q := by |
| 121 | unfold average |
| 122 | rw [intervalIntegral.integral_sub ((hf q).intervalIntegrable _ _) |
| 123 | ((hg q).intervalIntegrable _ _), smul_sub] |
| 124 | |
| 125 | theorem average_invariant [CompleteSpace E] {f : SpaceTime → E} |
| 126 | (hf : AngularInvariant f) (q : SpaceTime) : |
| 127 | average f q = f q := by |
| 128 | change ∀ q a, f (angularShift q a) = f q at hf |
| 129 | simp only [average, hf, intervalIntegral.integral_const, sub_zero, smul_smul, |
| 130 | inv_mul_cancel₀ period_ne_zero, one_smul] |
| 131 | |
| 132 | theorem average_mul_invariant {a f : Scalar} (ha : AngularInvariant a) (q : SpaceTime) : |
| 133 | average (fun y => a y * f y) q = a q * average f q := by |
| 134 | change ∀ q θ, a (angularShift q θ) = a q at ha |
| 135 | simp only [average, ha, intervalIntegral.integral_const_mul, smul_eq_mul] |
| 136 | ring |
| 137 | |
| 138 | theorem average_div_radius (f : Scalar) (q : SpaceTime) (n : ℕ) : |
| 139 | average (fun y => f y / radius y ^ n) q = average f q / radius q ^ n := by |
| 140 | simp only [average, radius_angularShift, intervalIntegral.integral_div, smul_eq_mul] |
| 141 | ring |
| 142 | |
| 143 | theorem average_div_r (f : Scalar) (q : SpaceTime) : |
| 144 | average (fun y => f y / radius y) q = average f q / radius q := by |
| 145 | simpa only [pow_one] using average_div_radius f q 1 |
| 146 | |
| 147 | theorem average_const_mul (c : ℝ) (f : Scalar) (q : SpaceTime) : |
| 148 | average (fun y => c * f y) q = c * average f q := |
| 149 | average_mul_invariant (fun _ _ => rfl) q |
| 150 | |
| 151 | theorem average_congr {f g : SpaceTime → E} {q : SpaceTime} |
| 152 | (h : ∀ a ∈ uIcc (0 : ℝ) period, f (angularShift q a) = g (angularShift q a)) : |
| 153 | average f q = average g q := by |
| 154 | unfold average |
| 155 | congr 1 |
| 156 | exact intervalIntegral.integral_congr h |
| 157 | |
| 158 | theorem average_smooth [CompleteSpace E] {f : SpaceTime → E} (hf : ContDiff ℝ ∞ f) : |
| 159 | ContDiff ℝ ∞ (average f) := |
| 160 | (TransportPrimitive.parameterIntegral_contDiff (hf.comp contDiff_angularShift) |
| 161 | 0 period).const_smul _ |
| 162 | |
| 163 | /-- Differentiation under the actual compact angular integral. -/ |
| 164 | theorem direction_average [CompleteSpace E] {f : SpaceTime → E} |
| 165 | (hf : ContDiff ℝ ∞ f) (v q : SpaceTime) : |
| 166 | direction v (average f) q = average (direction v f) q := by |
| 167 | let g : SpaceTime × ℝ → E := fun qa => f (angularShift qa.1 qa.2) |
| 168 | have hg : ContDiff ℝ ∞ g := hf.comp contDiff_angularShift |
| 169 | have hI := TransportPrimitive.parameterIntegral_hasFDerivAt hg 0 period q |
| 170 | unfold direction average |
| 171 | rw [(hI.fun_const_smul (period⁻¹)).fderiv] |
| 172 | simp only [_root_.smul_apply] |
| 173 | congr 1 |
| 174 | rw [ContinuousLinearMap.intervalIntegral_apply] |
| 175 | · apply intervalIntegral.integral_congr |
| 176 | intro a _ |
| 177 | have hchain : HasFDerivAt (fun x => f (angularShift x a)) |
| 178 | (fderiv ℝ f (angularShift q a)) q := by |
| 179 | simpa only [angularShift, Function.comp_def, id_eq, ContinuousLinearMap.comp_id] using |
| 180 | ((hf.differentiable (by simp)) (angularShift q a)).hasFDerivAt.comp q |
| 181 | ((hasFDerivAt_id q).add_const (a • angularVector)) |
| 182 | exact congrArg (fun L : SpaceTime →L[ℝ] E => L v) |
| 183 | ((TransportPrimitive.parameter_hasFDerivAt hg q a).unique hchain) |
| 184 | · exact ((TransportPrimitive.parameterDerivative_contDiff hg).continuous.comp |
| 185 | (continuous_const.prodMk continuous_id)).intervalIntegrable _ _ |
| 186 | |
| 187 | theorem AngularPeriodic.direction {f : SpaceTime → E} (hp : AngularPeriodic f) |
| 188 | (v : SpaceTime) : AngularPeriodic (direction v f) := by |
| 189 | intro q |
| 190 | have he : (fun x => f (x + period • angularVector)) = f := funext hp |
| 191 | have hd := congrArg (fun F => fderiv ℝ F q) he |
| 192 | rw [fderiv_comp_add_right] at hd |
| 193 | exact congrArg (fun L : SpaceTime →L[ℝ] E => L v) hd |
| 194 | |
| 195 | theorem AngularInvariant.direction {f : SpaceTime → E} (hp : AngularInvariant f) |
| 196 | (v : SpaceTime) : AngularInvariant (direction v f) := by |
| 197 | intro q a |
| 198 | have he : (fun x => f (x + a • angularVector)) = f := funext (fun x => hp x a) |
| 199 | have hd := congrArg (fun F => fderiv ℝ F q) he |
| 200 | rw [fderiv_comp_add_right] at hd |
| 201 | exact congrArg (fun L : SpaceTime →L[ℝ] E => L v) hd |
| 202 | |
| 203 | theorem AngularPeriodic.mul {f g : Scalar} (hf : AngularPeriodic f) (hg : AngularPeriodic g) : |
| 204 | AngularPeriodic (fun q => f q * g q) := by |
| 205 | intro q |
| 206 | change f (angularShift q period) * g (angularShift q period) = f q * g q |
| 207 | rw [hf q, hg q] |
| 208 | |
| 209 | /-- A full angular derivative has exactly zero average, by the fundamental theorem. -/ |
| 210 | theorem average_dtheta_zero [CompleteSpace E] {f : SpaceTime → E} |
| 211 | (hf : ContDiff ℝ ∞ f) (hp : AngularPeriodic f) (q : SpaceTime) : |
| 212 | average (dtheta f) q = 0 := by |
| 213 | have hd : ∀ a : ℝ, HasDerivAt (fun b => f (angularShift q b)) |
| 214 | (dtheta f (angularShift q a)) a := by |
| 215 | intro a |
| 216 | have hs : HasDerivAt (fun b : ℝ => angularShift q b) angularVector a := by |
| 217 | simpa [angularShift] using ((hasDerivAt_id a).smul_const angularVector).const_add q |
| 218 | exact ((hf.differentiable (by simp)) (angularShift q a)).hasFDerivAt.comp_hasDerivAt a hs |
| 219 | have hc : AngularContinuous (dtheta f) := |
| 220 | angularContinuous_of_continuous (direction_smooth angularVector hf).continuous |
| 221 | have hi := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun a _ => hd a) |
| 222 | ((hc q).intervalIntegrable 0 period) |
| 223 | rw [hp, angularShift_zero, sub_self] at hi |
| 224 | simp only [average, hi, smul_zero] |
| 225 | |
| 226 | theorem direction_add {f g : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 227 | (hg : ContDiff ℝ ∞ g) (v q : SpaceTime) : |
| 228 | direction v (fun y => f y + g y) q = direction v f q + direction v g q := by |
| 229 | unfold direction |
| 230 | rw [fderiv_fun_add (hf.differentiable (by simp) q) (hg.differentiable (by simp) q)] |
| 231 | rfl |
| 232 | |
| 233 | theorem direction_mul {f g : Scalar} (hf : ContDiff ℝ ∞ f) |
| 234 | (hg : ContDiff ℝ ∞ g) (v q : SpaceTime) : |
| 235 | direction v (fun y => f y * g y) q = direction v f q * g q + f q * direction v g q := by |
| 236 | unfold direction |
| 237 | rw [fderiv_fun_mul (hf.differentiable (by simp) q) (hg.differentiable (by simp) q)] |
| 238 | simp |
| 239 | ring |
| 240 | |
| 241 | theorem spatial_direction {f : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 242 | (t : ℝ) (x : Space) (i : Fin 3) : |
| 243 | CylindricalResidual.dCoord i (fun y => f (t, y)) x = |
| 244 | direction (0, coordinateVector i) f (t, x) := by |
| 245 | have h := (hf.differentiable (by simp) (t, x)).hasFDerivAt.comp x |
| 246 | ((hasFDerivAt_const t x).prodMk (hasFDerivAt_id x)) |
| 247 | change (fderiv ℝ (f ∘ fun y => (t, y)) x) _ = _ |
| 248 | rw [h.fderiv] |
| 249 | rfl |
| 250 | |
| 251 | theorem spatial_second {f : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 252 | (t : ℝ) (x : Space) (i : Fin 3) : |
| 253 | CylindricalResidual.dCoord i (CylindricalResidual.dCoord i (fun y => f (t, y))) x = |
| 254 | direction (0, coordinateVector i) (direction (0, coordinateVector i) f) (t, x) := by |
| 255 | rw [show CylindricalResidual.dCoord i (fun y => f (t, y)) = |
| 256 | fun y => direction (0, coordinateVector i) f (t, y) from |
| 257 | funext (fun y => spatial_direction hf t y i)] |
| 258 | exact spatial_direction (direction_smooth _ hf) t x i |
| 259 | |
| 260 | theorem temporal_direction {f : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 261 | (t : ℝ) (x : Space) : |
| 262 | fderiv ℝ (fun s => f (s, x)) t 1 = dt f (t, x) := by |
| 263 | have h := (hf.differentiable (by simp) (t, x)).hasFDerivAt.comp t |
| 264 | ((hasFDerivAt_id (𝕜 := ℝ) t).prodMk (hasFDerivAt_const (𝕜 := ℝ) x t)) |
| 265 | change (fderiv ℝ (f ∘ fun s => (id s, x)) t) 1 = _ |
| 266 | rw [h.fderiv] |
| 267 | rfl |
| 268 | |
| 269 | noncomputable def velocity (w : Components) : VelocityField := |
| 270 | fun q => pack (w 0 q) (w 1 q) (w 2 q) |
| 271 | |
| 272 | @[simp] theorem velocity_apply (w : Components) (q : SpaceTime) (i : Fin 3) : |
| 273 | velocity w q i = w i q := by |
| 274 | fin_cases i <;> simp [velocity] |
| 275 | |
| 276 | theorem velocity_smooth {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) : |
| 277 | ContDiff ℝ ∞ (velocity w) := |
| 278 | (((hw 0).smul contDiff_const).add ((hw 1).smul contDiff_const)).add |
| 279 | ((hw 2).smul contDiff_const) |
| 280 | |
| 281 | theorem direction_velocity {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 282 | (v q : SpaceTime) : direction v (velocity w) q = |
| 283 | pack (direction v (w 0) q) (direction v (w 1) q) (direction v (w 2) q) := by |
| 284 | exact AxisymmetricResidual.fderiv_pack_apply |
| 285 | ((hw 0).differentiable (by simp) q) ((hw 1).differentiable (by simp) q) |
| 286 | ((hw 2).differentiable (by simp) q) v |
| 287 | |
| 288 | theorem direction_velocity_component {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 289 | (v q : SpaceTime) (i : Fin 3) : direction v (velocity w) q i = direction v (w i) q := by |
| 290 | rw [direction_velocity hw] |
| 291 | fin_cases i <;> simp |
| 292 | |
| 293 | noncomputable def laplacian (f : Scalar) (q : SpaceTime) : ℝ := |
| 294 | dr (dr f) q + dr f q / radius q + dtheta (dtheta f) q / radius q ^ 2 + dz (dz f) q |
| 295 | |
| 296 | noncomputable def meanLaplacian (f : Scalar) (q : SpaceTime) : ℝ := |
| 297 | dr (dr f) q + dr f q / radius q + dz (dz f) q |
| 298 | |
| 299 | noncomputable def radialDivergence (c : ℝ) (f : Scalar) (q : SpaceTime) : ℝ := |
| 300 | dr f q + c / radius q * f q |
| 301 | |
| 302 | noncomputable def divergence (w : Components) (q : SpaceTime) : ℝ := |
| 303 | dr (w 0) q + w 0 q / radius q + dtheta (w 1) q / radius q + dz (w 2) q |
| 304 | |
| 305 | noncomputable def transport (w : Components) (f : Scalar) (q : SpaceTime) : ℝ := |
| 306 | w 0 q * dr f q + w 1 q / radius q * dtheta f q + w 2 q * dz f q |
| 307 | |
| 308 | noncomputable def residualRadial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 309 | dt (w 0) q + transport w (w 0) q - (w 1 q) ^ 2 / radius q - laplacian (w 0) q + |
| 310 | w 0 q / radius q ^ 2 + 2 * dtheta (w 1) q / radius q ^ 2 + dr p q |
| 311 | |
| 312 | noncomputable def residualAngular (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 313 | dt (w 1) q + transport w (w 1) q + w 0 q * w 1 q / radius q - laplacian (w 1) q + |
| 314 | w 1 q / radius q ^ 2 - 2 * dtheta (w 0) q / radius q ^ 2 + dtheta p q / radius q |
| 315 | |
| 316 | noncomputable def residualAxial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 317 | dt (w 2) q + transport w (w 2) q - laplacian (w 2) q + dz p q |
| 318 | |
| 319 | theorem scalarLaplacian_eq {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 320 | CylindricalResidual.scalarLaplacian (fun y => f (q.1, y)) q.2 = laplacian f q := by |
| 321 | simp only [CylindricalResidual.scalarLaplacian, spatial_second hf, spatial_direction hf, |
| 322 | laplacian, dr, dtheta, dz, angularVector, radius, smul_eq_mul] |
| 323 | ring |
| 324 | |
| 325 | theorem scalarLaplacian_velocity {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 326 | (q : SpaceTime) (i : Fin 3) : |
| 327 | CylindricalResidual.scalarLaplacian (fun y => velocity w (q.1, y)) q.2 i = |
| 328 | laplacian (w i) q := by |
| 329 | have hv : ContDiff ℝ 2 (velocity w) := (velocity_smooth hw).of_le |
| 330 | (show (2 : WithTop ℕ∞) ≤ ∞ from WithTop.coe_le_coe.mpr le_top) |
| 331 | have hs : ContDiffAt ℝ 2 (fun y => velocity w (q.1, y)) q.2 := |
| 332 | (hv.comp (contDiff_const.prodMk contDiff_id)).contDiffAt |
| 333 | rw [← CylindricalResidual.scalarLaplacian_component hs i] |
| 334 | simpa only [velocity_apply] using scalarLaplacian_eq (hw i) q |
| 335 | |
| 336 | theorem cylindricalResidual_radial {w : Components} {p : Scalar} |
| 337 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) (q : SpaceTime) : |
| 338 | CylindricalResidual.cylindricalResidual (velocity w) p q.1 q.2 0 = |
| 339 | residualRadial w p q := by |
| 340 | change (temporalDerivative (velocity w) q.1 q.2) 0 + |
| 341 | CylindricalResidual.vectorAdvection (fun y => velocity w (q.1, y)) q.2 0 - |
| 342 | CylindricalResidual.vectorLaplacian (fun y => velocity w (q.1, y)) q.2 0 + |
| 343 | CylindricalResidual.scalarGradient (fun y => p (q.1, y)) q.2 0 = _ |
| 344 | rw [CylindricalResidual.vectorAdvection_radial, CylindricalResidual.vectorLaplacian_radial, |
| 345 | scalarLaplacian_velocity hw q 0] |
| 346 | simp only [temporalDerivative, temporal_direction (velocity_smooth hw), dt, |
| 347 | direction_velocity_component hw, spatial_direction (velocity_smooth hw), |
| 348 | velocity_apply, CylindricalResidual.scalarGradient, pack_zero, spatial_direction hp, |
| 349 | residualRadial, transport, dr, dtheta, dz, angularVector, radius] |
| 350 | ring |
| 351 | |
| 352 | theorem cylindricalResidual_angular {w : Components} {p : Scalar} |
| 353 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) (q : SpaceTime) : |
| 354 | CylindricalResidual.cylindricalResidual (velocity w) p q.1 q.2 1 = |
| 355 | residualAngular w p q := by |
| 356 | change (temporalDerivative (velocity w) q.1 q.2) 1 + |
| 357 | CylindricalResidual.vectorAdvection (fun y => velocity w (q.1, y)) q.2 1 - |
| 358 | CylindricalResidual.vectorLaplacian (fun y => velocity w (q.1, y)) q.2 1 + |
| 359 | CylindricalResidual.scalarGradient (fun y => p (q.1, y)) q.2 1 = _ |
| 360 | rw [CylindricalResidual.vectorAdvection_angular, CylindricalResidual.vectorLaplacian_angular, |
| 361 | scalarLaplacian_velocity hw q 1] |
| 362 | simp only [temporalDerivative, temporal_direction (velocity_smooth hw), dt, |
| 363 | direction_velocity_component hw, spatial_direction (velocity_smooth hw), |
| 364 | velocity_apply, CylindricalResidual.scalarGradient, pack_one, spatial_direction hp, |
| 365 | residualAngular, transport, dr, dtheta, dz, angularVector, radius] |
| 366 | ring |
| 367 | |
| 368 | theorem cylindricalResidual_axial {w : Components} {p : Scalar} |
| 369 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) (q : SpaceTime) : |
| 370 | CylindricalResidual.cylindricalResidual (velocity w) p q.1 q.2 2 = |
| 371 | residualAxial w p q := by |
| 372 | change (temporalDerivative (velocity w) q.1 q.2) 2 + |
| 373 | CylindricalResidual.vectorAdvection (fun y => velocity w (q.1, y)) q.2 2 - |
| 374 | CylindricalResidual.vectorLaplacian (fun y => velocity w (q.1, y)) q.2 2 + |
| 375 | CylindricalResidual.scalarGradient (fun y => p (q.1, y)) q.2 2 = _ |
| 376 | rw [CylindricalResidual.vectorAdvection_axial, CylindricalResidual.vectorLaplacian_axial, |
| 377 | scalarLaplacian_velocity hw q 2] |
| 378 | simp only [temporalDerivative, temporal_direction (velocity_smooth hw), dt, |
| 379 | direction_velocity_component hw, spatial_direction (velocity_smooth hw), |
| 380 | velocity_apply, CylindricalResidual.scalarGradient, pack_two, spatial_direction hp, |
| 381 | residualAxial, transport, dr, dtheta, dz, angularVector, radius] |
| 382 | |
| 383 | noncomputable def conservativeRadial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 384 | dt (w 0) q + radialDivergence 1 (fun y => w 0 y * w 0 y) q + |
| 385 | dtheta (fun y => w 1 y * w 0 y) q / radius q + |
| 386 | dz (fun y => w 2 y * w 0 y) q - (w 1 q * w 1 q) / radius q - laplacian (w 0) q + |
| 387 | w 0 q / radius q ^ 2 + 2 * dtheta (w 1) q / radius q ^ 2 + dr p q |
| 388 | |
| 389 | noncomputable def conservativeAngular (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 390 | dt (w 1) q + radialDivergence 2 (fun y => w 0 y * w 1 y) q + |
| 391 | dtheta (fun y => w 1 y * w 1 y) q / radius q + |
| 392 | dz (fun y => w 2 y * w 1 y) q - laplacian (w 1) q + |
| 393 | w 1 q / radius q ^ 2 - 2 * dtheta (w 0) q / radius q ^ 2 + dtheta p q / radius q |
| 394 | |
| 395 | noncomputable def conservativeAxial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 396 | dt (w 2) q + radialDivergence 1 (fun y => w 0 y * w 2 y) q + |
| 397 | dtheta (fun y => w 1 y * w 2 y) q / radius q + |
| 398 | dz (fun y => w 2 y * w 2 y) q - laplacian (w 2) q + dz p q |
| 399 | |
| 400 | theorem conservativeRadial_eq {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 401 | (p : Scalar) (q : SpaceTime) : |
| 402 | conservativeRadial w p q = residualRadial w p q + w 0 q * divergence w q := by |
| 403 | simp only [conservativeRadial, residualRadial, radialDivergence, transport, divergence, |
| 404 | dr, dtheta, dz, direction_mul (hw 0) (hw 0), direction_mul (hw 1) (hw 0), |
| 405 | direction_mul (hw 2) (hw 0)] |
| 406 | ring |
| 407 | |
| 408 | theorem conservativeAngular_eq {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 409 | (p : Scalar) (q : SpaceTime) : |
| 410 | conservativeAngular w p q = residualAngular w p q + w 1 q * divergence w q := by |
| 411 | simp only [conservativeAngular, residualAngular, radialDivergence, transport, divergence, |
| 412 | dr, dtheta, dz, direction_mul (hw 0) (hw 1), direction_mul (hw 1) (hw 1), |
| 413 | direction_mul (hw 2) (hw 1)] |
| 414 | ring |
| 415 | |
| 416 | theorem conservativeAxial_eq {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 417 | (p : Scalar) (q : SpaceTime) : |
| 418 | conservativeAxial w p q = residualAxial w p q + w 2 q * divergence w q := by |
| 419 | simp only [conservativeAxial, residualAxial, radialDivergence, transport, divergence, |
| 420 | dr, dtheta, dz, direction_mul (hw 0) (hw 2), direction_mul (hw 1) (hw 2), |
| 421 | direction_mul (hw 2) (hw 2)] |
| 422 | ring |
| 423 | |
| 424 | omit [NormedAddCommGroup E] [NormedSpace ℝ E] in |
| 425 | theorem angularInvariant_radius (f : ℝ → E) : AngularInvariant (fun q => f (radius q)) := by |
| 426 | intro q a |
| 427 | exact congrArg f (radius_angularShift q a) |
| 428 | |
| 429 | theorem average_direction [CompleteSpace E] {f : SpaceTime → E} |
| 430 | (hf : ContDiff ℝ ∞ f) (v q : SpaceTime) : |
| 431 | average (direction v f) q = direction v (average f) q := (direction_average hf v q).symm |
| 432 | |
| 433 | theorem average_direction_twice [CompleteSpace E] {f : SpaceTime → E} |
| 434 | (hf : ContDiff ℝ ∞ f) (v w q : SpaceTime) : |
| 435 | average (direction v (direction w f)) q = direction v (direction w (average f)) q := by |
| 436 | rw [average_direction (direction_smooth w hf)] |
| 437 | rw [show average (direction w f) = direction w (average f) from |
| 438 | funext (average_direction hf w)] |
| 439 | |
| 440 | theorem average_dt {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 441 | average (dt f) q = dt (average f) q := average_direction hf _ q |
| 442 | |
| 443 | theorem average_dr {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 444 | average (dr f) q = dr (average f) q := average_direction hf _ q |
| 445 | |
| 446 | theorem average_dz {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 447 | average (dz f) q = dz (average f) q := average_direction hf _ q |
| 448 | |
| 449 | theorem average_drdr {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 450 | average (dr (dr f)) q = dr (dr (average f)) q := average_direction_twice hf _ _ q |
| 451 | |
| 452 | theorem average_dzdz {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 453 | average (dz (dz f)) q = dz (dz (average f)) q := average_direction_twice hf _ _ q |
| 454 | |
| 455 | theorem angularContinuous_direction {f : Scalar} (hf : ContDiff ℝ ∞ f) (v : SpaceTime) : |
| 456 | AngularContinuous (direction v f) := angularContinuous_of_continuous (direction_smooth v hf).continuous |
| 457 | |
| 458 | theorem AngularContinuous.div_r {f : Scalar} (hf : AngularContinuous f) : |
| 459 | AngularContinuous (fun q => f q / radius q) := by |
| 460 | simpa only [pow_one] using hf.div_radius 1 |
| 461 | |
| 462 | theorem angularContinuous_radialDivergence {f : Scalar} (hf : ContDiff ℝ ∞ f) (c : ℝ) : |
| 463 | AngularContinuous (radialDivergence c f) := |
| 464 | (angularContinuous_direction hf _).add |
| 465 | ((angularInvariant_radius (fun r => c / r)).angularContinuous.mul |
| 466 | (angularContinuous_of_continuous hf.continuous)) |
| 467 | |
| 468 | theorem angularContinuous_laplacian {f : Scalar} (hf : ContDiff ℝ ∞ f) : |
| 469 | AngularContinuous (laplacian f) := |
| 470 | (((angularContinuous_direction (direction_smooth _ hf) _).add |
| 471 | (angularContinuous_direction hf _).div_r).add |
| 472 | ((angularContinuous_direction (direction_smooth _ hf) _).div_radius 2)).add |
| 473 | (angularContinuous_direction (direction_smooth _ hf) _) |
| 474 | |
| 475 | theorem average_radialDivergence {f : Scalar} (hf : ContDiff ℝ ∞ f) |
| 476 | (c : ℝ) (q : SpaceTime) : |
| 477 | average (radialDivergence c f) q = radialDivergence c (average f) q := by |
| 478 | have hr : AngularContinuous (dr f) := angularContinuous_of_continuous |
| 479 | (direction_smooth _ hf).continuous |
| 480 | have hc : AngularInvariant (fun y => c / radius y) := angularInvariant_radius _ |
| 481 | have hcf := hc.angularContinuous.mul (angularContinuous_of_continuous hf.continuous) |
| 482 | unfold radialDivergence |
| 483 | rw [average_add hr hcf, average_mul_invariant hc, average_dr hf] |
| 484 | |
| 485 | theorem average_laplacian {f : Scalar} (hf : ContDiff ℝ ∞ f) (hp : AngularPeriodic f) |
| 486 | (q : SpaceTime) : average (laplacian f) q = meanLaplacian (average f) q := by |
| 487 | have hrr : AngularContinuous (dr (dr f)) := angularContinuous_of_continuous |
| 488 | (direction_smooth _ (direction_smooth _ hf)).continuous |
| 489 | have hr : AngularContinuous (dr f) := angularContinuous_of_continuous |
| 490 | (direction_smooth _ hf).continuous |
| 491 | have haa : AngularContinuous (dtheta (dtheta f)) := angularContinuous_of_continuous |
| 492 | (direction_smooth _ (direction_smooth _ hf)).continuous |
| 493 | have hzz : AngularContinuous (dz (dz f)) := angularContinuous_of_continuous |
| 494 | (direction_smooth _ (direction_smooth _ hf)).continuous |
| 495 | have hrd : AngularContinuous (fun y => dr f y / radius y) := by |
| 496 | simpa only [pow_one] using hr.div_radius 1 |
| 497 | unfold laplacian meanLaplacian |
| 498 | rw [average_add ((hrr.add hrd).add (haa.div_radius 2)) hzz, |
| 499 | average_add (hrr.add hrd) (haa.div_radius 2), average_add hrr hrd] |
| 500 | rw [show (fun y => dr f y / radius y) = (fun y => dr f y / radius y ^ 1) by simp] |
| 501 | rw [average_div_radius, average_div_radius, average_drdr hf, |
| 502 | average_dr hf, average_dzdz hf, |
| 503 | average_dtheta_zero (f := dtheta f) (direction_smooth _ hf) (hp.direction angularVector)] |
| 504 | simp |
| 505 | |
| 506 | noncomputable def reynoldsRadial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 507 | dt (average (w 0)) q + radialDivergence 1 (average (fun y => w 0 y * w 0 y)) q + |
| 508 | dz (average (fun y => w 2 y * w 0 y)) q - average (fun y => w 1 y * w 1 y) q / radius q - |
| 509 | meanLaplacian (average (w 0)) q + average (w 0) q / radius q ^ 2 + dr (average p) q |
| 510 | |
| 511 | noncomputable def reynoldsAngular (w : Components) (q : SpaceTime) : ℝ := |
| 512 | dt (average (w 1)) q + radialDivergence 2 (average (fun y => w 0 y * w 1 y)) q + |
| 513 | dz (average (fun y => w 2 y * w 1 y)) q - meanLaplacian (average (w 1)) q + |
| 514 | average (w 1) q / radius q ^ 2 |
| 515 | |
| 516 | noncomputable def reynoldsAxial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 517 | dt (average (w 2)) q + radialDivergence 1 (average (fun y => w 0 y * w 2 y)) q + |
| 518 | dz (average (fun y => w 2 y * w 2 y)) q - meanLaplacian (average (w 2)) q + |
| 519 | dz (average p) q |
| 520 | |
| 521 | theorem average_conservativeAngular {w : Components} {p : Scalar} |
| 522 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 523 | (hwper : ∀ i, AngularPeriodic (w i)) (hpper : AngularPeriodic p) (q : SpaceTime) : |
| 524 | average (conservativeAngular w p) q = reynoldsAngular w q := by |
| 525 | have h1 : AngularContinuous (dt (w 1)) := angularContinuous_direction (hw 1) _ |
| 526 | have h2 := angularContinuous_radialDivergence ((hw 0).mul (hw 1)) 2 |
| 527 | have h3 : AngularContinuous (fun y => dtheta (fun y => w 1 y * w 1 y) y / radius y) := |
| 528 | (angularContinuous_direction ((hw 1).mul (hw 1)) _).div_r |
| 529 | have h4 : AngularContinuous (dz (fun y => w 2 y * w 1 y)) := |
| 530 | angularContinuous_direction ((hw 2).mul (hw 1)) _ |
| 531 | have h5 := angularContinuous_laplacian (hw 1) |
| 532 | have h6 := (angularContinuous_of_continuous (hw 1).continuous).div_radius 2 |
| 533 | have h7 : AngularContinuous (fun y => 2 * dtheta (w 0) y / radius y ^ 2) := |
| 534 | ((angularContinuous_direction (hw 0) _).const_mul 2).div_radius 2 |
| 535 | have h8 : AngularContinuous (fun y => dtheta p y / radius y) := |
| 536 | (angularContinuous_direction hp _).div_r |
| 537 | unfold conservativeAngular |
| 538 | simp (disch := solve_by_elim (maxDepth := 20) [AngularContinuous.add, AngularContinuous.sub]) |
| 539 | only [average_add, average_sub] |
| 540 | rw [average_radialDivergence ((hw 0).mul (hw 1)), |
| 541 | average_laplacian (hw 1) (hwper 1)] |
| 542 | rw [average_dt (hw 1), average_dz ((hw 2).mul (hw 1))] |
| 543 | rw [show (fun y => dtheta (fun y => w 1 y * w 1 y) y / radius y) = |
| 544 | (fun y => dtheta (fun y => w 1 y * w 1 y) y / radius y ^ 1) by simp] |
| 545 | rw [show (fun y => dtheta p y / radius y) = (fun y => dtheta p y / radius y ^ 1) by simp] |
| 546 | rw [average_div_radius, average_div_radius, average_div_radius, average_div_radius, |
| 547 | average_const_mul, average_dtheta_zero ((hw 1).mul (hw 1)) ((hwper 1).mul (hwper 1)), |
| 548 | average_dtheta_zero (hw 0) (hwper 0), average_dtheta_zero hp hpper] |
| 549 | simp [reynoldsAngular, dt, dz] |
| 550 | |
| 551 | theorem average_conservativeRadial {w : Components} {p : Scalar} |
| 552 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 553 | (hwper : ∀ i, AngularPeriodic (w i)) (q : SpaceTime) : |
| 554 | average (conservativeRadial w p) q = reynoldsRadial w p q := by |
| 555 | have h1 : AngularContinuous (dt (w 0)) := angularContinuous_direction (hw 0) _ |
| 556 | have h2 := angularContinuous_radialDivergence ((hw 0).mul (hw 0)) 1 |
| 557 | have h3 : AngularContinuous (fun y => dtheta (fun y => w 1 y * w 0 y) y / radius y) := |
| 558 | (angularContinuous_direction ((hw 1).mul (hw 0)) _).div_r |
| 559 | have h4 : AngularContinuous (dz (fun y => w 2 y * w 0 y)) := |
| 560 | angularContinuous_direction ((hw 2).mul (hw 0)) _ |
| 561 | have h5 := (angularContinuous_of_continuous ((hw 1).mul (hw 1)).continuous).div_r |
| 562 | have h6 := angularContinuous_laplacian (hw 0) |
| 563 | have h7 := (angularContinuous_of_continuous (hw 0).continuous).div_radius 2 |
| 564 | have h8 : AngularContinuous (fun y => 2 * dtheta (w 1) y / radius y ^ 2) := |
| 565 | ((angularContinuous_direction (hw 1) _).const_mul 2).div_radius 2 |
| 566 | have h9 : AngularContinuous (dr p) := angularContinuous_direction hp _ |
| 567 | unfold conservativeRadial |
| 568 | simp (disch := solve_by_elim (maxDepth := 20) [AngularContinuous.add, AngularContinuous.sub]) |
| 569 | only [average_add, average_sub] |
| 570 | rw [average_radialDivergence ((hw 0).mul (hw 0)), average_laplacian (hw 0) (hwper 0), |
| 571 | average_dt (hw 0), average_dz ((hw 2).mul (hw 0)), average_dr hp] |
| 572 | simp only [average_div_r, average_div_radius, average_const_mul, |
| 573 | average_dtheta_zero ((hw 1).mul (hw 0)) ((hwper 1).mul (hwper 0)), |
| 574 | average_dtheta_zero (hw 1) (hwper 1), zero_div, mul_zero, add_zero] |
| 575 | rfl |
| 576 | |
| 577 | theorem average_conservativeAxial {w : Components} {p : Scalar} |
| 578 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 579 | (hwper : ∀ i, AngularPeriodic (w i)) (q : SpaceTime) : |
| 580 | average (conservativeAxial w p) q = reynoldsAxial w p q := by |
| 581 | have h1 : AngularContinuous (dt (w 2)) := angularContinuous_direction (hw 2) _ |
| 582 | have h2 := angularContinuous_radialDivergence ((hw 0).mul (hw 2)) 1 |
| 583 | have h3 : AngularContinuous (fun y => dtheta (fun y => w 1 y * w 2 y) y / radius y) := |
| 584 | (angularContinuous_direction ((hw 1).mul (hw 2)) _).div_r |
| 585 | have h4 : AngularContinuous (dz (fun y => w 2 y * w 2 y)) := |
| 586 | angularContinuous_direction ((hw 2).mul (hw 2)) _ |
| 587 | have h5 := angularContinuous_laplacian (hw 2) |
| 588 | have h6 : AngularContinuous (dz p) := angularContinuous_direction hp _ |
| 589 | unfold conservativeAxial |
| 590 | simp (disch := solve_by_elim (maxDepth := 20) [AngularContinuous.add, AngularContinuous.sub]) |
| 591 | only [average_add, average_sub] |
| 592 | rw [average_radialDivergence ((hw 0).mul (hw 2)), average_laplacian (hw 2) (hwper 2), |
| 593 | average_dt (hw 2), average_dz ((hw 2).mul (hw 2)), average_dz hp] |
| 594 | simp only [average_div_r, |
| 595 | average_dtheta_zero ((hw 1).mul (hw 2)) ((hwper 1).mul (hwper 2)), zero_div, add_zero] |
| 596 | rfl |
| 597 | |
| 598 | theorem average_residualRadial {w : Components} {p : Scalar} |
| 599 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 600 | (hwper : ∀ i, AngularPeriodic (w i)) |
| 601 | (hdiv : ∀ y, 0 < radius y → divergence w y = 0) |
| 602 | (q : SpaceTime) (hr : 0 < radius q) : |
| 603 | average (residualRadial w p) q = reynoldsRadial w p q := by |
| 604 | have he : average (residualRadial w p) q = average (conservativeRadial w p) q := by |
| 605 | apply average_congr |
| 606 | intro a _ |
| 607 | have hd := hdiv (angularShift q a) (by simpa only [radius_angularShift] using hr) |
| 608 | simpa only [hd, mul_zero, add_zero] using (conservativeRadial_eq hw p (angularShift q a)).symm |
| 609 | rw [he, average_conservativeRadial hw hp hwper] |
| 610 | |
| 611 | theorem average_residualAngular {w : Components} {p : Scalar} |
| 612 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 613 | (hwper : ∀ i, AngularPeriodic (w i)) (hpper : AngularPeriodic p) |
| 614 | (hdiv : ∀ y, 0 < radius y → divergence w y = 0) |
| 615 | (q : SpaceTime) (hr : 0 < radius q) : |
| 616 | average (residualAngular w p) q = reynoldsAngular w q := by |
| 617 | have he : average (residualAngular w p) q = average (conservativeAngular w p) q := by |
| 618 | apply average_congr |
| 619 | intro a _ |
| 620 | have hd := hdiv (angularShift q a) (by simpa only [radius_angularShift] using hr) |
| 621 | simpa only [hd, mul_zero, add_zero] using (conservativeAngular_eq hw p (angularShift q a)).symm |
| 622 | rw [he, average_conservativeAngular hw hp hwper hpper] |
| 623 | |
| 624 | theorem average_residualAxial {w : Components} {p : Scalar} |
| 625 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 626 | (hwper : ∀ i, AngularPeriodic (w i)) |
| 627 | (hdiv : ∀ y, 0 < radius y → divergence w y = 0) |
| 628 | (q : SpaceTime) (hr : 0 < radius q) : |
| 629 | average (residualAxial w p) q = reynoldsAxial w p q := by |
| 630 | have he : average (residualAxial w p) q = average (conservativeAxial w p) q := by |
| 631 | apply average_congr |
| 632 | intro a _ |
| 633 | have hd := hdiv (angularShift q a) (by simpa only [radius_angularShift] using hr) |
| 634 | simpa only [hd, mul_zero, add_zero] using (conservativeAxial_eq hw p (angularShift q a)).symm |
| 635 | rw [he, average_conservativeAxial hw hp hwper] |
| 636 | |
| 637 | omit [NormedSpace ℝ E] in |
| 638 | theorem AngularInvariant.add {f g : SpaceTime → E} |
| 639 | (hf : AngularInvariant f) (hg : AngularInvariant g) : |
| 640 | AngularInvariant (fun q => f q + g q) := by |
| 641 | intro q a |
| 642 | exact congrArg₂ (· + ·) (hf q a) (hg q a) |
| 643 | |
| 644 | theorem AngularInvariant.mul {f g : Scalar} |
| 645 | (hf : AngularInvariant f) (hg : AngularInvariant g) : |
| 646 | AngularInvariant (fun q => f q * g q) := by |
| 647 | intro q a |
| 648 | exact congrArg₂ (· * ·) (hf q a) (hg q a) |
| 649 | |
| 650 | omit [NormedSpace ℝ E] in |
| 651 | theorem AngularPeriodic.add {f g : SpaceTime → E} |
| 652 | (hf : AngularPeriodic f) (hg : AngularPeriodic g) : |
| 653 | AngularPeriodic (fun q => f q + g q) := by |
| 654 | intro q |
| 655 | exact congrArg₂ (· + ·) (hf q) (hg q) |
| 656 | |
| 657 | /-- The complete velocity split, with no omission of any part of `osc`. -/ |
| 658 | noncomputable def total (base mean osc : Components) : Components := |
| 659 | fun i q => base i q + mean i q + osc i q |
| 660 | |
| 661 | /-- The exact Reynolds product of the full oscillatory fields. -/ |
| 662 | noncomputable def covariance (osc : Components) (i j : Fin 3) : Scalar := |
| 663 | average (fun q => osc i q * osc j q) |
| 664 | |
| 665 | noncomputable def fluxDifference (base mean osc : Components) (i j : Fin 3) : Scalar := |
| 666 | fun q => base i q * mean j q + mean i q * base j q + |
| 667 | mean i q * mean j q + covariance osc i j q |
| 668 | |
| 669 | theorem covariance_smooth {osc : Components} (ho : ∀ i, ContDiff ℝ ∞ (osc i)) (i j : Fin 3) : |
| 670 | ContDiff ℝ ∞ (covariance osc i j) := average_smooth ((ho i).mul (ho j)) |
| 671 | |
| 672 | theorem total_smooth {base mean osc : Components} |
| 673 | (hb : ∀ i, ContDiff ℝ ∞ (base i)) (hm : ∀ i, ContDiff ℝ ∞ (mean i)) |
| 674 | (ho : ∀ i, ContDiff ℝ ∞ (osc i)) (i : Fin 3) : |
| 675 | ContDiff ℝ ∞ (total base mean osc i) := ((hb i).add (hm i)).add (ho i) |
| 676 | |
| 677 | theorem fluxDifference_smooth {base mean osc : Components} |
| 678 | (hb : ∀ i, ContDiff ℝ ∞ (base i)) (hm : ∀ i, ContDiff ℝ ∞ (mean i)) |
| 679 | (ho : ∀ i, ContDiff ℝ ∞ (osc i)) (i j : Fin 3) : |
| 680 | ContDiff ℝ ∞ (fluxDifference base mean osc i j) := |
| 681 | ((((hb i).mul (hm j)).add ((hm i).mul (hb j))).add ((hm i).mul (hm j))).add |
| 682 | (covariance_smooth ho i j) |
| 683 | |
| 684 | theorem total_periodic {base mean osc : Components} |
| 685 | (hb : ∀ i, AngularInvariant (base i)) (hm : ∀ i, AngularInvariant (mean i)) |
| 686 | (ho : ∀ i, AngularPeriodic (osc i)) (i : Fin 3) : |
| 687 | AngularPeriodic (total base mean osc i) := |
| 688 | AngularPeriodic.add (AngularPeriodic.add (fun q => hb i q period) |
| 689 | (fun q => hm i q period)) (ho i) |
| 690 | |
| 691 | theorem average_affine_product {a b f g : Scalar} |
| 692 | (ha : AngularInvariant a) (hb : AngularInvariant b) |
| 693 | (hf : AngularContinuous f) (hg : AngularContinuous g) |
| 694 | (q : SpaceTime) (hf0 : average f q = 0) (hg0 : average g q = 0) : |
| 695 | average (fun y => (a y + f y) * (b y + g y)) q = |
| 696 | a q * b q + average (fun y => f y * g y) q := by |
| 697 | have he : (fun y => (a y + f y) * (b y + g y)) = |
| 698 | (fun y => a y * b y + a y * g y + b y * f y + f y * g y) := by |
| 699 | funext y |
| 700 | ring |
| 701 | have h1 := ha.angularContinuous.mul hb.angularContinuous |
| 702 | have h2 := ha.angularContinuous.mul hg |
| 703 | have h3 := hb.angularContinuous.mul hf |
| 704 | have h4 := hf.mul hg |
| 705 | rw [he, average_add ((h1.add h2).add h3) h4, average_add (h1.add h2) h3, |
| 706 | average_add h1 h2, average_invariant (ha.mul hb), |
| 707 | average_mul_invariant ha, average_mul_invariant hb, hf0, hg0] |
| 708 | ring |
| 709 | |
| 710 | theorem average_total {base mean osc : Components} |
| 711 | (hb : ∀ i, AngularInvariant (base i)) (hm : ∀ i, AngularInvariant (mean i)) |
| 712 | (ho : ∀ i, AngularContinuous (osc i)) |
| 713 | (hz : ∀ i q, average (osc i) q = 0) (i : Fin 3) : |
| 714 | average (total base mean osc i) = fun q => base i q + mean i q := by |
| 715 | funext q |
| 716 | unfold total |
| 717 | rw [average_add ((hb i).angularContinuous.add (hm i).angularContinuous) (ho i), |
| 718 | average_add (hb i).angularContinuous (hm i).angularContinuous, |
| 719 | average_invariant (hb i), average_invariant (hm i), hz] |
| 720 | simp |
| 721 | |
| 722 | theorem average_total_product {base mean osc : Components} |
| 723 | (hb : ∀ i, AngularInvariant (base i)) (hm : ∀ i, AngularInvariant (mean i)) |
| 724 | (ho : ∀ i, AngularContinuous (osc i)) |
| 725 | (hz : ∀ i q, average (osc i) q = 0) (i j : Fin 3) : |
| 726 | average (fun q => total base mean osc i q * total base mean osc j q) = |
| 727 | fun q => base i q * base j q + fluxDifference base mean osc i j q := by |
| 728 | funext q |
| 729 | unfold total |
| 730 | rw [average_affine_product ((hb i).add (hm i)) ((hb j).add (hm j)) |
| 731 | (ho i) (ho j) q (hz i q) (hz j q)] |
| 732 | unfold fluxDifference covariance |
| 733 | ring |
| 734 | |
| 735 | theorem direction_twice_add {f g : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 736 | (hg : ContDiff ℝ ∞ g) (v w q : SpaceTime) : |
| 737 | direction v (direction w (fun y => f y + g y)) q = |
| 738 | direction v (direction w f) q + direction v (direction w g) q := by |
| 739 | rw [show direction w (fun y => f y + g y) = |
| 740 | (fun y => direction w f y + direction w g y) from funext (direction_add hf hg w)] |
| 741 | exact direction_add (direction_smooth _ hf) (direction_smooth _ hg) v q |
| 742 | |
| 743 | theorem meanLaplacian_add {f g : Scalar} (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) |
| 744 | (q : SpaceTime) : meanLaplacian (fun y => f y + g y) q = |
| 745 | meanLaplacian f q + meanLaplacian g q := by |
| 746 | simp only [meanLaplacian, dr, dz, direction_twice_add hf hg, direction_add hf hg] |
| 747 | ring |
| 748 | |
| 749 | theorem radialDivergence_add {f g : Scalar} (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) |
| 750 | (c : ℝ) (q : SpaceTime) : radialDivergence c (fun y => f y + g y) q = |
| 751 | radialDivergence c f q + radialDivergence c g q := by |
| 752 | simp only [radialDivergence, dr, direction_add hf hg] |
| 753 | ring |
| 754 | |
| 755 | noncomputable def baseRadial (b : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 756 | dt (b 0) q + radialDivergence 1 (fun y => b 0 y * b 0 y) q + |
| 757 | dz (fun y => b 2 y * b 0 y) q - b 1 q * b 1 q / radius q - |
| 758 | meanLaplacian (b 0) q + b 0 q / radius q ^ 2 + dr p q |
| 759 | |
| 760 | noncomputable def baseAngular (b : Components) (q : SpaceTime) : ℝ := |
| 761 | dt (b 1) q + radialDivergence 2 (fun y => b 0 y * b 1 y) q + |
| 762 | dz (fun y => b 2 y * b 1 y) q - meanLaplacian (b 1) q + b 1 q / radius q ^ 2 |
| 763 | |
| 764 | noncomputable def baseAxial (b : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 765 | dt (b 2) q + radialDivergence 1 (fun y => b 0 y * b 2 y) q + |
| 766 | dz (fun y => b 2 y * b 2 y) q - meanLaplacian (b 2) q + dz p q |
| 767 | |
| 768 | /-- Physical version of `E_theta` in (32), with viscosity one. -/ |
| 769 | noncomputable def Etheta (b m o : Components) (Ttheta : Scalar) (q : SpaceTime) : ℝ := |
| 770 | dt (m 1) q + radialDivergence 2 (fluxDifference b m o 0 1) q + |
| 771 | dz (fluxDifference b m o 2 1) q - meanLaplacian (m 1) q + m 1 q / radius q ^ 2 - |
| 772 | radialDivergence 2 Ttheta q |
| 773 | |
| 774 | /-- Physical version of `E_z` in (32), with viscosity one. -/ |
| 775 | noncomputable def Ez (b m o : Components) (pm Tz : Scalar) (q : SpaceTime) : ℝ := |
| 776 | dt (m 2) q + radialDivergence 1 (fluxDifference b m o 0 2) q + |
| 777 | dz (fun y => fluxDifference b m o 2 2 y + pm y) q - meanLaplacian (m 2) q - |
| 778 | radialDivergence 1 Tz q |
| 779 | |
| 780 | /-- Required physical radial pressure derivative in (32). -/ |
| 781 | noncomputable def gr (b m o : Components) (q : SpaceTime) : ℝ := |
| 782 | -(dt (m 0) q + radialDivergence 1 (fluxDifference b m o 0 0) q + |
| 783 | dz (fluxDifference b m o 2 0) q - fluxDifference b m o 1 1 q / radius q - |
| 784 | meanLaplacian (m 0) q + m 0 q / radius q ^ 2) |
| 785 | |
| 786 | theorem reynoldsAngular_total_sub {b m o : Components} |
| 787 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hm : ∀ i, ContDiff ℝ ∞ (m i)) |
| 788 | (ho : ∀ i, ContDiff ℝ ∞ (o i)) |
| 789 | (hbi : ∀ i, AngularInvariant (b i)) (hmi : ∀ i, AngularInvariant (m i)) |
| 790 | (hz : ∀ i q, average (o i) q = 0) (Ttheta : Scalar) (q : SpaceTime) : |
| 791 | reynoldsAngular (total b m o) q - baseAngular b q - radialDivergence 2 Ttheta q = |
| 792 | Etheta b m o Ttheta q := by |
| 793 | have hoc i := angularContinuous_of_continuous (ho i).continuous |
| 794 | have hflux := fluxDifference_smooth hb hm ho |
| 795 | unfold reynoldsAngular baseAngular Etheta |
| 796 | rw [average_total hbi hmi hoc hz 1, average_total_product hbi hmi hoc hz 0 1, |
| 797 | average_total_product hbi hmi hoc hz 2 1, |
| 798 | radialDivergence_add ((hb 0).mul (hb 1)) (hflux 0 1), meanLaplacian_add (hb 1) (hm 1)] |
| 799 | simp only [dt, dz, direction_add (hb 1) (hm 1), direction_add ((hb 2).mul (hb 1)) (hflux 2 1)] |
| 800 | ring |
| 801 | |
| 802 | theorem reynoldsRadial_total_sub {b m o : Components} {p pb pm : Scalar} |
| 803 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hm : ∀ i, ContDiff ℝ ∞ (m i)) |
| 804 | (ho : ∀ i, ContDiff ℝ ∞ (o i)) (hpb : ContDiff ℝ ∞ pb) (hpm : ContDiff ℝ ∞ pm) |
| 805 | (hbi : ∀ i, AngularInvariant (b i)) (hmi : ∀ i, AngularInvariant (m i)) |
| 806 | (hz : ∀ i q, average (o i) q = 0) |
| 807 | (hpavg : average p = fun q => pb q + pm q) (q : SpaceTime) : |
| 808 | reynoldsRadial (total b m o) p q - baseRadial b pb q = dr pm q - gr b m o q := by |
| 809 | have hoc i := angularContinuous_of_continuous (ho i).continuous |
| 810 | have hflux := fluxDifference_smooth hb hm ho |
| 811 | unfold reynoldsRadial baseRadial gr |
| 812 | rw [average_total hbi hmi hoc hz 0, average_total_product hbi hmi hoc hz 0 0, |
| 813 | average_total_product hbi hmi hoc hz 2 0, average_total_product hbi hmi hoc hz 1 1, |
| 814 | hpavg, radialDivergence_add ((hb 0).mul (hb 0)) (hflux 0 0), |
| 815 | meanLaplacian_add (hb 0) (hm 0)] |
| 816 | simp only [dt, dr, dz, direction_add (hb 0) (hm 0), direction_add ((hb 2).mul (hb 0)) (hflux 2 0), |
| 817 | direction_add hpb hpm] |
| 818 | ring |
| 819 | |
| 820 | theorem reynoldsAxial_total_sub {b m o : Components} {p pb pm : Scalar} |
| 821 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hm : ∀ i, ContDiff ℝ ∞ (m i)) |
| 822 | (ho : ∀ i, ContDiff ℝ ∞ (o i)) (hpb : ContDiff ℝ ∞ pb) (hpm : ContDiff ℝ ∞ pm) |
| 823 | (hbi : ∀ i, AngularInvariant (b i)) (hmi : ∀ i, AngularInvariant (m i)) |
| 824 | (hz : ∀ i q, average (o i) q = 0) |
| 825 | (hpavg : average p = fun q => pb q + pm q) (Tz : Scalar) (q : SpaceTime) : |
| 826 | reynoldsAxial (total b m o) p q - baseAxial b pb q - radialDivergence 1 Tz q = |
| 827 | Ez b m o pm Tz q := by |
| 828 | have hoc i := angularContinuous_of_continuous (ho i).continuous |
| 829 | have hflux := fluxDifference_smooth hb hm ho |
| 830 | unfold reynoldsAxial baseAxial Ez |
| 831 | rw [average_total hbi hmi hoc hz 2, average_total_product hbi hmi hoc hz 0 2, |
| 832 | average_total_product hbi hmi hoc hz 2 2, hpavg, |
| 833 | radialDivergence_add ((hb 0).mul (hb 2)) (hflux 0 2), meanLaplacian_add (hb 2) (hm 2)] |
| 834 | simp only [dt, dz, direction_add (hb 2) (hm 2), direction_add ((hb 2).mul (hb 2)) (hflux 2 2), |
| 835 | direction_add hpb hpm, direction_add (hflux 2 2) hpm] |
| 836 | ring |
| 837 | |
| 838 | theorem reynoldsAngular_invariant {b : Components} (hbi : ∀ i, AngularInvariant (b i)) |
| 839 | (q : SpaceTime) : reynoldsAngular b q = baseAngular b q := by |
| 840 | have h1 i : average (b i) = b i := funext (average_invariant (hbi i)) |
| 841 | have h2 i j : average (fun y => b i y * b j y) = (fun y => b i y * b j y) := |
| 842 | funext (average_invariant ((hbi i).mul (hbi j))) |
| 843 | simp only [reynoldsAngular, h1, h2, baseAngular] |
| 844 | |
| 845 | theorem reynoldsRadial_invariant {b : Components} {p : Scalar} |
| 846 | (hbi : ∀ i, AngularInvariant (b i)) (hpi : AngularInvariant p) |
| 847 | (q : SpaceTime) : reynoldsRadial b p q = baseRadial b p q := by |
| 848 | have h1 i : average (b i) = b i := funext (average_invariant (hbi i)) |
| 849 | have h2 i j : average (fun y => b i y * b j y) = (fun y => b i y * b j y) := |
| 850 | funext (average_invariant ((hbi i).mul (hbi j))) |
| 851 | have h3 : average p = p := funext (average_invariant hpi) |
| 852 | simp only [reynoldsRadial, h1, h2, h3, baseRadial] |
| 853 | |
| 854 | theorem reynoldsAxial_invariant {b : Components} {p : Scalar} |
| 855 | (hbi : ∀ i, AngularInvariant (b i)) (hpi : AngularInvariant p) |
| 856 | (q : SpaceTime) : reynoldsAxial b p q = baseAxial b p q := by |
| 857 | have h1 i : average (b i) = b i := funext (average_invariant (hbi i)) |
| 858 | have h2 i j : average (fun y => b i y * b j y) = (fun y => b i y * b j y) := |
| 859 | funext (average_invariant ((hbi i).mul (hbi j))) |
| 860 | have h3 : average p = p := funext (average_invariant hpi) |
| 861 | simp only [reynoldsAxial, h1, h2, h3, baseAxial] |
| 862 | |
| 863 | theorem residuals_invariant {b : Components} {p : Scalar} |
| 864 | (hbi : ∀ i, AngularInvariant (b i)) (hpi : AngularInvariant p) : |
| 865 | AngularInvariant (residualRadial b p) ∧ AngularInvariant (residualAngular b p) ∧ |
| 866 | AngularInvariant (residualAxial b p) := by |
| 867 | have h0 : ∀ i q a, b i (angularShift q a) = b i q := fun i => hbi i |
| 868 | have h1 : ∀ i v q a, direction v (b i) (angularShift q a) = direction v (b i) q := |
| 869 | fun i v => (hbi i).direction v |
| 870 | have h2 : ∀ i v w q a, direction v (direction w (b i)) (angularShift q a) = |
| 871 | direction v (direction w (b i)) q := fun i v w => ((hbi i).direction w).direction v |
| 872 | have h3 : ∀ v q a, direction v p (angularShift q a) = direction v p q := |
| 873 | fun v => hpi.direction v |
| 874 | refine ⟨?_, ?_, ?_⟩ |
| 875 | all_goals |
| 876 | intro q a |
| 877 | simp only [residualRadial, residualAngular, residualAxial, transport, laplacian, |
| 878 | dt, dr, dtheta, dz, radius_angularShift, h0, h1, h2, h3] |
| 879 | |
| 880 | theorem base_residuals {b : Components} {p : Scalar} |
| 881 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hp : ContDiff ℝ ∞ p) |
| 882 | (hbi : ∀ i, AngularInvariant (b i)) (hpi : AngularInvariant p) |
| 883 | (hdiv : ∀ y, 0 < radius y → divergence b y = 0) |
| 884 | (q : SpaceTime) (hr : 0 < radius q) : |
| 885 | residualRadial b p q = baseRadial b p q ∧ |
| 886 | residualAngular b p q = baseAngular b q ∧ residualAxial b p q = baseAxial b p q := by |
| 887 | have hper : ∀ i, AngularPeriodic (b i) := fun i y => hbi i y period |
| 888 | have hip := residuals_invariant hbi hpi |
| 889 | have hR := average_residualRadial hb hp hper hdiv q hr |
| 890 | have hA := average_residualAngular hb hp hper (fun y => hpi y period) hdiv q hr |
| 891 | have hZ := average_residualAxial hb hp hper hdiv q hr |
| 892 | rw [average_invariant hip.1, reynoldsRadial_invariant hbi hpi] at hR |
| 893 | rw [average_invariant hip.2.1, reynoldsAngular_invariant hbi] at hA |
| 894 | rw [average_invariant hip.2.2, reynoldsAxial_invariant hbi hpi] at hZ |
| 895 | exact ⟨hR, hA, hZ⟩ |
| 896 | |
| 897 | /-- Exact physical mean balances (32) for the actual cylindrical residual. |
| 898 | The tensor entries are the prescribed physical radial flux entries; `covariance` |
| 899 | is the integral of the entire oscillatory field, including any curl corrections. -/ |
| 900 | theorem exact_mean_balances {b m o : Components} {p pb pm : Scalar} |
| 901 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hm : ∀ i, ContDiff ℝ ∞ (m i)) |
| 902 | (ho : ∀ i, ContDiff ℝ ∞ (o i)) (hp : ContDiff ℝ ∞ p) |
| 903 | (hpb : ContDiff ℝ ∞ pb) (hpm : ContDiff ℝ ∞ pm) |
| 904 | (hbi : ∀ i, AngularInvariant (b i)) (hmi : ∀ i, AngularInvariant (m i)) |
| 905 | (hop : ∀ i, AngularPeriodic (o i)) (hpp : AngularPeriodic p) (hpbi : AngularInvariant pb) |
| 906 | (hz : ∀ i q, average (o i) q = 0) (hpavg : average p = fun q => pb q + pm q) |
| 907 | (hdiv : ∀ y, 0 < radius y → divergence (total b m o) y = 0) |
| 908 | (hbdiv : ∀ y, 0 < radius y → divergence b y = 0) |
| 909 | (Ttheta Tz : Scalar) (q : SpaceTime) (hr : 0 < radius q) : |
| 910 | (average (fun y => CylindricalResidual.cylindricalResidual |
| 911 | (velocity (total b m o)) p y.1 y.2 1) q - |
| 912 | CylindricalResidual.cylindricalResidual (velocity b) pb q.1 q.2 1 - |
| 913 | radialDivergence 2 Ttheta q = Etheta b m o Ttheta q) ∧ |
| 914 | (average (fun y => CylindricalResidual.cylindricalResidual |
| 915 | (velocity (total b m o)) p y.1 y.2 2) q - |
| 916 | CylindricalResidual.cylindricalResidual (velocity b) pb q.1 q.2 2 - |
| 917 | radialDivergence 1 Tz q = Ez b m o pm Tz q) ∧ |
| 918 | (average (fun y => CylindricalResidual.cylindricalResidual |
| 919 | (velocity (total b m o)) p y.1 y.2 0) q - |
| 920 | CylindricalResidual.cylindricalResidual (velocity b) pb q.1 q.2 0 = dr pm q - gr b m o q) := by |
| 921 | have ht := total_smooth hb hm ho |
| 922 | have htp := total_periodic hbi hmi hop |
| 923 | have hbase := base_residuals hb hpb hbi hpbi hbdiv q hr |
| 924 | have heA : (fun y => CylindricalResidual.cylindricalResidual |
| 925 | (velocity (total b m o)) p y.1 y.2 1) = residualAngular (total b m o) p := |
| 926 | funext (cylindricalResidual_angular ht hp) |
| 927 | have heZ : (fun y => CylindricalResidual.cylindricalResidual |
| 928 | (velocity (total b m o)) p y.1 y.2 2) = residualAxial (total b m o) p := |
| 929 | funext (cylindricalResidual_axial ht hp) |
| 930 | have heR : (fun y => CylindricalResidual.cylindricalResidual |
| 931 | (velocity (total b m o)) p y.1 y.2 0) = residualRadial (total b m o) p := |
| 932 | funext (cylindricalResidual_radial ht hp) |
| 933 | rw [heA, heZ, heR, cylindricalResidual_angular hb hpb, cylindricalResidual_axial hb hpb, |
| 934 | cylindricalResidual_radial hb hpb, hbase.1, hbase.2.1, hbase.2.2, |
| 935 | average_residualAngular ht hp htp hpp hdiv q hr, |
| 936 | average_residualAxial ht hp htp hdiv q hr, average_residualRadial ht hp htp hdiv q hr] |
| 937 | exact ⟨reynoldsAngular_total_sub hb hm ho hbi hmi hz Ttheta q, |
| 938 | reynoldsAxial_total_sub hb hm ho hpb hpm hbi hmi hz hpavg Tz q, |
| 939 | reynoldsRadial_total_sub hb hm ho hpb hpm hbi hmi hz hpavg q⟩ |
| 940 | |
| 941 | /-- Substitution of (24) retains, rather than discards, its full base error. -/ |
| 942 | theorem retain_base_error {Rtheta Rz Rr Btheta Bz Br Ttheta Tz Etheta Ez Drp gr |
| 943 | ftheta fz fr : ℝ} |
| 944 | (hθ : Rtheta - Btheta - Ttheta = Etheta) |
| 945 | (hz : Rz - Bz - Tz = Ez) (hr : Rr - Br = Drp - gr) |
| 946 | (hbθ : Btheta = -Ttheta + ftheta) (hbz : Bz = -Tz + fz) (hbr : Br = fr) : |
| 947 | Rtheta = Etheta + ftheta ∧ Rz = Ez + fz ∧ Rr = Drp - gr + fr := by |
| 948 | constructor |
| 949 | · linarith |
| 950 | constructor <;> linarith |
| 951 | |
| 952 | end |
| 953 | |
| 954 | end NavierStokes.MeanResidual |