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_const [CompleteSpace E] (c : E) (q : SpaceTime) : average (fun _ => c) q = c := |
| 133 | average_invariant (fun _ _ => rfl) q |
| 134 | |
| 135 | theorem average_mul_invariant {a f : Scalar} (ha : AngularInvariant a) (q : SpaceTime) : |
| 136 | average (fun y => a y * f y) q = a q * average f q := by |
| 137 | change ∀ q θ, a (angularShift q θ) = a q at ha |
| 138 | simp only [average, ha, intervalIntegral.integral_const_mul, smul_eq_mul] |
| 139 | ring |
| 140 | |
| 141 | theorem average_div_radius (f : Scalar) (q : SpaceTime) (n : ℕ) : |
| 142 | average (fun y => f y / radius y ^ n) q = average f q / radius q ^ n := by |
| 143 | simp only [average, radius_angularShift, intervalIntegral.integral_div, smul_eq_mul] |
| 144 | ring |
| 145 | |
| 146 | theorem average_div_r (f : Scalar) (q : SpaceTime) : |
| 147 | average (fun y => f y / radius y) q = average f q / radius q := by |
| 148 | simpa only [pow_one] using average_div_radius f q 1 |
| 149 | |
| 150 | theorem average_const_mul (c : ℝ) (f : Scalar) (q : SpaceTime) : |
| 151 | average (fun y => c * f y) q = c * average f q := |
| 152 | average_mul_invariant (fun _ _ => rfl) q |
| 153 | |
| 154 | theorem average_congr {f g : SpaceTime → E} {q : SpaceTime} |
| 155 | (h : ∀ a ∈ uIcc (0 : ℝ) period, f (angularShift q a) = g (angularShift q a)) : |
| 156 | average f q = average g q := by |
| 157 | unfold average |
| 158 | congr 1 |
| 159 | exact intervalIntegral.integral_congr h |
| 160 | |
| 161 | theorem average_smooth [CompleteSpace E] {f : SpaceTime → E} (hf : ContDiff ℝ ∞ f) : |
| 162 | ContDiff ℝ ∞ (average f) := |
| 163 | (TransportPrimitive.parameterIntegral_contDiff (hf.comp contDiff_angularShift) |
| 164 | 0 period).const_smul _ |
| 165 | |
| 166 | /-- Differentiation under the actual compact angular integral. -/ |
| 167 | theorem direction_average [CompleteSpace E] {f : SpaceTime → E} |
| 168 | (hf : ContDiff ℝ ∞ f) (v q : SpaceTime) : |
| 169 | direction v (average f) q = average (direction v f) q := by |
| 170 | let g : SpaceTime × ℝ → E := fun qa => f (angularShift qa.1 qa.2) |
| 171 | have hg : ContDiff ℝ ∞ g := hf.comp contDiff_angularShift |
| 172 | have hI := TransportPrimitive.parameterIntegral_hasFDerivAt hg 0 period q |
| 173 | unfold direction average |
| 174 | rw [(hI.fun_const_smul (period⁻¹)).fderiv] |
| 175 | simp only [_root_.smul_apply] |
| 176 | congr 1 |
| 177 | rw [ContinuousLinearMap.intervalIntegral_apply] |
| 178 | · apply intervalIntegral.integral_congr |
| 179 | intro a _ |
| 180 | have hchain : HasFDerivAt (fun x => f (angularShift x a)) |
| 181 | (fderiv ℝ f (angularShift q a)) q := by |
| 182 | simpa only [angularShift, Function.comp_def, id_eq, ContinuousLinearMap.comp_id] using |
| 183 | ((hf.differentiable (by simp)) (angularShift q a)).hasFDerivAt.comp q |
| 184 | ((hasFDerivAt_id q).add_const (a • angularVector)) |
| 185 | exact congrArg (fun L : SpaceTime →L[ℝ] E => L v) |
| 186 | ((TransportPrimitive.parameter_hasFDerivAt hg q a).unique hchain) |
| 187 | · exact ((TransportPrimitive.parameterDerivative_contDiff hg).continuous.comp |
| 188 | (continuous_const.prodMk continuous_id)).intervalIntegrable _ _ |
| 189 | |
| 190 | theorem AngularPeriodic.direction {f : SpaceTime → E} (hp : AngularPeriodic f) |
| 191 | (v : SpaceTime) : AngularPeriodic (direction v f) := by |
| 192 | intro q |
| 193 | have he : (fun x => f (x + period • angularVector)) = f := funext hp |
| 194 | have hd := congrArg (fun F => fderiv ℝ F q) he |
| 195 | rw [fderiv_comp_add_right] at hd |
| 196 | exact congrArg (fun L : SpaceTime →L[ℝ] E => L v) hd |
| 197 | |
| 198 | theorem AngularInvariant.direction {f : SpaceTime → E} (hp : AngularInvariant f) |
| 199 | (v : SpaceTime) : AngularInvariant (direction v f) := by |
| 200 | intro q a |
| 201 | have he : (fun x => f (x + a • angularVector)) = f := funext (fun x => hp x a) |
| 202 | have hd := congrArg (fun F => fderiv ℝ F q) he |
| 203 | rw [fderiv_comp_add_right] at hd |
| 204 | exact congrArg (fun L : SpaceTime →L[ℝ] E => L v) hd |
| 205 | |
| 206 | theorem AngularPeriodic.mul {f g : Scalar} (hf : AngularPeriodic f) (hg : AngularPeriodic g) : |
| 207 | AngularPeriodic (fun q => f q * g q) := by |
| 208 | intro q |
| 209 | change f (angularShift q period) * g (angularShift q period) = f q * g q |
| 210 | rw [hf q, hg q] |
| 211 | |
| 212 | /-- A full angular derivative has exactly zero average, by the fundamental theorem. -/ |
| 213 | theorem average_dtheta_zero [CompleteSpace E] {f : SpaceTime → E} |
| 214 | (hf : ContDiff ℝ ∞ f) (hp : AngularPeriodic f) (q : SpaceTime) : |
| 215 | average (dtheta f) q = 0 := by |
| 216 | have hd : ∀ a : ℝ, HasDerivAt (fun b => f (angularShift q b)) |
| 217 | (dtheta f (angularShift q a)) a := by |
| 218 | intro a |
| 219 | have hs : HasDerivAt (fun b : ℝ => angularShift q b) angularVector a := by |
| 220 | simpa [angularShift] using ((hasDerivAt_id a).smul_const angularVector).const_add q |
| 221 | exact ((hf.differentiable (by simp)) (angularShift q a)).hasFDerivAt.comp_hasDerivAt a hs |
| 222 | have hc : AngularContinuous (dtheta f) := |
| 223 | angularContinuous_of_continuous (direction_smooth angularVector hf).continuous |
| 224 | have hi := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun a _ => hd a) |
| 225 | ((hc q).intervalIntegrable 0 period) |
| 226 | rw [hp, angularShift_zero, sub_self] at hi |
| 227 | simp only [average, hi, smul_zero] |
| 228 | |
| 229 | theorem dtheta_invariant_zero [CompleteSpace E] {f : SpaceTime → E} |
| 230 | (hf : ContDiff ℝ ∞ f) (hp : AngularInvariant f) (q : SpaceTime) : dtheta f q = 0 := by |
| 231 | have he : average f = f := funext (average_invariant hp) |
| 232 | calc |
| 233 | dtheta f q = dtheta (average f) q := by rw [he] |
| 234 | _ = average (dtheta f) q := direction_average hf angularVector q |
| 235 | _ = 0 := average_dtheta_zero hf (fun y => hp y period) q |
| 236 | |
| 237 | theorem direction_add {f g : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 238 | (hg : ContDiff ℝ ∞ g) (v q : SpaceTime) : |
| 239 | direction v (fun y => f y + g y) q = direction v f q + direction v g q := by |
| 240 | unfold direction |
| 241 | rw [fderiv_fun_add (hf.differentiable (by simp) q) (hg.differentiable (by simp) q)] |
| 242 | rfl |
| 243 | |
| 244 | theorem direction_sub {f g : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 245 | (hg : ContDiff ℝ ∞ g) (v q : SpaceTime) : |
| 246 | direction v (fun y => f y - g y) q = direction v f q - direction v g q := by |
| 247 | unfold direction |
| 248 | rw [fderiv_fun_sub (hf.differentiable (by simp) q) (hg.differentiable (by simp) q)] |
| 249 | rfl |
| 250 | |
| 251 | theorem direction_mul {f g : Scalar} (hf : ContDiff ℝ ∞ f) |
| 252 | (hg : ContDiff ℝ ∞ g) (v q : SpaceTime) : |
| 253 | direction v (fun y => f y * g y) q = direction v f q * g q + f q * direction v g q := by |
| 254 | unfold direction |
| 255 | rw [fderiv_fun_mul (hf.differentiable (by simp) q) (hg.differentiable (by simp) q)] |
| 256 | simp |
| 257 | ring |
| 258 | |
| 259 | theorem direction_map (L : E →L[ℝ] F) {f : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 260 | (v q : SpaceTime) : |
| 261 | direction v (fun y => L (f y)) q = L (direction v f q) := by |
| 262 | unfold direction |
| 263 | change (fderiv ℝ (L ∘ f) q) v = _ |
| 264 | rw [(L.hasFDerivAt.comp q (hf.differentiable (by simp) q).hasFDerivAt).fderiv] |
| 265 | rfl |
| 266 | |
| 267 | theorem spatial_direction {f : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 268 | (t : ℝ) (x : Space) (i : Fin 3) : |
| 269 | CylindricalResidual.dCoord i (fun y => f (t, y)) x = |
| 270 | direction (0, coordinateVector i) f (t, x) := by |
| 271 | have h := (hf.differentiable (by simp) (t, x)).hasFDerivAt.comp x |
| 272 | ((hasFDerivAt_const t x).prodMk (hasFDerivAt_id x)) |
| 273 | change (fderiv ℝ (f ∘ fun y => (t, y)) x) _ = _ |
| 274 | rw [h.fderiv] |
| 275 | rfl |
| 276 | |
| 277 | theorem spatial_second {f : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 278 | (t : ℝ) (x : Space) (i : Fin 3) : |
| 279 | CylindricalResidual.dCoord i (CylindricalResidual.dCoord i (fun y => f (t, y))) x = |
| 280 | direction (0, coordinateVector i) (direction (0, coordinateVector i) f) (t, x) := by |
| 281 | rw [show CylindricalResidual.dCoord i (fun y => f (t, y)) = |
| 282 | fun y => direction (0, coordinateVector i) f (t, y) from |
| 283 | funext (fun y => spatial_direction hf t y i)] |
| 284 | exact spatial_direction (direction_smooth _ hf) t x i |
| 285 | |
| 286 | theorem temporal_direction {f : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 287 | (t : ℝ) (x : Space) : |
| 288 | fderiv ℝ (fun s => f (s, x)) t 1 = dt f (t, x) := by |
| 289 | have h := (hf.differentiable (by simp) (t, x)).hasFDerivAt.comp t |
| 290 | ((hasFDerivAt_id (𝕜 := ℝ) t).prodMk (hasFDerivAt_const (𝕜 := ℝ) x t)) |
| 291 | change (fderiv ℝ (f ∘ fun s => (id s, x)) t) 1 = _ |
| 292 | rw [h.fderiv] |
| 293 | rfl |
| 294 | |
| 295 | noncomputable def velocity (w : Components) : VelocityField := |
| 296 | fun q => pack (w 0 q) (w 1 q) (w 2 q) |
| 297 | |
| 298 | @[simp] theorem velocity_apply (w : Components) (q : SpaceTime) (i : Fin 3) : |
| 299 | velocity w q i = w i q := by |
| 300 | fin_cases i <;> simp [velocity] |
| 301 | |
| 302 | theorem velocity_smooth {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) : |
| 303 | ContDiff ℝ ∞ (velocity w) := |
| 304 | (((hw 0).smul contDiff_const).add ((hw 1).smul contDiff_const)).add |
| 305 | ((hw 2).smul contDiff_const) |
| 306 | |
| 307 | theorem direction_velocity {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 308 | (v q : SpaceTime) : direction v (velocity w) q = |
| 309 | pack (direction v (w 0) q) (direction v (w 1) q) (direction v (w 2) q) := by |
| 310 | exact AxisymmetricResidual.fderiv_pack_apply |
| 311 | ((hw 0).differentiable (by simp) q) ((hw 1).differentiable (by simp) q) |
| 312 | ((hw 2).differentiable (by simp) q) v |
| 313 | |
| 314 | theorem direction_velocity_component {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 315 | (v q : SpaceTime) (i : Fin 3) : direction v (velocity w) q i = direction v (w i) q := by |
| 316 | rw [direction_velocity hw] |
| 317 | fin_cases i <;> simp |
| 318 | |
| 319 | noncomputable def laplacian (f : Scalar) (q : SpaceTime) : ℝ := |
| 320 | dr (dr f) q + dr f q / radius q + dtheta (dtheta f) q / radius q ^ 2 + dz (dz f) q |
| 321 | |
| 322 | noncomputable def meanLaplacian (f : Scalar) (q : SpaceTime) : ℝ := |
| 323 | dr (dr f) q + dr f q / radius q + dz (dz f) q |
| 324 | |
| 325 | noncomputable def radialDivergence (c : ℝ) (f : Scalar) (q : SpaceTime) : ℝ := |
| 326 | dr f q + c / radius q * f q |
| 327 | |
| 328 | noncomputable def divergence (w : Components) (q : SpaceTime) : ℝ := |
| 329 | dr (w 0) q + w 0 q / radius q + dtheta (w 1) q / radius q + dz (w 2) q |
| 330 | |
| 331 | noncomputable def transport (w : Components) (f : Scalar) (q : SpaceTime) : ℝ := |
| 332 | w 0 q * dr f q + w 1 q / radius q * dtheta f q + w 2 q * dz f q |
| 333 | |
| 334 | noncomputable def residualRadial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 335 | dt (w 0) q + transport w (w 0) q - (w 1 q) ^ 2 / radius q - laplacian (w 0) q + |
| 336 | w 0 q / radius q ^ 2 + 2 * dtheta (w 1) q / radius q ^ 2 + dr p q |
| 337 | |
| 338 | noncomputable def residualAngular (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 339 | dt (w 1) q + transport w (w 1) q + w 0 q * w 1 q / radius q - laplacian (w 1) q + |
| 340 | w 1 q / radius q ^ 2 - 2 * dtheta (w 0) q / radius q ^ 2 + dtheta p q / radius q |
| 341 | |
| 342 | noncomputable def residualAxial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 343 | dt (w 2) q + transport w (w 2) q - laplacian (w 2) q + dz p q |
| 344 | |
| 345 | theorem scalarLaplacian_eq {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 346 | CylindricalResidual.scalarLaplacian (fun y => f (q.1, y)) q.2 = laplacian f q := by |
| 347 | simp only [CylindricalResidual.scalarLaplacian, spatial_second hf, spatial_direction hf, |
| 348 | laplacian, dr, dtheta, dz, angularVector, radius, smul_eq_mul] |
| 349 | ring |
| 350 | |
| 351 | theorem scalarLaplacian_velocity {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 352 | (q : SpaceTime) (i : Fin 3) : |
| 353 | CylindricalResidual.scalarLaplacian (fun y => velocity w (q.1, y)) q.2 i = |
| 354 | laplacian (w i) q := by |
| 355 | have hv : ContDiff ℝ 2 (velocity w) := (velocity_smooth hw).of_le |
| 356 | (show (2 : WithTop ℕ∞) ≤ ∞ from WithTop.coe_le_coe.mpr le_top) |
| 357 | have hs : ContDiffAt ℝ 2 (fun y => velocity w (q.1, y)) q.2 := |
| 358 | (hv.comp (contDiff_const.prodMk contDiff_id)).contDiffAt |
| 359 | rw [← CylindricalResidual.scalarLaplacian_component hs i] |
| 360 | simpa only [velocity_apply] using scalarLaplacian_eq (hw i) q |
| 361 | |
| 362 | theorem cylindricalResidual_radial {w : Components} {p : Scalar} |
| 363 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) (q : SpaceTime) : |
| 364 | CylindricalResidual.cylindricalResidual (velocity w) p q.1 q.2 0 = |
| 365 | residualRadial w p q := by |
| 366 | change (temporalDerivative (velocity w) q.1 q.2) 0 + |
| 367 | CylindricalResidual.vectorAdvection (fun y => velocity w (q.1, y)) q.2 0 - |
| 368 | CylindricalResidual.vectorLaplacian (fun y => velocity w (q.1, y)) q.2 0 + |
| 369 | CylindricalResidual.scalarGradient (fun y => p (q.1, y)) q.2 0 = _ |
| 370 | rw [CylindricalResidual.vectorAdvection_radial, CylindricalResidual.vectorLaplacian_radial, |
| 371 | scalarLaplacian_velocity hw q 0] |
| 372 | simp only [temporalDerivative, temporal_direction (velocity_smooth hw), dt, |
| 373 | direction_velocity_component hw, spatial_direction (velocity_smooth hw), |
| 374 | velocity_apply, CylindricalResidual.scalarGradient, pack_zero, spatial_direction hp, |
| 375 | residualRadial, transport, dr, dtheta, dz, angularVector, radius] |
| 376 | ring |
| 377 | |
| 378 | theorem cylindricalResidual_angular {w : Components} {p : Scalar} |
| 379 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) (q : SpaceTime) : |
| 380 | CylindricalResidual.cylindricalResidual (velocity w) p q.1 q.2 1 = |
| 381 | residualAngular w p q := by |
| 382 | change (temporalDerivative (velocity w) q.1 q.2) 1 + |
| 383 | CylindricalResidual.vectorAdvection (fun y => velocity w (q.1, y)) q.2 1 - |
| 384 | CylindricalResidual.vectorLaplacian (fun y => velocity w (q.1, y)) q.2 1 + |
| 385 | CylindricalResidual.scalarGradient (fun y => p (q.1, y)) q.2 1 = _ |
| 386 | rw [CylindricalResidual.vectorAdvection_angular, CylindricalResidual.vectorLaplacian_angular, |
| 387 | scalarLaplacian_velocity hw q 1] |
| 388 | simp only [temporalDerivative, temporal_direction (velocity_smooth hw), dt, |
| 389 | direction_velocity_component hw, spatial_direction (velocity_smooth hw), |
| 390 | velocity_apply, CylindricalResidual.scalarGradient, pack_one, spatial_direction hp, |
| 391 | residualAngular, transport, dr, dtheta, dz, angularVector, radius] |
| 392 | ring |
| 393 | |
| 394 | theorem cylindricalResidual_axial {w : Components} {p : Scalar} |
| 395 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) (q : SpaceTime) : |
| 396 | CylindricalResidual.cylindricalResidual (velocity w) p q.1 q.2 2 = |
| 397 | residualAxial w p q := by |
| 398 | change (temporalDerivative (velocity w) q.1 q.2) 2 + |
| 399 | CylindricalResidual.vectorAdvection (fun y => velocity w (q.1, y)) q.2 2 - |
| 400 | CylindricalResidual.vectorLaplacian (fun y => velocity w (q.1, y)) q.2 2 + |
| 401 | CylindricalResidual.scalarGradient (fun y => p (q.1, y)) q.2 2 = _ |
| 402 | rw [CylindricalResidual.vectorAdvection_axial, CylindricalResidual.vectorLaplacian_axial, |
| 403 | scalarLaplacian_velocity hw q 2] |
| 404 | simp only [temporalDerivative, temporal_direction (velocity_smooth hw), dt, |
| 405 | direction_velocity_component hw, spatial_direction (velocity_smooth hw), |
| 406 | velocity_apply, CylindricalResidual.scalarGradient, pack_two, spatial_direction hp, |
| 407 | residualAxial, transport, dr, dtheta, dz, angularVector, radius] |
| 408 | |
| 409 | noncomputable def conservativeRadial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 410 | dt (w 0) q + radialDivergence 1 (fun y => w 0 y * w 0 y) q + |
| 411 | dtheta (fun y => w 1 y * w 0 y) q / radius q + |
| 412 | dz (fun y => w 2 y * w 0 y) q - (w 1 q * w 1 q) / radius q - laplacian (w 0) q + |
| 413 | w 0 q / radius q ^ 2 + 2 * dtheta (w 1) q / radius q ^ 2 + dr p q |
| 414 | |
| 415 | noncomputable def conservativeAngular (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 416 | dt (w 1) q + radialDivergence 2 (fun y => w 0 y * w 1 y) q + |
| 417 | dtheta (fun y => w 1 y * w 1 y) q / radius q + |
| 418 | dz (fun y => w 2 y * w 1 y) q - laplacian (w 1) q + |
| 419 | w 1 q / radius q ^ 2 - 2 * dtheta (w 0) q / radius q ^ 2 + dtheta p q / radius q |
| 420 | |
| 421 | noncomputable def conservativeAxial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 422 | dt (w 2) q + radialDivergence 1 (fun y => w 0 y * w 2 y) q + |
| 423 | dtheta (fun y => w 1 y * w 2 y) q / radius q + |
| 424 | dz (fun y => w 2 y * w 2 y) q - laplacian (w 2) q + dz p q |
| 425 | |
| 426 | theorem conservativeRadial_eq {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 427 | (p : Scalar) (q : SpaceTime) : |
| 428 | conservativeRadial w p q = residualRadial w p q + w 0 q * divergence w q := by |
| 429 | simp only [conservativeRadial, residualRadial, radialDivergence, transport, divergence, |
| 430 | dr, dtheta, dz, direction_mul (hw 0) (hw 0), direction_mul (hw 1) (hw 0), |
| 431 | direction_mul (hw 2) (hw 0)] |
| 432 | ring |
| 433 | |
| 434 | theorem conservativeAngular_eq {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 435 | (p : Scalar) (q : SpaceTime) : |
| 436 | conservativeAngular w p q = residualAngular w p q + w 1 q * divergence w q := by |
| 437 | simp only [conservativeAngular, residualAngular, radialDivergence, transport, divergence, |
| 438 | dr, dtheta, dz, direction_mul (hw 0) (hw 1), direction_mul (hw 1) (hw 1), |
| 439 | direction_mul (hw 2) (hw 1)] |
| 440 | ring |
| 441 | |
| 442 | theorem conservativeAxial_eq {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 443 | (p : Scalar) (q : SpaceTime) : |
| 444 | conservativeAxial w p q = residualAxial w p q + w 2 q * divergence w q := by |
| 445 | simp only [conservativeAxial, residualAxial, radialDivergence, transport, divergence, |
| 446 | dr, dtheta, dz, direction_mul (hw 0) (hw 2), direction_mul (hw 1) (hw 2), |
| 447 | direction_mul (hw 2) (hw 2)] |
| 448 | ring |
| 449 | |
| 450 | omit [NormedAddCommGroup E] [NormedSpace ℝ E] in |
| 451 | theorem angularInvariant_radius (f : ℝ → E) : AngularInvariant (fun q => f (radius q)) := by |
| 452 | intro q a |
| 453 | exact congrArg f (radius_angularShift q a) |
| 454 | |
| 455 | theorem average_direction [CompleteSpace E] {f : SpaceTime → E} |
| 456 | (hf : ContDiff ℝ ∞ f) (v q : SpaceTime) : |
| 457 | average (direction v f) q = direction v (average f) q := (direction_average hf v q).symm |
| 458 | |
| 459 | theorem average_direction_twice [CompleteSpace E] {f : SpaceTime → E} |
| 460 | (hf : ContDiff ℝ ∞ f) (v w q : SpaceTime) : |
| 461 | average (direction v (direction w f)) q = direction v (direction w (average f)) q := by |
| 462 | rw [average_direction (direction_smooth w hf)] |
| 463 | rw [show average (direction w f) = direction w (average f) from |
| 464 | funext (average_direction hf w)] |
| 465 | |
| 466 | theorem average_dt {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 467 | average (dt f) q = dt (average f) q := average_direction hf _ q |
| 468 | |
| 469 | theorem average_dr {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 470 | average (dr f) q = dr (average f) q := average_direction hf _ q |
| 471 | |
| 472 | theorem average_dz {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 473 | average (dz f) q = dz (average f) q := average_direction hf _ q |
| 474 | |
| 475 | theorem average_drdr {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 476 | average (dr (dr f)) q = dr (dr (average f)) q := average_direction_twice hf _ _ q |
| 477 | |
| 478 | theorem average_dzdz {f : Scalar} (hf : ContDiff ℝ ∞ f) (q : SpaceTime) : |
| 479 | average (dz (dz f)) q = dz (dz (average f)) q := average_direction_twice hf _ _ q |
| 480 | |
| 481 | theorem angularContinuous_direction {f : Scalar} (hf : ContDiff ℝ ∞ f) (v : SpaceTime) : |
| 482 | AngularContinuous (direction v f) := angularContinuous_of_continuous (direction_smooth v hf).continuous |
| 483 | |
| 484 | theorem AngularContinuous.div_r {f : Scalar} (hf : AngularContinuous f) : |
| 485 | AngularContinuous (fun q => f q / radius q) := by |
| 486 | simpa only [pow_one] using hf.div_radius 1 |
| 487 | |
| 488 | theorem angularContinuous_radialDivergence {f : Scalar} (hf : ContDiff ℝ ∞ f) (c : ℝ) : |
| 489 | AngularContinuous (radialDivergence c f) := |
| 490 | (angularContinuous_direction hf _).add |
| 491 | ((angularInvariant_radius (fun r => c / r)).angularContinuous.mul |
| 492 | (angularContinuous_of_continuous hf.continuous)) |
| 493 | |
| 494 | theorem angularContinuous_laplacian {f : Scalar} (hf : ContDiff ℝ ∞ f) : |
| 495 | AngularContinuous (laplacian f) := |
| 496 | (((angularContinuous_direction (direction_smooth _ hf) _).add |
| 497 | (angularContinuous_direction hf _).div_r).add |
| 498 | ((angularContinuous_direction (direction_smooth _ hf) _).div_radius 2)).add |
| 499 | (angularContinuous_direction (direction_smooth _ hf) _) |
| 500 | |
| 501 | theorem average_radialDivergence {f : Scalar} (hf : ContDiff ℝ ∞ f) |
| 502 | (c : ℝ) (q : SpaceTime) : |
| 503 | average (radialDivergence c f) q = radialDivergence c (average f) q := by |
| 504 | have hr : AngularContinuous (dr f) := angularContinuous_of_continuous |
| 505 | (direction_smooth _ hf).continuous |
| 506 | have hc : AngularInvariant (fun y => c / radius y) := angularInvariant_radius _ |
| 507 | have hcf := hc.angularContinuous.mul (angularContinuous_of_continuous hf.continuous) |
| 508 | unfold radialDivergence |
| 509 | rw [average_add hr hcf, average_mul_invariant hc, average_dr hf] |
| 510 | |
| 511 | theorem average_laplacian {f : Scalar} (hf : ContDiff ℝ ∞ f) (hp : AngularPeriodic f) |
| 512 | (q : SpaceTime) : average (laplacian f) q = meanLaplacian (average f) q := by |
| 513 | have hrr : AngularContinuous (dr (dr f)) := angularContinuous_of_continuous |
| 514 | (direction_smooth _ (direction_smooth _ hf)).continuous |
| 515 | have hr : AngularContinuous (dr f) := angularContinuous_of_continuous |
| 516 | (direction_smooth _ hf).continuous |
| 517 | have haa : AngularContinuous (dtheta (dtheta f)) := angularContinuous_of_continuous |
| 518 | (direction_smooth _ (direction_smooth _ hf)).continuous |
| 519 | have hzz : AngularContinuous (dz (dz f)) := angularContinuous_of_continuous |
| 520 | (direction_smooth _ (direction_smooth _ hf)).continuous |
| 521 | have hrd : AngularContinuous (fun y => dr f y / radius y) := by |
| 522 | simpa only [pow_one] using hr.div_radius 1 |
| 523 | unfold laplacian meanLaplacian |
| 524 | rw [average_add ((hrr.add hrd).add (haa.div_radius 2)) hzz, |
| 525 | average_add (hrr.add hrd) (haa.div_radius 2), average_add hrr hrd] |
| 526 | rw [show (fun y => dr f y / radius y) = (fun y => dr f y / radius y ^ 1) by simp] |
| 527 | rw [average_div_radius, average_div_radius, average_drdr hf, |
| 528 | average_dr hf, average_dzdz hf, |
| 529 | average_dtheta_zero (f := dtheta f) (direction_smooth _ hf) (hp.direction angularVector)] |
| 530 | simp |
| 531 | |
| 532 | noncomputable def reynoldsRadial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 533 | dt (average (w 0)) q + radialDivergence 1 (average (fun y => w 0 y * w 0 y)) q + |
| 534 | dz (average (fun y => w 2 y * w 0 y)) q - average (fun y => w 1 y * w 1 y) q / radius q - |
| 535 | meanLaplacian (average (w 0)) q + average (w 0) q / radius q ^ 2 + dr (average p) q |
| 536 | |
| 537 | noncomputable def reynoldsAngular (w : Components) (q : SpaceTime) : ℝ := |
| 538 | dt (average (w 1)) q + radialDivergence 2 (average (fun y => w 0 y * w 1 y)) q + |
| 539 | dz (average (fun y => w 2 y * w 1 y)) q - meanLaplacian (average (w 1)) q + |
| 540 | average (w 1) q / radius q ^ 2 |
| 541 | |
| 542 | noncomputable def reynoldsAxial (w : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 543 | dt (average (w 2)) q + radialDivergence 1 (average (fun y => w 0 y * w 2 y)) q + |
| 544 | dz (average (fun y => w 2 y * w 2 y)) q - meanLaplacian (average (w 2)) q + |
| 545 | dz (average p) q |
| 546 | |
| 547 | theorem average_conservativeAngular {w : Components} {p : Scalar} |
| 548 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 549 | (hwper : ∀ i, AngularPeriodic (w i)) (hpper : AngularPeriodic p) (q : SpaceTime) : |
| 550 | average (conservativeAngular w p) q = reynoldsAngular w q := by |
| 551 | have h1 : AngularContinuous (dt (w 1)) := angularContinuous_direction (hw 1) _ |
| 552 | have h2 := angularContinuous_radialDivergence ((hw 0).mul (hw 1)) 2 |
| 553 | have h3 : AngularContinuous (fun y => dtheta (fun y => w 1 y * w 1 y) y / radius y) := |
| 554 | (angularContinuous_direction ((hw 1).mul (hw 1)) _).div_r |
| 555 | have h4 : AngularContinuous (dz (fun y => w 2 y * w 1 y)) := |
| 556 | angularContinuous_direction ((hw 2).mul (hw 1)) _ |
| 557 | have h5 := angularContinuous_laplacian (hw 1) |
| 558 | have h6 := (angularContinuous_of_continuous (hw 1).continuous).div_radius 2 |
| 559 | have h7 : AngularContinuous (fun y => 2 * dtheta (w 0) y / radius y ^ 2) := |
| 560 | ((angularContinuous_direction (hw 0) _).const_mul 2).div_radius 2 |
| 561 | have h8 : AngularContinuous (fun y => dtheta p y / radius y) := |
| 562 | (angularContinuous_direction hp _).div_r |
| 563 | unfold conservativeAngular |
| 564 | simp (disch := solve_by_elim (maxDepth := 20) [AngularContinuous.add, AngularContinuous.sub]) |
| 565 | only [average_add, average_sub] |
| 566 | rw [average_radialDivergence ((hw 0).mul (hw 1)), |
| 567 | average_laplacian (hw 1) (hwper 1)] |
| 568 | rw [average_dt (hw 1), average_dz ((hw 2).mul (hw 1))] |
| 569 | rw [show (fun y => dtheta (fun y => w 1 y * w 1 y) y / radius y) = |
| 570 | (fun y => dtheta (fun y => w 1 y * w 1 y) y / radius y ^ 1) by simp] |
| 571 | rw [show (fun y => dtheta p y / radius y) = (fun y => dtheta p y / radius y ^ 1) by simp] |
| 572 | rw [average_div_radius, average_div_radius, average_div_radius, average_div_radius, |
| 573 | average_const_mul, average_dtheta_zero ((hw 1).mul (hw 1)) ((hwper 1).mul (hwper 1)), |
| 574 | average_dtheta_zero (hw 0) (hwper 0), average_dtheta_zero hp hpper] |
| 575 | simp [reynoldsAngular, dt, dz] |
| 576 | |
| 577 | theorem average_conservativeRadial {w : Components} {p : Scalar} |
| 578 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 579 | (hwper : ∀ i, AngularPeriodic (w i)) (q : SpaceTime) : |
| 580 | average (conservativeRadial w p) q = reynoldsRadial w p q := by |
| 581 | have h1 : AngularContinuous (dt (w 0)) := angularContinuous_direction (hw 0) _ |
| 582 | have h2 := angularContinuous_radialDivergence ((hw 0).mul (hw 0)) 1 |
| 583 | have h3 : AngularContinuous (fun y => dtheta (fun y => w 1 y * w 0 y) y / radius y) := |
| 584 | (angularContinuous_direction ((hw 1).mul (hw 0)) _).div_r |
| 585 | have h4 : AngularContinuous (dz (fun y => w 2 y * w 0 y)) := |
| 586 | angularContinuous_direction ((hw 2).mul (hw 0)) _ |
| 587 | have h5 := (angularContinuous_of_continuous ((hw 1).mul (hw 1)).continuous).div_r |
| 588 | have h6 := angularContinuous_laplacian (hw 0) |
| 589 | have h7 := (angularContinuous_of_continuous (hw 0).continuous).div_radius 2 |
| 590 | have h8 : AngularContinuous (fun y => 2 * dtheta (w 1) y / radius y ^ 2) := |
| 591 | ((angularContinuous_direction (hw 1) _).const_mul 2).div_radius 2 |
| 592 | have h9 : AngularContinuous (dr p) := angularContinuous_direction hp _ |
| 593 | unfold conservativeRadial |
| 594 | simp (disch := solve_by_elim (maxDepth := 20) [AngularContinuous.add, AngularContinuous.sub]) |
| 595 | only [average_add, average_sub] |
| 596 | rw [average_radialDivergence ((hw 0).mul (hw 0)), average_laplacian (hw 0) (hwper 0), |
| 597 | average_dt (hw 0), average_dz ((hw 2).mul (hw 0)), average_dr hp] |
| 598 | simp only [average_div_r, average_div_radius, average_const_mul, |
| 599 | average_dtheta_zero ((hw 1).mul (hw 0)) ((hwper 1).mul (hwper 0)), |
| 600 | average_dtheta_zero (hw 1) (hwper 1), zero_div, mul_zero, add_zero] |
| 601 | rfl |
| 602 | |
| 603 | theorem average_conservativeAxial {w : Components} {p : Scalar} |
| 604 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 605 | (hwper : ∀ i, AngularPeriodic (w i)) (q : SpaceTime) : |
| 606 | average (conservativeAxial w p) q = reynoldsAxial w p q := by |
| 607 | have h1 : AngularContinuous (dt (w 2)) := angularContinuous_direction (hw 2) _ |
| 608 | have h2 := angularContinuous_radialDivergence ((hw 0).mul (hw 2)) 1 |
| 609 | have h3 : AngularContinuous (fun y => dtheta (fun y => w 1 y * w 2 y) y / radius y) := |
| 610 | (angularContinuous_direction ((hw 1).mul (hw 2)) _).div_r |
| 611 | have h4 : AngularContinuous (dz (fun y => w 2 y * w 2 y)) := |
| 612 | angularContinuous_direction ((hw 2).mul (hw 2)) _ |
| 613 | have h5 := angularContinuous_laplacian (hw 2) |
| 614 | have h6 : AngularContinuous (dz p) := angularContinuous_direction hp _ |
| 615 | unfold conservativeAxial |
| 616 | simp (disch := solve_by_elim (maxDepth := 20) [AngularContinuous.add, AngularContinuous.sub]) |
| 617 | only [average_add, average_sub] |
| 618 | rw [average_radialDivergence ((hw 0).mul (hw 2)), average_laplacian (hw 2) (hwper 2), |
| 619 | average_dt (hw 2), average_dz ((hw 2).mul (hw 2)), average_dz hp] |
| 620 | simp only [average_div_r, |
| 621 | average_dtheta_zero ((hw 1).mul (hw 2)) ((hwper 1).mul (hwper 2)), zero_div, add_zero] |
| 622 | rfl |
| 623 | |
| 624 | theorem average_residualRadial {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 (residualRadial w p) q = reynoldsRadial w p q := by |
| 630 | have he : average (residualRadial w p) q = average (conservativeRadial 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 (conservativeRadial_eq hw p (angularShift q a)).symm |
| 635 | rw [he, average_conservativeRadial hw hp hwper] |
| 636 | |
| 637 | theorem average_residualAngular {w : Components} {p : Scalar} |
| 638 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 639 | (hwper : ∀ i, AngularPeriodic (w i)) (hpper : AngularPeriodic p) |
| 640 | (hdiv : ∀ y, 0 < radius y → divergence w y = 0) |
| 641 | (q : SpaceTime) (hr : 0 < radius q) : |
| 642 | average (residualAngular w p) q = reynoldsAngular w q := by |
| 643 | have he : average (residualAngular w p) q = average (conservativeAngular w p) q := by |
| 644 | apply average_congr |
| 645 | intro a _ |
| 646 | have hd := hdiv (angularShift q a) (by simpa only [radius_angularShift] using hr) |
| 647 | simpa only [hd, mul_zero, add_zero] using (conservativeAngular_eq hw p (angularShift q a)).symm |
| 648 | rw [he, average_conservativeAngular hw hp hwper hpper] |
| 649 | |
| 650 | theorem average_residualAxial {w : Components} {p : Scalar} |
| 651 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hp : ContDiff ℝ ∞ p) |
| 652 | (hwper : ∀ i, AngularPeriodic (w i)) |
| 653 | (hdiv : ∀ y, 0 < radius y → divergence w y = 0) |
| 654 | (q : SpaceTime) (hr : 0 < radius q) : |
| 655 | average (residualAxial w p) q = reynoldsAxial w p q := by |
| 656 | have he : average (residualAxial w p) q = average (conservativeAxial w p) q := by |
| 657 | apply average_congr |
| 658 | intro a _ |
| 659 | have hd := hdiv (angularShift q a) (by simpa only [radius_angularShift] using hr) |
| 660 | simpa only [hd, mul_zero, add_zero] using (conservativeAxial_eq hw p (angularShift q a)).symm |
| 661 | rw [he, average_conservativeAxial hw hp hwper] |
| 662 | |
| 663 | omit [NormedSpace ℝ E] in |
| 664 | theorem AngularInvariant.add {f g : SpaceTime → E} |
| 665 | (hf : AngularInvariant f) (hg : AngularInvariant g) : |
| 666 | AngularInvariant (fun q => f q + g q) := by |
| 667 | intro q a |
| 668 | exact congrArg₂ (· + ·) (hf q a) (hg q a) |
| 669 | |
| 670 | theorem AngularInvariant.mul {f g : Scalar} |
| 671 | (hf : AngularInvariant f) (hg : AngularInvariant g) : |
| 672 | AngularInvariant (fun q => f q * g q) := by |
| 673 | intro q a |
| 674 | exact congrArg₂ (· * ·) (hf q a) (hg q a) |
| 675 | |
| 676 | omit [NormedSpace ℝ E] in |
| 677 | theorem AngularPeriodic.add {f g : SpaceTime → E} |
| 678 | (hf : AngularPeriodic f) (hg : AngularPeriodic g) : |
| 679 | AngularPeriodic (fun q => f q + g q) := by |
| 680 | intro q |
| 681 | exact congrArg₂ (· + ·) (hf q) (hg q) |
| 682 | |
| 683 | /-- The complete velocity split, with no omission of any part of `osc`. -/ |
| 684 | noncomputable def total (base mean osc : Components) : Components := |
| 685 | fun i q => base i q + mean i q + osc i q |
| 686 | |
| 687 | /-- The exact Reynolds product of the full oscillatory fields. -/ |
| 688 | noncomputable def covariance (osc : Components) (i j : Fin 3) : Scalar := |
| 689 | average (fun q => osc i q * osc j q) |
| 690 | |
| 691 | noncomputable def fluxDifference (base mean osc : Components) (i j : Fin 3) : Scalar := |
| 692 | fun q => base i q * mean j q + mean i q * base j q + |
| 693 | mean i q * mean j q + covariance osc i j q |
| 694 | |
| 695 | theorem covariance_smooth {osc : Components} (ho : ∀ i, ContDiff ℝ ∞ (osc i)) (i j : Fin 3) : |
| 696 | ContDiff ℝ ∞ (covariance osc i j) := average_smooth ((ho i).mul (ho j)) |
| 697 | |
| 698 | theorem covariance_symm (osc : Components) (i j : Fin 3) : covariance osc i j = covariance osc j i := by |
| 699 | simp only [covariance, mul_comm] |
| 700 | |
| 701 | theorem total_smooth {base mean osc : Components} |
| 702 | (hb : ∀ i, ContDiff ℝ ∞ (base i)) (hm : ∀ i, ContDiff ℝ ∞ (mean i)) |
| 703 | (ho : ∀ i, ContDiff ℝ ∞ (osc i)) (i : Fin 3) : |
| 704 | ContDiff ℝ ∞ (total base mean osc i) := ((hb i).add (hm i)).add (ho i) |
| 705 | |
| 706 | theorem fluxDifference_smooth {base mean osc : Components} |
| 707 | (hb : ∀ i, ContDiff ℝ ∞ (base i)) (hm : ∀ i, ContDiff ℝ ∞ (mean i)) |
| 708 | (ho : ∀ i, ContDiff ℝ ∞ (osc i)) (i j : Fin 3) : |
| 709 | ContDiff ℝ ∞ (fluxDifference base mean osc i j) := |
| 710 | ((((hb i).mul (hm j)).add ((hm i).mul (hb j))).add ((hm i).mul (hm j))).add |
| 711 | (covariance_smooth ho i j) |
| 712 | |
| 713 | theorem total_periodic {base mean osc : Components} |
| 714 | (hb : ∀ i, AngularInvariant (base i)) (hm : ∀ i, AngularInvariant (mean i)) |
| 715 | (ho : ∀ i, AngularPeriodic (osc i)) (i : Fin 3) : |
| 716 | AngularPeriodic (total base mean osc i) := |
| 717 | AngularPeriodic.add (AngularPeriodic.add (fun q => hb i q period) |
| 718 | (fun q => hm i q period)) (ho i) |
| 719 | |
| 720 | theorem average_affine_product {a b f g : Scalar} |
| 721 | (ha : AngularInvariant a) (hb : AngularInvariant b) |
| 722 | (hf : AngularContinuous f) (hg : AngularContinuous g) |
| 723 | (q : SpaceTime) (hf0 : average f q = 0) (hg0 : average g q = 0) : |
| 724 | average (fun y => (a y + f y) * (b y + g y)) q = |
| 725 | a q * b q + average (fun y => f y * g y) q := by |
| 726 | have he : (fun y => (a y + f y) * (b y + g y)) = |
| 727 | (fun y => a y * b y + a y * g y + b y * f y + f y * g y) := by |
| 728 | funext y |
| 729 | ring |
| 730 | have h1 := ha.angularContinuous.mul hb.angularContinuous |
| 731 | have h2 := ha.angularContinuous.mul hg |
| 732 | have h3 := hb.angularContinuous.mul hf |
| 733 | have h4 := hf.mul hg |
| 734 | rw [he, average_add ((h1.add h2).add h3) h4, average_add (h1.add h2) h3, |
| 735 | average_add h1 h2, average_invariant (ha.mul hb), |
| 736 | average_mul_invariant ha, average_mul_invariant hb, hf0, hg0] |
| 737 | ring |
| 738 | |
| 739 | theorem average_total {base mean osc : Components} |
| 740 | (hb : ∀ i, AngularInvariant (base i)) (hm : ∀ i, AngularInvariant (mean i)) |
| 741 | (ho : ∀ i, AngularContinuous (osc i)) |
| 742 | (hz : ∀ i q, average (osc i) q = 0) (i : Fin 3) : |
| 743 | average (total base mean osc i) = fun q => base i q + mean i q := by |
| 744 | funext q |
| 745 | unfold total |
| 746 | rw [average_add ((hb i).angularContinuous.add (hm i).angularContinuous) (ho i), |
| 747 | average_add (hb i).angularContinuous (hm i).angularContinuous, |
| 748 | average_invariant (hb i), average_invariant (hm i), hz] |
| 749 | simp |
| 750 | |
| 751 | theorem average_total_product {base mean osc : Components} |
| 752 | (hb : ∀ i, AngularInvariant (base i)) (hm : ∀ i, AngularInvariant (mean i)) |
| 753 | (ho : ∀ i, AngularContinuous (osc i)) |
| 754 | (hz : ∀ i q, average (osc i) q = 0) (i j : Fin 3) : |
| 755 | average (fun q => total base mean osc i q * total base mean osc j q) = |
| 756 | fun q => base i q * base j q + fluxDifference base mean osc i j q := by |
| 757 | funext q |
| 758 | unfold total |
| 759 | rw [average_affine_product ((hb i).add (hm i)) ((hb j).add (hm j)) |
| 760 | (ho i) (ho j) q (hz i q) (hz j q)] |
| 761 | unfold fluxDifference covariance |
| 762 | ring |
| 763 | |
| 764 | theorem fluxDifference_diagonal (base mean osc : Components) (i : Fin 3) (q : SpaceTime) : |
| 765 | fluxDifference base mean osc i i q = |
| 766 | 2 * base i q * mean i q + (mean i q) ^ 2 + covariance osc i i q := by |
| 767 | unfold fluxDifference |
| 768 | ring |
| 769 | |
| 770 | theorem direction_twice_add {f g : SpaceTime → E} (hf : ContDiff ℝ ∞ f) |
| 771 | (hg : ContDiff ℝ ∞ g) (v w q : SpaceTime) : |
| 772 | direction v (direction w (fun y => f y + g y)) q = |
| 773 | direction v (direction w f) q + direction v (direction w g) q := by |
| 774 | rw [show direction w (fun y => f y + g y) = |
| 775 | (fun y => direction w f y + direction w g y) from funext (direction_add hf hg w)] |
| 776 | exact direction_add (direction_smooth _ hf) (direction_smooth _ hg) v q |
| 777 | |
| 778 | theorem meanLaplacian_add {f g : Scalar} (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) |
| 779 | (q : SpaceTime) : meanLaplacian (fun y => f y + g y) q = |
| 780 | meanLaplacian f q + meanLaplacian g q := by |
| 781 | simp only [meanLaplacian, dr, dz, direction_twice_add hf hg, direction_add hf hg] |
| 782 | ring |
| 783 | |
| 784 | theorem radialDivergence_add {f g : Scalar} (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) |
| 785 | (c : ℝ) (q : SpaceTime) : radialDivergence c (fun y => f y + g y) q = |
| 786 | radialDivergence c f q + radialDivergence c g q := by |
| 787 | simp only [radialDivergence, dr, direction_add hf hg] |
| 788 | ring |
| 789 | |
| 790 | noncomputable def baseRadial (b : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 791 | dt (b 0) q + radialDivergence 1 (fun y => b 0 y * b 0 y) q + |
| 792 | dz (fun y => b 2 y * b 0 y) q - b 1 q * b 1 q / radius q - |
| 793 | meanLaplacian (b 0) q + b 0 q / radius q ^ 2 + dr p q |
| 794 | |
| 795 | noncomputable def baseAngular (b : Components) (q : SpaceTime) : ℝ := |
| 796 | dt (b 1) q + radialDivergence 2 (fun y => b 0 y * b 1 y) q + |
| 797 | dz (fun y => b 2 y * b 1 y) q - meanLaplacian (b 1) q + b 1 q / radius q ^ 2 |
| 798 | |
| 799 | noncomputable def baseAxial (b : Components) (p : Scalar) (q : SpaceTime) : ℝ := |
| 800 | dt (b 2) q + radialDivergence 1 (fun y => b 0 y * b 2 y) q + |
| 801 | dz (fun y => b 2 y * b 2 y) q - meanLaplacian (b 2) q + dz p q |
| 802 | |
| 803 | /-- Physical version of `E_theta` in (32), with viscosity one. -/ |
| 804 | noncomputable def Etheta (b m o : Components) (Ttheta : Scalar) (q : SpaceTime) : ℝ := |
| 805 | dt (m 1) q + radialDivergence 2 (fluxDifference b m o 0 1) q + |
| 806 | dz (fluxDifference b m o 2 1) q - meanLaplacian (m 1) q + m 1 q / radius q ^ 2 - |
| 807 | radialDivergence 2 Ttheta q |
| 808 | |
| 809 | /-- Physical version of `E_z` in (32), with viscosity one. -/ |
| 810 | noncomputable def Ez (b m o : Components) (pm Tz : Scalar) (q : SpaceTime) : ℝ := |
| 811 | dt (m 2) q + radialDivergence 1 (fluxDifference b m o 0 2) q + |
| 812 | dz (fun y => fluxDifference b m o 2 2 y + pm y) q - meanLaplacian (m 2) q - |
| 813 | radialDivergence 1 Tz q |
| 814 | |
| 815 | /-- Required physical radial pressure derivative in (32). -/ |
| 816 | noncomputable def gr (b m o : Components) (q : SpaceTime) : ℝ := |
| 817 | -(dt (m 0) q + radialDivergence 1 (fluxDifference b m o 0 0) q + |
| 818 | dz (fluxDifference b m o 2 0) q - fluxDifference b m o 1 1 q / radius q - |
| 819 | meanLaplacian (m 0) q + m 0 q / radius q ^ 2) |
| 820 | |
| 821 | theorem reynoldsAngular_total_sub {b m o : Components} |
| 822 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hm : ∀ i, ContDiff ℝ ∞ (m i)) |
| 823 | (ho : ∀ i, ContDiff ℝ ∞ (o i)) |
| 824 | (hbi : ∀ i, AngularInvariant (b i)) (hmi : ∀ i, AngularInvariant (m i)) |
| 825 | (hz : ∀ i q, average (o i) q = 0) (Ttheta : Scalar) (q : SpaceTime) : |
| 826 | reynoldsAngular (total b m o) q - baseAngular b q - radialDivergence 2 Ttheta q = |
| 827 | Etheta b m o Ttheta q := by |
| 828 | have hoc i := angularContinuous_of_continuous (ho i).continuous |
| 829 | have hflux := fluxDifference_smooth hb hm ho |
| 830 | unfold reynoldsAngular baseAngular Etheta |
| 831 | rw [average_total hbi hmi hoc hz 1, average_total_product hbi hmi hoc hz 0 1, |
| 832 | average_total_product hbi hmi hoc hz 2 1, |
| 833 | radialDivergence_add ((hb 0).mul (hb 1)) (hflux 0 1), meanLaplacian_add (hb 1) (hm 1)] |
| 834 | simp only [dt, dz, direction_add (hb 1) (hm 1), direction_add ((hb 2).mul (hb 1)) (hflux 2 1)] |
| 835 | ring |
| 836 | |
| 837 | theorem reynoldsRadial_total_sub {b m o : Components} {p pb pm : Scalar} |
| 838 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hm : ∀ i, ContDiff ℝ ∞ (m i)) |
| 839 | (ho : ∀ i, ContDiff ℝ ∞ (o i)) (hpb : ContDiff ℝ ∞ pb) (hpm : ContDiff ℝ ∞ pm) |
| 840 | (hbi : ∀ i, AngularInvariant (b i)) (hmi : ∀ i, AngularInvariant (m i)) |
| 841 | (hz : ∀ i q, average (o i) q = 0) |
| 842 | (hpavg : average p = fun q => pb q + pm q) (q : SpaceTime) : |
| 843 | reynoldsRadial (total b m o) p q - baseRadial b pb q = dr pm q - gr b m o q := by |
| 844 | have hoc i := angularContinuous_of_continuous (ho i).continuous |
| 845 | have hflux := fluxDifference_smooth hb hm ho |
| 846 | unfold reynoldsRadial baseRadial gr |
| 847 | rw [average_total hbi hmi hoc hz 0, average_total_product hbi hmi hoc hz 0 0, |
| 848 | average_total_product hbi hmi hoc hz 2 0, average_total_product hbi hmi hoc hz 1 1, |
| 849 | hpavg, radialDivergence_add ((hb 0).mul (hb 0)) (hflux 0 0), |
| 850 | meanLaplacian_add (hb 0) (hm 0)] |
| 851 | simp only [dt, dr, dz, direction_add (hb 0) (hm 0), direction_add ((hb 2).mul (hb 0)) (hflux 2 0), |
| 852 | direction_add hpb hpm] |
| 853 | ring |
| 854 | |
| 855 | theorem reynoldsAxial_total_sub {b m o : Components} {p pb pm : Scalar} |
| 856 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hm : ∀ i, ContDiff ℝ ∞ (m i)) |
| 857 | (ho : ∀ i, ContDiff ℝ ∞ (o i)) (hpb : ContDiff ℝ ∞ pb) (hpm : ContDiff ℝ ∞ pm) |
| 858 | (hbi : ∀ i, AngularInvariant (b i)) (hmi : ∀ i, AngularInvariant (m i)) |
| 859 | (hz : ∀ i q, average (o i) q = 0) |
| 860 | (hpavg : average p = fun q => pb q + pm q) (Tz : Scalar) (q : SpaceTime) : |
| 861 | reynoldsAxial (total b m o) p q - baseAxial b pb q - radialDivergence 1 Tz q = |
| 862 | Ez b m o pm Tz q := by |
| 863 | have hoc i := angularContinuous_of_continuous (ho i).continuous |
| 864 | have hflux := fluxDifference_smooth hb hm ho |
| 865 | unfold reynoldsAxial baseAxial Ez |
| 866 | rw [average_total hbi hmi hoc hz 2, average_total_product hbi hmi hoc hz 0 2, |
| 867 | average_total_product hbi hmi hoc hz 2 2, hpavg, |
| 868 | radialDivergence_add ((hb 0).mul (hb 2)) (hflux 0 2), meanLaplacian_add (hb 2) (hm 2)] |
| 869 | simp only [dt, dz, direction_add (hb 2) (hm 2), direction_add ((hb 2).mul (hb 2)) (hflux 2 2), |
| 870 | direction_add hpb hpm, direction_add (hflux 2 2) hpm] |
| 871 | ring |
| 872 | |
| 873 | theorem reynoldsAngular_invariant {b : Components} (hbi : ∀ i, AngularInvariant (b i)) |
| 874 | (q : SpaceTime) : reynoldsAngular b q = baseAngular b q := by |
| 875 | have h1 i : average (b i) = b i := funext (average_invariant (hbi i)) |
| 876 | have h2 i j : average (fun y => b i y * b j y) = (fun y => b i y * b j y) := |
| 877 | funext (average_invariant ((hbi i).mul (hbi j))) |
| 878 | simp only [reynoldsAngular, h1, h2, baseAngular] |
| 879 | |
| 880 | theorem reynoldsRadial_invariant {b : Components} {p : Scalar} |
| 881 | (hbi : ∀ i, AngularInvariant (b i)) (hpi : AngularInvariant p) |
| 882 | (q : SpaceTime) : reynoldsRadial b p q = baseRadial b p q := by |
| 883 | have h1 i : average (b i) = b i := funext (average_invariant (hbi i)) |
| 884 | have h2 i j : average (fun y => b i y * b j y) = (fun y => b i y * b j y) := |
| 885 | funext (average_invariant ((hbi i).mul (hbi j))) |
| 886 | have h3 : average p = p := funext (average_invariant hpi) |
| 887 | simp only [reynoldsRadial, h1, h2, h3, baseRadial] |
| 888 | |
| 889 | theorem reynoldsAxial_invariant {b : Components} {p : Scalar} |
| 890 | (hbi : ∀ i, AngularInvariant (b i)) (hpi : AngularInvariant p) |
| 891 | (q : SpaceTime) : reynoldsAxial b p q = baseAxial b p q := by |
| 892 | have h1 i : average (b i) = b i := funext (average_invariant (hbi i)) |
| 893 | have h2 i j : average (fun y => b i y * b j y) = (fun y => b i y * b j y) := |
| 894 | funext (average_invariant ((hbi i).mul (hbi j))) |
| 895 | have h3 : average p = p := funext (average_invariant hpi) |
| 896 | simp only [reynoldsAxial, h1, h2, h3, baseAxial] |
| 897 | |
| 898 | theorem residuals_invariant {b : Components} {p : Scalar} |
| 899 | (hbi : ∀ i, AngularInvariant (b i)) (hpi : AngularInvariant p) : |
| 900 | AngularInvariant (residualRadial b p) ∧ AngularInvariant (residualAngular b p) ∧ |
| 901 | AngularInvariant (residualAxial b p) := by |
| 902 | have h0 : ∀ i q a, b i (angularShift q a) = b i q := fun i => hbi i |
| 903 | have h1 : ∀ i v q a, direction v (b i) (angularShift q a) = direction v (b i) q := |
| 904 | fun i v => (hbi i).direction v |
| 905 | have h2 : ∀ i v w q a, direction v (direction w (b i)) (angularShift q a) = |
| 906 | direction v (direction w (b i)) q := fun i v w => ((hbi i).direction w).direction v |
| 907 | have h3 : ∀ v q a, direction v p (angularShift q a) = direction v p q := |
| 908 | fun v => hpi.direction v |
| 909 | refine ⟨?_, ?_, ?_⟩ |
| 910 | all_goals |
| 911 | intro q a |
| 912 | simp only [residualRadial, residualAngular, residualAxial, transport, laplacian, |
| 913 | dt, dr, dtheta, dz, radius_angularShift, h0, h1, h2, h3] |
| 914 | |
| 915 | theorem base_residuals {b : Components} {p : Scalar} |
| 916 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hp : ContDiff ℝ ∞ p) |
| 917 | (hbi : ∀ i, AngularInvariant (b i)) (hpi : AngularInvariant p) |
| 918 | (hdiv : ∀ y, 0 < radius y → divergence b y = 0) |
| 919 | (q : SpaceTime) (hr : 0 < radius q) : |
| 920 | residualRadial b p q = baseRadial b p q ∧ |
| 921 | residualAngular b p q = baseAngular b q ∧ residualAxial b p q = baseAxial b p q := by |
| 922 | have hper : ∀ i, AngularPeriodic (b i) := fun i y => hbi i y period |
| 923 | have hip := residuals_invariant hbi hpi |
| 924 | have hR := average_residualRadial hb hp hper hdiv q hr |
| 925 | have hA := average_residualAngular hb hp hper (fun y => hpi y period) hdiv q hr |
| 926 | have hZ := average_residualAxial hb hp hper hdiv q hr |
| 927 | rw [average_invariant hip.1, reynoldsRadial_invariant hbi hpi] at hR |
| 928 | rw [average_invariant hip.2.1, reynoldsAngular_invariant hbi] at hA |
| 929 | rw [average_invariant hip.2.2, reynoldsAxial_invariant hbi hpi] at hZ |
| 930 | exact ⟨hR, hA, hZ⟩ |
| 931 | |
| 932 | /-- Exact physical mean balances (32) for the actual cylindrical residual. |
| 933 | The tensor entries are the prescribed physical radial flux entries; `covariance` |
| 934 | is the integral of the entire oscillatory field, including any curl corrections. -/ |
| 935 | theorem exact_mean_balances {b m o : Components} {p pb pm : Scalar} |
| 936 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hm : ∀ i, ContDiff ℝ ∞ (m i)) |
| 937 | (ho : ∀ i, ContDiff ℝ ∞ (o i)) (hp : ContDiff ℝ ∞ p) |
| 938 | (hpb : ContDiff ℝ ∞ pb) (hpm : ContDiff ℝ ∞ pm) |
| 939 | (hbi : ∀ i, AngularInvariant (b i)) (hmi : ∀ i, AngularInvariant (m i)) |
| 940 | (hop : ∀ i, AngularPeriodic (o i)) (hpp : AngularPeriodic p) (hpbi : AngularInvariant pb) |
| 941 | (hz : ∀ i q, average (o i) q = 0) (hpavg : average p = fun q => pb q + pm q) |
| 942 | (hdiv : ∀ y, 0 < radius y → divergence (total b m o) y = 0) |
| 943 | (hbdiv : ∀ y, 0 < radius y → divergence b y = 0) |
| 944 | (Ttheta Tz : Scalar) (q : SpaceTime) (hr : 0 < radius q) : |
| 945 | (average (fun y => CylindricalResidual.cylindricalResidual |
| 946 | (velocity (total b m o)) p y.1 y.2 1) q - |
| 947 | CylindricalResidual.cylindricalResidual (velocity b) pb q.1 q.2 1 - |
| 948 | radialDivergence 2 Ttheta q = Etheta b m o Ttheta q) ∧ |
| 949 | (average (fun y => CylindricalResidual.cylindricalResidual |
| 950 | (velocity (total b m o)) p y.1 y.2 2) q - |
| 951 | CylindricalResidual.cylindricalResidual (velocity b) pb q.1 q.2 2 - |
| 952 | radialDivergence 1 Tz q = Ez b m o pm Tz q) ∧ |
| 953 | (average (fun y => CylindricalResidual.cylindricalResidual |
| 954 | (velocity (total b m o)) p y.1 y.2 0) q - |
| 955 | CylindricalResidual.cylindricalResidual (velocity b) pb q.1 q.2 0 = dr pm q - gr b m o q) := by |
| 956 | have ht := total_smooth hb hm ho |
| 957 | have htp := total_periodic hbi hmi hop |
| 958 | have hbase := base_residuals hb hpb hbi hpbi hbdiv q hr |
| 959 | have heA : (fun y => CylindricalResidual.cylindricalResidual |
| 960 | (velocity (total b m o)) p y.1 y.2 1) = residualAngular (total b m o) p := |
| 961 | funext (cylindricalResidual_angular ht hp) |
| 962 | have heZ : (fun y => CylindricalResidual.cylindricalResidual |
| 963 | (velocity (total b m o)) p y.1 y.2 2) = residualAxial (total b m o) p := |
| 964 | funext (cylindricalResidual_axial ht hp) |
| 965 | have heR : (fun y => CylindricalResidual.cylindricalResidual |
| 966 | (velocity (total b m o)) p y.1 y.2 0) = residualRadial (total b m o) p := |
| 967 | funext (cylindricalResidual_radial ht hp) |
| 968 | rw [heA, heZ, heR, cylindricalResidual_angular hb hpb, cylindricalResidual_axial hb hpb, |
| 969 | cylindricalResidual_radial hb hpb, hbase.1, hbase.2.1, hbase.2.2, |
| 970 | average_residualAngular ht hp htp hpp hdiv q hr, |
| 971 | average_residualAxial ht hp htp hdiv q hr, average_residualRadial ht hp htp hdiv q hr] |
| 972 | exact ⟨reynoldsAngular_total_sub hb hm ho hbi hmi hz Ttheta q, |
| 973 | reynoldsAxial_total_sub hb hm ho hpb hpm hbi hmi hz hpavg Tz q, |
| 974 | reynoldsRadial_total_sub hb hm ho hpb hpm hbi hmi hz hpavg q⟩ |
| 975 | |
| 976 | theorem Etheta_expanded (b m o : Components) (T : Scalar) (q : SpaceTime) : |
| 977 | Etheta b m o T q = dt (m 1) q + |
| 978 | radialDivergence 2 (fun y => b 0 y * m 1 y + m 0 y * b 1 y + |
| 979 | m 0 y * m 1 y + covariance o 0 1 y) q + |
| 980 | dz (fun y => b 2 y * m 1 y + b 1 y * m 2 y + m 2 y * m 1 y + covariance o 2 1 y) q - |
| 981 | (meanLaplacian (m 1) q - m 1 q / radius q ^ 2) - radialDivergence 2 T q := by |
| 982 | have he : fluxDifference b m o 2 1 = |
| 983 | (fun y => b 2 y * m 1 y + b 1 y * m 2 y + m 2 y * m 1 y + covariance o 2 1 y) := by |
| 984 | funext y |
| 985 | unfold fluxDifference |
| 986 | ring |
| 987 | have he01 : fluxDifference b m o 0 1 = |
| 988 | (fun y => b 0 y * m 1 y + m 0 y * b 1 y + m 0 y * m 1 y + covariance o 0 1 y) := rfl |
| 989 | unfold Etheta |
| 990 | rw [he, he01] |
| 991 | ring |
| 992 | |
| 993 | theorem Ez_expanded (b m o : Components) (pm T : Scalar) (q : SpaceTime) : |
| 994 | Ez b m o pm T q = dt (m 2) q + |
| 995 | radialDivergence 1 (fun y => b 0 y * m 2 y + m 0 y * b 2 y + |
| 996 | m 0 y * m 2 y + covariance o 0 2 y) q + |
| 997 | dz (fun y => 2 * b 2 y * m 2 y + (m 2 y) ^ 2 + covariance o 2 2 y + pm y) q - |
| 998 | meanLaplacian (m 2) q - radialDivergence 1 T q := by |
| 999 | simp only [Ez, fluxDifference_diagonal] |
| 1000 | rfl |
| 1001 | |
| 1002 | theorem gr_expanded (b m o : Components) (q : SpaceTime) : |
| 1003 | gr b m o q = -(dt (m 0) q + |
| 1004 | radialDivergence 1 (fun y => 2 * b 0 y * m 0 y + (m 0 y) ^ 2 + covariance o 0 0 y) q + |
| 1005 | dz (fun y => b 0 y * m 2 y + b 2 y * m 0 y + m 0 y * m 2 y + covariance o 2 0 y) q - |
| 1006 | (2 * b 1 q * m 1 q + (m 1 q) ^ 2 + covariance o 1 1 q) / radius q - |
| 1007 | (meanLaplacian (m 0) q - m 0 q / radius q ^ 2)) := by |
| 1008 | have he0 : fluxDifference b m o 0 0 = |
| 1009 | (fun y => 2 * b 0 y * m 0 y + (m 0 y) ^ 2 + covariance o 0 0 y) := |
| 1010 | funext (fluxDifference_diagonal b m o 0) |
| 1011 | have he2 : fluxDifference b m o 2 0 = |
| 1012 | (fun y => b 0 y * m 2 y + b 2 y * m 0 y + m 0 y * m 2 y + covariance o 2 0 y) := by |
| 1013 | funext y |
| 1014 | unfold fluxDifference |
| 1015 | ring |
| 1016 | unfold gr |
| 1017 | rw [he0, he2, fluxDifference_diagonal] |
| 1018 | ring |
| 1019 | |
| 1020 | /-- The perturbation pressure is defined from its actual angular mean. -/ |
| 1021 | noncomputable def meanPressure (p pb : Scalar) : Scalar := fun q => average p q - pb q |
| 1022 | |
| 1023 | theorem meanPressure_smooth {p pb : Scalar} (hp : ContDiff ℝ ∞ p) (hpb : ContDiff ℝ ∞ pb) : |
| 1024 | ContDiff ℝ ∞ (meanPressure p pb) := (average_smooth hp).sub hpb |
| 1025 | |
| 1026 | theorem meanPressure_reconstruction (p pb : Scalar) : |
| 1027 | average p = fun q => pb q + meanPressure p pb q := by |
| 1028 | funext q |
| 1029 | unfold meanPressure |
| 1030 | ring |
| 1031 | |
| 1032 | theorem cylindricalDivergence_eq {w : Components} (hw : ∀ i, ContDiff ℝ ∞ (w i)) |
| 1033 | (q : SpaceTime) : |
| 1034 | CylindricalResidual.vectorDivergence (fun y => velocity w (q.1, y)) q.2 = divergence w q := by |
| 1035 | simp only [CylindricalResidual.vectorDivergence, spatial_direction (velocity_smooth hw), |
| 1036 | direction_velocity_component hw, velocity_apply, divergence, dr, dtheta, dz, angularVector, radius] |
| 1037 | |
| 1038 | def Represents (u : VelocityField) (w : Components) : Prop := |
| 1039 | ∀ q : SpaceTime, u (q.1, CylindricalResidual.chart q.2) = |
| 1040 | CylindricalResidual.frame (q.2 1) (velocity w q) |
| 1041 | |
| 1042 | theorem Represents.components {u : VelocityField} {w : Components} (h : Represents u w) : |
| 1043 | CylindricalResidual.velocityComponents u = velocity w := by |
| 1044 | funext q |
| 1045 | change CylindricalResidual.frame (-(q.2 1)) (u (q.1, CylindricalResidual.chart q.2)) = velocity w q |
| 1046 | rw [h q, CylindricalResidual.frame_inverse] |
| 1047 | |
| 1048 | /-- Exact physical Cartesian residual resolved in the cylindrical frame. -/ |
| 1049 | noncomputable def cartesianResidual (u : VelocityField) (p : PressureField) |
| 1050 | (i : Fin 3) (q : SpaceTime) : ℝ := |
| 1051 | (CylindricalResidual.frame (-(q.2 1)) |
| 1052 | (navierStokesResidual u p q.1 (CylindricalResidual.chart q.2))) i |
| 1053 | |
| 1054 | theorem cartesianResidual_eq {u : VelocityField} {p : PressureField} |
| 1055 | {w : Components} {P : Scalar} (hrep : Represents u w) |
| 1056 | (hpull : CylindricalResidual.pressurePullback p = P) |
| 1057 | (q : SpaceTime) (hr : 0 < radius q) |
| 1058 | (hu : ContDiffAt ℝ 2 u (q.1, CylindricalResidual.chart q.2)) |
| 1059 | (hp : DifferentiableAt ℝ p (q.1, CylindricalResidual.chart q.2)) (i : Fin 3) : |
| 1060 | cartesianResidual u p i q = |
| 1061 | CylindricalResidual.cylindricalResidual (velocity w) P q.1 q.2 i := by |
| 1062 | unfold cartesianResidual |
| 1063 | rw [CylindricalResidual.navierStokesResidual_cylindrical hu hp hr, |
| 1064 | hrep.components, hpull, CylindricalResidual.frame_inverse] |
| 1065 | |
| 1066 | theorem cartesianDivergence_eq {u : VelocityField} {w : Components} |
| 1067 | (hw : ∀ i, ContDiff ℝ ∞ (w i)) (hrep : Represents u w) |
| 1068 | (q : SpaceTime) (hr : 0 < radius q) |
| 1069 | (hu : ContDiffAt ℝ 2 u (q.1, CylindricalResidual.chart q.2)) : |
| 1070 | spatialDivergence u q.1 (CylindricalResidual.chart q.2) = divergence w q := by |
| 1071 | have hs : DifferentiableAt ℝ (fun x => u (q.1, x)) (CylindricalResidual.chart q.2) := |
| 1072 | (hu.differentiableAt (by norm_num)).comp _ |
| 1073 | ((differentiableAt_const _).prodMk differentiableAt_id) |
| 1074 | rw [CylindricalResidual.divergence_cylindrical hs hr, hrep.components, cylindricalDivergence_eq hw] |
| 1075 | |
| 1076 | theorem average_cartesianResidual_eq {u : VelocityField} {p : PressureField} |
| 1077 | {w : Components} {P : Scalar} (hrep : Represents u w) |
| 1078 | (hpull : CylindricalResidual.pressurePullback p = P) |
| 1079 | (hu : ∀ y, 0 < radius y → ContDiffAt ℝ 2 u (y.1, CylindricalResidual.chart y.2)) |
| 1080 | (hp : ∀ y, 0 < radius y → DifferentiableAt ℝ p (y.1, CylindricalResidual.chart y.2)) |
| 1081 | (q : SpaceTime) (hr : 0 < radius q) (i : Fin 3) : |
| 1082 | average (cartesianResidual u p i) q = |
| 1083 | average (fun y => CylindricalResidual.cylindricalResidual (velocity w) P y.1 y.2 i) q := by |
| 1084 | apply average_congr |
| 1085 | intro a _ |
| 1086 | have hra : 0 < radius (angularShift q a) := by simpa only [radius_angularShift] using hr |
| 1087 | exact cartesianResidual_eq hrep hpull _ hra (hu _ hra) (hp _ hra) i |
| 1088 | |
| 1089 | /-- End-to-end mean balances for the actual Cartesian operators. Cartesian |
| 1090 | regularity is required only at positive-radius chart points. -/ |
| 1091 | theorem exact_cartesian_mean_balances |
| 1092 | {u ub : VelocityField} {P Pb : PressureField} {b m o : Components} {p pb pm : Scalar} |
| 1093 | (hb : ∀ i, ContDiff ℝ ∞ (b i)) (hm : ∀ i, ContDiff ℝ ∞ (m i)) |
| 1094 | (ho : ∀ i, ContDiff ℝ ∞ (o i)) (hp : ContDiff ℝ ∞ p) |
| 1095 | (hpb : ContDiff ℝ ∞ pb) (hpm : ContDiff ℝ ∞ pm) |
| 1096 | (hbi : ∀ i, AngularInvariant (b i)) (hmi : ∀ i, AngularInvariant (m i)) |
| 1097 | (hop : ∀ i, AngularPeriodic (o i)) (hpp : AngularPeriodic p) (hpbi : AngularInvariant pb) |
| 1098 | (hz : ∀ i q, average (o i) q = 0) (hpavg : average p = fun q => pb q + pm q) |
| 1099 | (hrep : Represents u (total b m o)) (hbrep : Represents ub b) |
| 1100 | (hpull : CylindricalResidual.pressurePullback P = p) |
| 1101 | (hbpull : CylindricalResidual.pressurePullback Pb = pb) |
| 1102 | (hu : ∀ y, 0 < radius y → ContDiffAt ℝ 2 u (y.1, CylindricalResidual.chart y.2)) |
| 1103 | (hub : ∀ y, 0 < radius y → ContDiffAt ℝ 2 ub (y.1, CylindricalResidual.chart y.2)) |
| 1104 | (hP : ∀ y, 0 < radius y → DifferentiableAt ℝ P (y.1, CylindricalResidual.chart y.2)) |
| 1105 | (hPb : ∀ y, 0 < radius y → DifferentiableAt ℝ Pb (y.1, CylindricalResidual.chart y.2)) |
| 1106 | (hdiv : ∀ y, 0 < radius y → spatialDivergence u y.1 (CylindricalResidual.chart y.2) = 0) |
| 1107 | (hbdiv : ∀ y, 0 < radius y → spatialDivergence ub y.1 (CylindricalResidual.chart y.2) = 0) |
| 1108 | (Ttheta Tz : Scalar) (q : SpaceTime) (hr : 0 < radius q) : |
| 1109 | (average (cartesianResidual u P 1) q - cartesianResidual ub Pb 1 q - |
| 1110 | radialDivergence 2 Ttheta q = Etheta b m o Ttheta q) ∧ |
| 1111 | (average (cartesianResidual u P 2) q - cartesianResidual ub Pb 2 q - |
| 1112 | radialDivergence 1 Tz q = Ez b m o pm Tz q) ∧ |
| 1113 | (average (cartesianResidual u P 0) q - cartesianResidual ub Pb 0 q = dr pm q - gr b m o q) := by |
| 1114 | have hdc : ∀ y, 0 < radius y → divergence (total b m o) y = 0 := by |
| 1115 | intro y hy |
| 1116 | rw [← cartesianDivergence_eq (total_smooth hb hm ho) hrep y hy (hu y hy)] |
| 1117 | exact hdiv y hy |
| 1118 | have hdbc : ∀ y, 0 < radius y → divergence b y = 0 := by |
| 1119 | intro y hy |
| 1120 | rw [← cartesianDivergence_eq hb hbrep y hy (hub y hy)] |
| 1121 | exact hbdiv y hy |
| 1122 | have h := exact_mean_balances hb hm ho hp hpb hpm hbi hmi hop hpp hpbi hz hpavg |
| 1123 | hdc hdbc Ttheta Tz q hr |
| 1124 | rw [average_cartesianResidual_eq hrep hpull hu hP q hr 1, |
| 1125 | average_cartesianResidual_eq hrep hpull hu hP q hr 2, |
| 1126 | average_cartesianResidual_eq hrep hpull hu hP q hr 0, |
| 1127 | cartesianResidual_eq hbrep hbpull q hr (hub q hr) (hPb q hr) 1, |
| 1128 | cartesianResidual_eq hbrep hbpull q hr (hub q hr) (hPb q hr) 2, |
| 1129 | cartesianResidual_eq hbrep hbpull q hr (hub q hr) (hPb q hr) 0] |
| 1130 | exact h |
| 1131 | |
| 1132 | theorem average_invariant_of_periodic [CompleteSpace E] {f : SpaceTime → E} |
| 1133 | (hf : ContDiff ℝ ∞ f) (hp : AngularPeriodic f) : AngularInvariant (average f) := by |
| 1134 | intro q a |
| 1135 | have hd : ∀ b : ℝ, HasDerivAt (fun c => average f (angularShift q c)) 0 b := by |
| 1136 | intro b |
| 1137 | have hs : HasDerivAt (fun c : ℝ => angularShift q c) angularVector b := by |
| 1138 | simpa [angularShift] using ((hasDerivAt_id b).smul_const angularVector).const_add q |
| 1139 | have hder : HasDerivAt (fun c => average f (angularShift q c)) |
| 1140 | (dtheta (average f) (angularShift q b)) b := |
| 1141 | (((average_smooth hf).differentiable (by simp)) (angularShift q b)).hasFDerivAt.comp_hasDerivAt b hs |
| 1142 | have hz : dtheta (average f) (angularShift q b) = 0 := by |
| 1143 | rw [show dtheta (average f) (angularShift q b) = average (dtheta f) (angularShift q b) from |
| 1144 | direction_average hf angularVector (angularShift q b), average_dtheta_zero hf hp] |
| 1145 | rwa [hz] at hder |
| 1146 | simpa only [angularShift_zero] using |
| 1147 | is_const_of_deriv_eq_zero (fun b => (hd b).differentiableAt) (fun b => (hd b).deriv) a 0 |
| 1148 | |
| 1149 | theorem covariance_invariant {o : Components} (ho : ∀ i, ContDiff ℝ ∞ (o i)) |
| 1150 | (hop : ∀ i, AngularPeriodic (o i)) (i j : Fin 3) : AngularInvariant (covariance o i j) := |
| 1151 | average_invariant_of_periodic ((ho i).mul (ho j)) ((hop i).mul (hop j)) |
| 1152 | |
| 1153 | /-- Substitution of (24) retains, rather than discards, its full base error. -/ |
| 1154 | theorem retain_base_error {Rtheta Rz Rr Btheta Bz Br Ttheta Tz Etheta Ez Drp gr |
| 1155 | ftheta fz fr : ℝ} |
| 1156 | (hθ : Rtheta - Btheta - Ttheta = Etheta) |
| 1157 | (hz : Rz - Bz - Tz = Ez) (hr : Rr - Br = Drp - gr) |
| 1158 | (hbθ : Btheta = -Ttheta + ftheta) (hbz : Bz = -Tz + fz) (hbr : Br = fr) : |
| 1159 | Rtheta = Etheta + ftheta ∧ Rz = Ez + fz ∧ Rr = Drp - gr + fr := by |
| 1160 | constructor |
| 1161 | · linarith |
| 1162 | constructor <;> linarith |
| 1163 | |
| 1164 | end |
| 1165 | |
| 1166 | end NavierStokes.MeanResidual |