File size: 9,421 Bytes
37bcf52 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPulseExpressions
namespace OAI
/-! The compact planar interpretation of the finite scalar program. Its
time-periodic Hamiltonian has one common compact support inside the open
unit square, and generates a smooth divergence-free, zero-mean field. -/
noncomputable section
namespace ForcedComputation.PlanarHamiltonian
open ShearFlows Set MeasureTheory Filter
open scoped ContDiff BigOperators Topology
def periodicHamiltonian {n : ℕ} (p : Fin n → Pulse) (t : ℝ) (x : Plane) : ℝ :=
∑ i : Fin n, (PeriodicExpr.intervalPulse (p i).start (p i).finish).val t *
(p i).hamiltonian x
def periodicVelocity {n : ℕ} (p : Fin n → Pulse) (t : ℝ) : Plane → Plane :=
field (periodicHamiltonian p t)
def commonSupport {n : ℕ} (p : Fin n → Pulse) : Set Plane :=
⋃ i : Fin n, (rectangleCollar (p i).rectangle (p i).collar).carrier
theorem commonSupport_compact {n : ℕ} (p : Fin n → Pulse) :
IsCompact (commonSupport p) :=
isCompact_iUnion (fun i => rectangleCollar_compact (p i).rectangle (p i).collar)
theorem commonSupport_in_unit {n : ℕ} {p : Fin n → Pulse}
(hu : ∀ i, (p i).InUnit) :
commonSupport p ⊆ {x | ∀ j : Fin 2, 0 < x j ∧ x j < 1} := by
intro x hx j
obtain ⟨i, hi⟩ := Set.mem_iUnion.mp hx
have h := hi j
have hb := (hu i).2.2 j
dsimp [rectangleCollar] at h
push_cast at h
have hl : (0 : ℝ) < ((p i).rectangle.lower j : ℝ) - 2 * (p i).collar := by
exact_mod_cast hb.1
have hr : ((p i).rectangle.upper j : ℝ) + 2 * (p i).collar < (1 : ℝ) := by
exact_mod_cast hb.2
exact ⟨hl.trans_le h.1, h.2.trans_lt hr⟩
theorem periodicHamiltonian_smooth {n : ℕ} {p : Fin n → Pulse}
(hp : ∀ i, (p i).Valid) :
ContDiff ℝ ∞ (fun y : ℝ × Plane => periodicHamiltonian p y.1 y.2) := by
apply ContDiff.sum
intro i _
exact ((PeriodicExpr.smooth (PeriodicExpr.intervalPulse_valid (hp i).2)).comp
contDiff_fst).mul ((p i).hamiltonian_smooth.comp contDiff_snd)
theorem periodicHamiltonian_slice_smooth {n : ℕ} (p : Fin n → Pulse) (t : ℝ) :
ContDiff ℝ ∞ (periodicHamiltonian p t) := by
apply ContDiff.sum
intro i _
exact contDiff_const.mul (p i).hamiltonian_smooth
theorem periodicHamiltonian_periodic {n : ℕ} (p : Fin n → Pulse) (x : Plane) :
Function.Periodic (fun t => periodicHamiltonian p t x) 1 := by
intro t
apply Finset.sum_congr rfl
intro i _
have h := periodize_periodic (1 : ℝ)
(PeriodicExpr.intervalPulse (p i).start (p i).finish).body.val t
change _ * _ = _ * _
have he : (PeriodicExpr.intervalPulse (p i).start (p i).finish).val (t + 1) =
(PeriodicExpr.intervalPulse (p i).start (p i).finish).val t := by
simpa only [PeriodicExpr.val, PeriodicExpr.intervalPulse, Rat.cast_one] using h
rw [he]
theorem periodicHamiltonian_support {n : ℕ} {p : Fin n → Pulse}
(hp : ∀ i, (p i).Valid) (t : ℝ) :
tsupport (periodicHamiltonian p t) ⊆ commonSupport p := by
apply closure_minimal _ (commonSupport_compact p).isClosed
intro x hx
by_contra hn
apply hx
apply Finset.sum_eq_zero
intro i _
have hn' : x ∉ tsupport (p i).hamiltonian := by
intro hh
apply hn
apply Set.mem_iUnion.mpr
refine ⟨i, ?_⟩
have hs : tsupport (p i).hamiltonian ⊆
(rectangleCollar (p i).rectangle (p i).collar).carrier :=
tsupport_mul_subset_left.trans (closure_minimal
(rectangleCutoff_support (hp i).1)
(rectangleCollar_compact (p i).rectangle (p i).collar).isClosed)
exact hs hh
rw [image_eq_zero_of_notMem_tsupport hn', mul_zero]
theorem periodicVelocity_eq_sum {n : ℕ} (p : Fin n → Pulse) (t : ℝ) (x : Plane) :
periodicVelocity p t x = ∑ i : Fin n,
(PeriodicExpr.intervalPulse (p i).start (p i).finish).val t • (p i).spatial x := by
unfold periodicVelocity periodicHamiltonian
rw [field_sum _ _ (fun i _ => contDiff_const.mul (p i).hamiltonian_smooth)]
apply Finset.sum_congr rfl
intro i _
exact field_const_mul (p i).hamiltonian_smooth _ _
theorem periodicVelocity_smooth {n : ℕ} {p : Fin n → Pulse}
(hp : ∀ i, (p i).Valid) :
ContDiff ℝ ∞ (fun y : ℝ × Plane => periodicVelocity p y.1 y.2) := by
have he : (fun y : ℝ × Plane => periodicVelocity p y.1 y.2) =
fun y => ∑ i : Fin n, (PeriodicExpr.intervalPulse (p i).start (p i).finish).val y.1 •
(p i).spatial y.2 := by
funext y
exact periodicVelocity_eq_sum p y.1 y.2
rw [he]
apply ContDiff.sum
intro i _
exact ((PeriodicExpr.smooth (PeriodicExpr.intervalPulse_valid (hp i).2)).comp
contDiff_fst).smul ((p i).spatial_smooth.comp contDiff_snd)
theorem periodicVelocity_periodic {n : ℕ} (p : Fin n → Pulse) (x : Plane) :
Function.Periodic (fun t => periodicVelocity p t x) 1 := by
intro t
have he : periodicHamiltonian p (t + 1) = periodicHamiltonian p t :=
funext fun y => periodicHamiltonian_periodic p y t
change field (periodicHamiltonian p (t + 1)) x = field (periodicHamiltonian p t) x
rw [he]
theorem periodicVelocity_properties {n : ℕ} {p : Fin n → Pulse}
(hp : ∀ i, (p i).Valid) (t : ℝ) :
tsupport (periodicVelocity p t) ⊆ commonSupport p ∧
(∀ x, divergence (periodicVelocity p t) x = 0) ∧
(∫ x, periodicVelocity p t x) = 0 := by
have hs := periodicHamiltonian_slice_smooth p t
have hc : HasCompactSupport (periodicHamiltonian p t) :=
(commonSupport_compact p).of_isClosed_subset (isClosed_tsupport _)
(periodicHamiltonian_support hp t)
exact ⟨(field_tsupport _).trans (periodicHamiltonian_support hp t),
field_divergence hs, field_integral_eq_zero hs hc⟩
theorem periodicPulse_on_unit {p : Pulse} (hp : p.Valid) (hu : p.InUnit)
{t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) :
(PeriodicExpr.intervalPulse p.start p.finish).val t =
smoothPulse p.start p.finish t := by
rw [PeriodicExpr.val_on_unit (PeriodicExpr.intervalPulse_valid hp.2) rfl hu.1 hu.2.1 ht]
change (ProfileExpr.ramp p.start p.finish).diff.val t = _
rw [ProfileExpr.val_diff, ProfileExpr.val_ramp]
rfl
theorem periodicHamiltonian_on_unit {n : ℕ} {p : Fin n → Pulse}
(hp : ∀ i, (p i).Valid) (hu : ∀ i, (p i).InUnit)
{t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) (x : Plane) :
periodicHamiltonian p t x = processorHamiltonian p t x := by
apply Finset.sum_congr rfl
intro i _
rw [periodicPulse_on_unit (hp i) (hu i) ht]
theorem periodicVelocity_on_unit {n : ℕ} {p : Fin n → Pulse}
(hp : ∀ i, (p i).Valid) (hu : ∀ i, (p i).InUnit)
{t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) (x : Plane) :
periodicVelocity p t x = processorVelocity p t x := by
have he : periodicHamiltonian p t = processorHamiltonian p t :=
funext (periodicHamiltonian_on_unit hp hu ht)
unfold periodicVelocity processorVelocity
rw [he]
theorem periodicPulse_zero_near_zero {p : Pulse} (hp : p.Valid) (hu : p.InUnit) :
(PeriodicExpr.intervalPulse p.start p.finish).val =ᶠ[𝓝 0] (fun _ => 0) := by
let δ : ℝ := min (1 / 4) (min (p.start : ℝ) (1 - (p.finish : ℝ)) / 2)
have ha : (0 : ℝ) < p.start := by exact_mod_cast hu.1
have hb : (p.finish : ℝ) < 1 := by exact_mod_cast hu.2.1
have hδ : 0 < δ := lt_min (by norm_num) (by positivity)
have hδ₁ : δ ≤ 1 / 4 := min_le_left _ _
have hδ₂ : 2 * δ ≤ p.start := by
have hm := min_le_right (1 / 4 : ℝ) (min (p.start : ℝ) (1 - (p.finish : ℝ)) / 2)
have hn := min_le_left (p.start : ℝ) (1 - (p.finish : ℝ))
change δ ≤ _ at hm
linarith
have hδ₃ : 2 * δ ≤ 1 - (p.finish : ℝ) := by
have hm := min_le_right (1 / 4 : ℝ) (min (p.start : ℝ) (1 - (p.finish : ℝ)) / 2)
have hn := min_le_right (p.start : ℝ) (1 - (p.finish : ℝ))
change δ ≤ _ at hm
linarith
have hn : Ioo (-δ) δ ∈ 𝓝 (0 : ℝ) := Ioo_mem_nhds (by linarith) hδ
filter_upwards [hn] with t ht
have hs : Function.support (PeriodicExpr.intervalPulse p.start p.finish).body.val ⊆
Ioo (-δ) (1 - δ) := by
intro x hx
have h := (PeriodicExpr.intervalPulse_valid hp.2).2 hx
change (p.start : ℝ) ≤ x ∧ x ≤ (p.finish : ℝ) at h
constructor <;> linarith [h.1, h.2]
have he := periodize_eq_in_chart (L := (1 : ℝ)) (A := -δ) (B := 1 - δ)
(by norm_num) (by linarith) hs (x := t) ⟨ht.1.le, by linarith [ht.2]⟩
have he' : (PeriodicExpr.intervalPulse p.start p.finish).val t =
(PeriodicExpr.intervalPulse p.start p.finish).body.val t := by
simpa only [PeriodicExpr.val, PeriodicExpr.intervalPulse, Rat.cast_one] using he
rw [he']
change (ProfileExpr.ramp p.start p.finish).diff.val t = 0
rw [ProfileExpr.val_diff, ProfileExpr.val_ramp]
exact smoothPulse_before (by exact_mod_cast hp.2) (by linarith [ht.2])
theorem periodicVelocity_zero_near_zero {n : ℕ} {p : Fin n → Pulse}
(hp : ∀ i, (p i).Valid) (hu : ∀ i, (p i).InUnit) :
∀ᶠ t in 𝓝 (0 : ℝ), ∀ x, periodicVelocity p t x = 0 := by
have he : ∀ᶠ t in 𝓝 (0 : ℝ), ∀ i : Fin n,
(PeriodicExpr.intervalPulse (p i).start (p i).finish).val t = 0 :=
eventually_all.mpr (fun i => periodicPulse_zero_near_zero (hp i) (hu i))
filter_upwards [he] with t ht
intro x
rw [periodicVelocity_eq_sum]
apply Finset.sum_eq_zero
intro i _
rw [ht i, zero_smul]
end ForcedComputation.PlanarHamiltonian
end
end OAI
|