| @@ -56,11 +56,6 @@ def scalarLaplacian (g : Space → ℝ) (x : Space) : ℝ := |
| 56 | 56 | def vectorLaplacian (g : Space → Space) (x : Space) : Space := |
| 57 | 57 | ∑ i : Fin 3, fderiv ℝ (fun y => fderiv ℝ g y (coordinateVector i)) x (coordinateVector i) |
| 58 | 58 | |
| 59 | | -theorem contDiff_direction {g : Space → ℝ} {m n : WithTop ℕ∞} |
| 60 | | - (hg : ContDiff ℝ n g) (hmn : m + 1 ≤ n) (i : Fin 3) : |
| 61 | | - ContDiff ℝ m (fun x => direction g i x) := |
| 62 | | - (hg.fderiv_right hmn).clm_apply contDiff_const |
| 63 | | - |
| 64 | 59 | theorem direction_add {a b : Space → ℝ} (ha : Differentiable ℝ a) |
| 65 | 60 | (hb : Differentiable ℝ b) (i : Fin 3) (x : Space) : |
| 66 | 61 | direction (fun y => a y + b y) i x = direction a i x + direction b i x := by |
| @@ -79,79 +74,10 @@ theorem direction_neg (a : Space → ℝ) (i : Fin 3) (x : Space) : |
| 79 | 74 | direction (fun y => -a y) i x = -direction a i x := by |
| 80 | 75 | simp [direction] |
| 81 | 76 | |
| 82 | | -theorem scalarLaplacian_add {a b : Space → ℝ} (ha : ContDiff ℝ 2 a) |
| 83 | | - (hb : ContDiff ℝ 2 b) (x : Space) : |
| 84 | | - scalarLaplacian (fun y => a y + b y) x = scalarLaplacian a x + scalarLaplacian b x := by |
| 85 | | - unfold scalarLaplacian |
| 86 | | - simp_rw [direction_add (ha.differentiable (by norm_num)) (hb.differentiable (by norm_num))] |
| 87 | | - simp_rw [direction_add |
| 88 | | - ((contDiff_direction ha (m := 1) (by norm_num) _).differentiable (by norm_num)) |
| 89 | | - ((contDiff_direction hb (m := 1) (by norm_num) _).differentiable (by norm_num))] |
| 90 | | - exact Finset.sum_add_distrib |
| 91 | | - |
| 92 | | -theorem scalarLaplacian_sub {a b : Space → ℝ} (ha : ContDiff ℝ 2 a) |
| 93 | | - (hb : ContDiff ℝ 2 b) (x : Space) : |
| 94 | | - scalarLaplacian (fun y => a y - b y) x = scalarLaplacian a x - scalarLaplacian b x := by |
| 95 | | - unfold scalarLaplacian |
| 96 | | - simp_rw [direction_sub (ha.differentiable (by norm_num)) (hb.differentiable (by norm_num))] |
| 97 | | - simp_rw [direction_sub |
| 98 | | - ((contDiff_direction ha (m := 1) (by norm_num) _).differentiable (by norm_num)) |
| 99 | | - ((contDiff_direction hb (m := 1) (by norm_num) _).differentiable (by norm_num))] |
| 100 | | - simp only [Finset.sum_sub_distrib] |
| 101 | | - |
| 102 | 77 | theorem scalarLaplacian_neg (a : Space → ℝ) (x : Space) : |
| 103 | 78 | scalarLaplacian (fun y => -a y) x = -scalarLaplacian a x := by |
| 104 | 79 | simp only [scalarLaplacian, direction_neg, Finset.sum_neg_distrib] |
| 105 | 80 | |
| 106 | | -theorem direction_coord_mul {g : Space → ℝ} (hg : Differentiable ℝ g) |
| 107 | | - (i j : Fin 3) (x : Space) : |
| 108 | | - direction (fun y => y i * g y) j x = |
| 109 | | - (coordinateVector j) i * g x + x i * direction g j x := by |
| 110 | | - unfold direction |
| 111 | | - change (fderiv ℝ (fun y => projection i y * g y) x) (coordinateVector j) = _ |
| 112 | | - rw [fderiv_fun_mul (projection i).differentiableAt (hg x)] |
| 113 | | - simp |
| 114 | | - ring |
| 115 | | - |
| 116 | | -theorem second_direction_coord_mul {g : Space → ℝ} (hg : ContDiff ℝ 2 g) |
| 117 | | - (i j : Fin 3) (x : Space) : |
| 118 | | - direction (fun y => direction (fun z => z i * g z) j y) j x = |
| 119 | | - 2 * (coordinateVector j) i * direction g j x + |
| 120 | | - x i * direction (fun y => direction g j y) j x := by |
| 121 | | - have hd := hg.differentiable (by norm_num) |
| 122 | | - have hdg := (contDiff_direction hg (m := 1) (by norm_num) j).differentiable (by norm_num) |
| 123 | | - simp_rw [direction_coord_mul hd i j] |
| 124 | | - change (fderiv ℝ (fun y => (coordinateVector j) i * g y + |
| 125 | | - projection i y * direction g j y) x) (coordinateVector j) = _ |
| 126 | | - rw [fderiv_fun_add ((hd x).const_mul ((coordinateVector j) i)) |
| 127 | | - ((projection i).differentiableAt.fun_mul (hdg x))] |
| 128 | | - rw [fderiv_const_mul (hd x), fderiv_fun_mul (projection i).differentiableAt (hdg x)] |
| 129 | | - simp [direction] |
| 130 | | - ring |
| 131 | | - |
| 132 | | -theorem scalarLaplacian_coord_mul {g : Space → ℝ} (hg : ContDiff ℝ 2 g) |
| 133 | | - (i : Fin 3) (x : Space) : |
| 134 | | - scalarLaplacian (fun y => y i * g y) x = |
| 135 | | - x i * scalarLaplacian g x + 2 * direction g i x := by |
| 136 | | - unfold scalarLaplacian |
| 137 | | - simp_rw [second_direction_coord_mul hg] |
| 138 | | - fin_cases i <;> simp [Fin.sum_univ_three, coordinateVector] <;> ring |
| 139 | | - |
| 140 | | -theorem vectorLaplacian_pack {a b c : Space → ℝ} |
| 141 | | - (ha : ContDiff ℝ 2 a) (hb : ContDiff ℝ 2 b) (hc : ContDiff ℝ 2 c) (x : Space) : |
| 142 | | - vectorLaplacian (fun y => pack (a y) (b y) (c y)) x = |
| 143 | | - pack (scalarLaplacian a x) (scalarLaplacian b x) (scalarLaplacian c x) := by |
| 144 | | - unfold vectorLaplacian |
| 145 | | - simp_rw [fderiv_pack_apply (ha.differentiable (by norm_num) _) |
| 146 | | - (hb.differentiable (by norm_num) _) (hc.differentiable (by norm_num) _)] |
| 147 | | - change (∑ i : Fin 3, fderiv ℝ (fun y => pack (direction a i y) (direction b i y) |
| 148 | | - (direction c i y)) x (coordinateVector i)) = _ |
| 149 | | - simp_rw [fderiv_pack_apply |
| 150 | | - ((contDiff_direction ha (m := 1) (by norm_num) _).differentiable (by norm_num) x) |
| 151 | | - ((contDiff_direction hb (m := 1) (by norm_num) _).differentiable (by norm_num) x) |
| 152 | | - ((contDiff_direction hc (m := 1) (by norm_num) _).differentiable (by norm_num) x)] |
| 153 | | - simp only [scalarLaplacian, direction, pack, Finset.sum_add_distrib, ← Finset.sum_smul] |
| 154 | | - |
| 155 | 81 | def lift (G : Profile) (t : ℝ) (x : Space) : ℝ := G (profilePoint t x) |
| 156 | 82 | |
| 157 | 83 | /-- Joint differentiability is needed only along the spatial slice being evaluated. -/ |
| @@ -165,77 +91,12 @@ def SliceC2 (G : Profile) (t : ℝ) : Prop := |
| 165 | 91 | theorem SliceC2.differentiable {G : Profile} {t : ℝ} (hG : SliceC2 G t) : |
| 166 | 92 | SliceDifferentiable G t := fun x => (hG x).differentiableAt (by norm_num) |
| 167 | 93 | |
| 168 | | -theorem contDiff_lift_slice {G : Profile} {t : ℝ} (hG : SliceC2 G t) : |
| 169 | | - ContDiff ℝ 2 (lift G t) := by |
| 170 | | - rw [contDiff_iff_contDiffAt] |
| 171 | | - intro x |
| 172 | | - exact (hG x).comp x (contDiff_profilePoint_slice t).contDiffAt |
| 173 | | - |
| 174 | 94 | def partialT (G : Profile) (p : ProfilePoint) : ℝ := fderiv ℝ G p (1, (0, 0)) |
| 175 | 95 | def laplaceScalar (G : Profile) (p : ProfilePoint) : ℝ := |
| 176 | 96 | 2 * p.2.1 * partialS (partialS G) p + 2 * partialS G p + partialZ (partialZ G) p |
| 177 | 97 | def laplaceWeighted (G : Profile) (p : ProfilePoint) : ℝ := |
| 178 | 98 | 2 * p.2.1 * partialS (partialS G) p + 4 * partialS G p + partialZ (partialZ G) p |
| 179 | 99 | |
| 180 | | -theorem fderiv_lift_apply {G : Profile} {t : ℝ} (hG : SliceDifferentiable G t) |
| 181 | | - (x v : Space) : fderiv ℝ (lift G t) x v = |
| 182 | | - (x 0 * v 0 + x 1 * v 1) * partialS G (profilePoint t x) + |
| 183 | | - v 2 * partialZ G (profilePoint t x) := by |
| 184 | | - change (fderiv ℝ (fun y => G (profilePoint t y)) x) v = _ |
| 185 | | - rw [(hasFDerivAt_profile_composition G t x (hG _)).fderiv] |
| 186 | | - exact profileDerivative_apply G t x v |
| 187 | | - |
| 188 | | -theorem direction_lift_zero {G : Profile} {t : ℝ} (hG : SliceDifferentiable G t) (x : Space) : |
| 189 | | - direction (lift G t) 0 x = x 0 * lift (partialS G) t x := by |
| 190 | | - unfold direction |
| 191 | | - rw [fderiv_lift_apply hG] |
| 192 | | - simp [coordinateVector, lift] |
| 193 | | - |
| 194 | | -theorem direction_lift_one {G : Profile} {t : ℝ} (hG : SliceDifferentiable G t) (x : Space) : |
| 195 | | - direction (lift G t) 1 x = x 1 * lift (partialS G) t x := by |
| 196 | | - unfold direction |
| 197 | | - rw [fderiv_lift_apply hG] |
| 198 | | - simp [coordinateVector, lift] |
| 199 | | - |
| 200 | | -theorem direction_lift_two {G : Profile} {t : ℝ} (hG : SliceDifferentiable G t) (x : Space) : |
| 201 | | - direction (lift G t) 2 x = lift (partialZ G) t x := by |
| 202 | | - unfold direction |
| 203 | | - rw [fderiv_lift_apply hG] |
| 204 | | - simp [coordinateVector, lift] |
| 205 | | - |
| 206 | | -theorem scalarLaplacian_lift {G : Profile} {t : ℝ} (hG : SliceC2 G t) (x : Space) : |
| 207 | | - scalarLaplacian (lift G t) x = laplaceScalar G (profilePoint t x) := by |
| 208 | | - have hd := hG.differentiable |
| 209 | | - have hs : SliceDifferentiable (partialS G) t := fun x => |
| 210 | | - (((hG x).fderiv_right (m := 1) (by norm_num)).clm_apply contDiffAt_const).differentiableAt (by norm_num) |
| 211 | | - have hz : SliceDifferentiable (partialZ G) t := fun x => |
| 212 | | - (((hG x).fderiv_right (m := 1) (by norm_num)).clm_apply contDiffAt_const).differentiableAt (by norm_num) |
| 213 | | - have hls : Differentiable ℝ (lift (partialS G) t) := |
| 214 | | - fun x => (hs x).comp x ((contDiff_profilePoint_slice t (n := 1)).differentiable (by norm_num) x) |
| 215 | | - unfold scalarLaplacian |
| 216 | | - rw [Fin.sum_univ_three] |
| 217 | | - simp_rw [direction_lift_zero hd, direction_lift_one hd, direction_lift_two hd] |
| 218 | | - rw [direction_coord_mul hls, direction_coord_mul hls] |
| 219 | | - rw [direction_lift_zero hs, direction_lift_one hs, direction_lift_two hz] |
| 220 | | - simp [coordinateVector, lift, laplaceScalar, profilePoint, radialEnergy] |
| 221 | | - ring |
| 222 | | - |
| 223 | | -theorem scalarLaplacian_weighted_zero {G : Profile} {t : ℝ} (hG : SliceC2 G t) (x : Space) : |
| 224 | | - scalarLaplacian (fun y => y 0 * lift G t y) x = |
| 225 | | - x 0 * laplaceWeighted G (profilePoint t x) := by |
| 226 | | - rw [scalarLaplacian_coord_mul (contDiff_lift_slice hG), scalarLaplacian_lift hG, |
| 227 | | - direction_lift_zero hG.differentiable] |
| 228 | | - unfold lift laplaceScalar laplaceWeighted |
| 229 | | - ring |
| 230 | | - |
| 231 | | -theorem scalarLaplacian_weighted_one {G : Profile} {t : ℝ} (hG : SliceC2 G t) (x : Space) : |
| 232 | | - scalarLaplacian (fun y => y 1 * lift G t y) x = |
| 233 | | - x 1 * laplaceWeighted G (profilePoint t x) := by |
| 234 | | - rw [scalarLaplacian_coord_mul (contDiff_lift_slice hG), scalarLaplacian_lift hG, |
| 235 | | - direction_lift_one hG.differentiable] |
| 236 | | - unfold lift laplaceScalar laplaceWeighted |
| 237 | | - ring |
| 238 | | - |
| 239 | 100 | def componentX (B F : Profile) (t : ℝ) (x : Space) : ℝ := |
| 240 | 101 | -(x 0 * lift B t x + x 1 * lift F t x) |
| 241 | 102 | def componentY (B F : Profile) (t : ℝ) (x : Space) : ℝ := |
| @@ -254,17 +115,6 @@ def velocityJacobian (B F U : Profile) (t : ℝ) (x : Space) : Space →L[ℝ] S |
| 254 | 115 | (x 1 • profileDerivative B t x + lift B t x • projection 1)) |
| 255 | 116 | (profileDerivative U t x) |
| 256 | 117 | |
| 257 | | -theorem hasFDerivAt_velocity {B F U : Profile} {t : ℝ} |
| 258 | | - (hB : SliceDifferentiable B t) (hF : SliceDifferentiable F t) |
| 259 | | - (hU : SliceDifferentiable U t) (x : Space) : |
| 260 | | - HasFDerivAt (fun y => velocity B F U (t, y)) (velocityJacobian B F U t x) x := by |
| 261 | | - have hb := hasFDerivAt_profile_composition B t x (hB x) |
| 262 | | - have hf := hasFDerivAt_profile_composition F t x (hF x) |
| 263 | | - have hu := hasFDerivAt_profile_composition U t x (hU x) |
| 264 | | - exact hasFDerivAt_pack |
| 265 | | - ((((projection 0).hasFDerivAt.mul hb).add ((projection 1).hasFDerivAt.mul hf)).neg) |
| 266 | | - (((projection 0).hasFDerivAt.mul hf).sub ((projection 1).hasFDerivAt.mul hb)) hu |
| 267 | | - |
| 268 | 118 | def advectionRadial (B F U : Profile) (p : ProfilePoint) : ℝ := |
| 269 | 119 | (B p) ^ 2 - (F p) ^ 2 + 2 * p.2.1 * B p * partialS B p - U p * partialZ B p |
| 270 | 120 | def advectionAngular (B F U : Profile) (p : ProfilePoint) : ℝ := |
| @@ -272,72 +122,6 @@ def advectionAngular (B F U : Profile) (p : ProfilePoint) : ℝ := |
| 272 | 122 | def advectionAxial (B U : Profile) (p : ProfilePoint) : ℝ := |
| 273 | 123 | -2 * p.2.1 * B p * partialS U p + U p * partialZ U p |
| 274 | 124 | |
| 275 | | -theorem advection_velocity {B F U : Profile} {t : ℝ} |
| 276 | | - (hB : SliceDifferentiable B t) (hF : SliceDifferentiable F t) |
| 277 | | - (hU : SliceDifferentiable U t) (x : Space) : |
| 278 | | - advection (velocity B F U) t x = |
| 279 | | - pack (x 0 * advectionRadial B F U (profilePoint t x) + |
| 280 | | - x 1 * advectionAngular B F U (profilePoint t x)) |
| 281 | | - (x 1 * advectionRadial B F U (profilePoint t x) - |
| 282 | | - x 0 * advectionAngular B F U (profilePoint t x)) |
| 283 | | - (advectionAxial B U (profilePoint t x)) := by |
| 284 | | - change (fderiv ℝ (fun y => velocity B F U (t, y)) x) (velocity B F U (t, x)) = _ |
| 285 | | - rw [(hasFDerivAt_velocity hB hF hU x).fderiv] |
| 286 | | - simp only [velocityJacobian, packDerivative_apply] |
| 287 | | - ext i |
| 288 | | - fin_cases i <;> simp [profileDerivative_apply, velocity, componentX, componentY, lift, |
| 289 | | - advectionRadial, advectionAngular, advectionAxial, profilePoint, radialEnergy, |
| 290 | | - pack, coordinateVector] <;> ring |
| 291 | | - |
| 292 | | -theorem divergence_velocity {B F U : Profile} {t : ℝ} |
| 293 | | - (hB : SliceDifferentiable B t) (hF : SliceDifferentiable F t) |
| 294 | | - (hU : SliceDifferentiable U t) (x : Space) : |
| 295 | | - spatialDivergence (velocity B F U) t x = |
| 296 | | - partialZ U (profilePoint t x) - 2 * B (profilePoint t x) - |
| 297 | | - 2 * radialEnergy x * partialS B (profilePoint t x) := by |
| 298 | | - unfold spatialDivergence spatialDerivative |
| 299 | | - rw [(hasFDerivAt_velocity hB hF hU x).fderiv, Fin.sum_univ_three] |
| 300 | | - simp [velocityJacobian, packDerivative_apply, profileDerivative_apply, |
| 301 | | - coordinateVector, profilePoint, radialEnergy, lift] |
| 302 | | - ring |
| 303 | | - |
| 304 | | -theorem spatialLaplacian_velocity {B F U : Profile} {t : ℝ} |
| 305 | | - (hB : SliceC2 B t) (hF : SliceC2 F t) (hU : SliceC2 U t) (x : Space) : |
| 306 | | - spatialLaplacian (velocity B F U) t x = |
| 307 | | - pack (-x 0 * laplaceWeighted B (profilePoint t x) - |
| 308 | | - x 1 * laplaceWeighted F (profilePoint t x)) |
| 309 | | - (-x 1 * laplaceWeighted B (profilePoint t x) + |
| 310 | | - x 0 * laplaceWeighted F (profilePoint t x)) |
| 311 | | - (laplaceScalar U (profilePoint t x)) := by |
| 312 | | - have hb := contDiff_lift_slice hB |
| 313 | | - have hf := contDiff_lift_slice hF |
| 314 | | - have hu := contDiff_lift_slice hU |
| 315 | | - have h0b : ContDiff ℝ 2 (fun y : Space => y 0 * lift B t y) := (projection 0).contDiff.mul hb |
| 316 | | - have h1b : ContDiff ℝ 2 (fun y : Space => y 1 * lift B t y) := (projection 1).contDiff.mul hb |
| 317 | | - have h0f : ContDiff ℝ 2 (fun y : Space => y 0 * lift F t y) := (projection 0).contDiff.mul hf |
| 318 | | - have h1f : ContDiff ℝ 2 (fun y : Space => y 1 * lift F t y) := (projection 1).contDiff.mul hf |
| 319 | | - have hx : ContDiff ℝ 2 (componentX B F t) := (h0b.add h1f).neg |
| 320 | | - have hy : ContDiff ℝ 2 (componentY B F t) := h0f.sub h1b |
| 321 | | - change vectorLaplacian (fun y => pack (componentX B F t y) (componentY B F t y) |
| 322 | | - (lift U t y)) x = _ |
| 323 | | - rw [vectorLaplacian_pack hx hy hu] |
| 324 | | - unfold componentX componentY |
| 325 | | - rw [scalarLaplacian_neg, scalarLaplacian_add h0b h1f, scalarLaplacian_sub h0f h1b] |
| 326 | | - rw [scalarLaplacian_weighted_zero hB, scalarLaplacian_weighted_one hF, |
| 327 | | - scalarLaplacian_weighted_zero hF, scalarLaplacian_weighted_one hB, scalarLaplacian_lift hU] |
| 328 | | - ext i |
| 329 | | - fin_cases i <;> simp [pack, coordinateVector] <;> ring |
| 330 | | - |
| 331 | | -theorem pressureGradient_pressure {P : Profile} {t : ℝ} |
| 332 | | - (hP : SliceDifferentiable P t) (x : Space) : |
| 333 | | - pressureGradient (pressure P) t x = |
| 334 | | - pack (x 0 * partialS P (profilePoint t x)) (x 1 * partialS P (profilePoint t x)) |
| 335 | | - (partialZ P (profilePoint t x)) := by |
| 336 | | - change (∑ i : Fin 3, fderiv ℝ (lift P t) x (coordinateVector i) • coordinateVector i) = _ |
| 337 | | - simp_rw [fderiv_lift_apply hP] |
| 338 | | - rw [Fin.sum_univ_three] |
| 339 | | - simp [pack, coordinateVector] |
| 340 | | - |
| 341 | 125 | def timeProfileJacobian : ℝ →L[ℝ] ProfilePoint := |
| 342 | 126 | (ContinuousLinearMap.id ℝ ℝ).prod (0 : ℝ →L[ℝ] ℝ × ℝ) |
| 343 | 127 | def timeProfileDerivative (G : Profile) (p : ProfilePoint) : ℝ →L[ℝ] ℝ := |
| @@ -346,31 +130,6 @@ def timeProfileDerivative (G : Profile) (p : ProfilePoint) : ℝ →L[ℝ] ℝ : |
| 346 | 130 | @[simp] theorem timeProfileDerivative_one (G : Profile) (p : ProfilePoint) : |
| 347 | 131 | timeProfileDerivative G p 1 = partialT G p := rfl |
| 348 | 132 | |
| 349 | | -theorem hasFDerivAt_time_lift {G : Profile} {t : ℝ} (hG : SliceDifferentiable G t) (x : Space) : |
| 350 | | - HasFDerivAt (fun s => lift G s x) (timeProfileDerivative G (profilePoint t x)) t := by |
| 351 | | - have hp : HasFDerivAt (fun s => profilePoint s x) timeProfileJacobian t := |
| 352 | | - (hasFDerivAt_id t).prodMk (hasFDerivAt_const (radialEnergy x, x 2) t) |
| 353 | | - exact (hG x).hasFDerivAt.comp t hp |
| 354 | | - |
| 355 | | -theorem temporalDerivative_velocity {B F U : Profile} {t : ℝ} |
| 356 | | - (hB : SliceDifferentiable B t) (hF : SliceDifferentiable F t) |
| 357 | | - (hU : SliceDifferentiable U t) (x : Space) : |
| 358 | | - temporalDerivative (velocity B F U) t x = |
| 359 | | - pack (-x 0 * partialT B (profilePoint t x) - x 1 * partialT F (profilePoint t x)) |
| 360 | | - (-x 1 * partialT B (profilePoint t x) + x 0 * partialT F (profilePoint t x)) |
| 361 | | - (partialT U (profilePoint t x)) := by |
| 362 | | - have hb := hasFDerivAt_time_lift hB x |
| 363 | | - have hf := hasFDerivAt_time_lift hF x |
| 364 | | - have hu := hasFDerivAt_time_lift hU x |
| 365 | | - have hv := hasFDerivAt_pack (((hb.const_mul (x 0)).fun_add (hf.const_mul (x 1))).fun_neg) |
| 366 | | - ((hf.const_mul (x 0)).fun_sub (hb.const_mul (x 1))) hu |
| 367 | | - change (fderiv ℝ (fun s => pack (-(x 0 * lift B s x + x 1 * lift F s x)) |
| 368 | | - (x 0 * lift F s x - x 1 * lift B s x) (lift U s x)) t) 1 = _ |
| 369 | | - rw [hv.fderiv] |
| 370 | | - simp |
| 371 | | - ext i |
| 372 | | - fin_cases i <;> simp [pack, coordinateVector] <;> ring |
| 373 | | - |
| 374 | 133 | def residualRadial (B F U P : Profile) (p : ProfilePoint) : ℝ := |
| 375 | 134 | -partialT B p + advectionRadial B F U p + laplaceWeighted B p + partialS P p |
| 376 | 135 | def residualAngular (B F U : Profile) (p : ProfilePoint) : ℝ := |
| @@ -378,36 +137,6 @@ def residualAngular (B F U : Profile) (p : ProfilePoint) : ℝ := |
| 378 | 137 | def residualAxial (B U P : Profile) (p : ProfilePoint) : ℝ := |
| 379 | 138 | partialT U p + advectionAxial B U p - laplaceScalar U p + partialZ P p |
| 380 | 139 | |
| 381 | | -/-- Exact physical Navier--Stokes residual, at viscosity one, including radial, |
| 382 | | -angular, and axial viscosity. Its hypotheses need no continuation past time `t`. -/ |
| 383 | | -theorem navierStokesResidual_velocity {B F U P : Profile} {t : ℝ} |
| 384 | | - (hB : SliceC2 B t) (hF : SliceC2 F t) (hU : SliceC2 U t) |
| 385 | | - (hP : SliceDifferentiable P t) (x : Space) : |
| 386 | | - navierStokesResidual (velocity B F U) (pressure P) t x = |
| 387 | | - pack (x 0 * residualRadial B F U P (profilePoint t x) + |
| 388 | | - x 1 * residualAngular B F U (profilePoint t x)) |
| 389 | | - (x 1 * residualRadial B F U P (profilePoint t x) - |
| 390 | | - x 0 * residualAngular B F U (profilePoint t x)) |
| 391 | | - (residualAxial B U P (profilePoint t x)) := by |
| 392 | | - unfold navierStokesResidual |
| 393 | | - rw [temporalDerivative_velocity hB.differentiable hF.differentiable hU.differentiable, |
| 394 | | - advection_velocity hB.differentiable hF.differentiable hU.differentiable, |
| 395 | | - spatialLaplacian_velocity hB hF hU, pressureGradient_pressure hP] |
| 396 | | - ext i |
| 397 | | - fin_cases i <;> simp [pack, coordinateVector, |
| 398 | | - residualRadial, residualAngular, residualAxial] <;> ring |
| 399 | | - |
| 400 | | -/-- The three explicit coefficient equations imply the actual Cartesian PDE. -/ |
| 401 | | -theorem navierStokesResidual_eq_zero {B F U P : Profile} {t : ℝ} |
| 402 | | - (hB : SliceC2 B t) (hF : SliceC2 F t) (hU : SliceC2 U t) |
| 403 | | - (hP : SliceDifferentiable P t) (x : Space) |
| 404 | | - (hr : residualRadial B F U P (profilePoint t x) = 0) |
| 405 | | - (ha : residualAngular B F U (profilePoint t x) = 0) |
| 406 | | - (hz : residualAxial B U P (profilePoint t x) = 0) : |
| 407 | | - navierStokesResidual (velocity B F U) (pressure P) t x = 0 := by |
| 408 | | - rw [navierStokesResidual_velocity hB hF hU hP] |
| 409 | | - simp [hr, ha, hz, pack] |
| 410 | | - |
| 411 | 140 | def fromPotentialB (H : Profile) (p : ProfilePoint) : ℝ := partialZ H p / 2 |
| 412 | 141 | def fromPotentialF (K : Profile) (p : ProfilePoint) : ℝ := -partialS K p |
| 413 | 142 | def fromPotentialU (H : Profile) (p : ProfilePoint) : ℝ := H p + p.2.1 * partialS H p |