Imports
/-
Copyright (c) 2026 Florian Wiesner. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Florian Wiesner
-/
module
public import Physlib.FluidDynamics.FluidFlow.Continuity
public import Physlib.SpaceAndTime.Space.Derivatives.MatrixDivMomentum fields for fluid flows
i. Overview
This module defines generic momentum fields for fluid flow and relates conservative momentum transport to mass density times material acceleration. The definitions do not choose a particular force law or stress model, so they can be reused by Navier-Stokes, Euler, and related systems.
ii. Key results
FluidFlow.momentumDensity : The vector momentum density rho u.
FluidFlow.momentumFlux : The convective momentum flux rho u ⊗ u.
FluidFlow.convectiveTerm : The nonlinear transport term (u · ∇)u.
FluidFlow.materialAcceleration : The material acceleration ∂ₜ u + (u · ∇)u.
FluidFlow.momentumTransport_eq_materialAcceleration_add_continuityResidual :
The momentum-transport identity relating conservative and convective quantities.
iii. Table of contents
A. Momentum fields
B. Momentum transport identity
iv. References
@[expose] public sectionA. Momentum fields
The momentum density rho u.
def momentumDensity (d : ℕ) (fluid : FluidFlow d) : MomentumDensityField d :=
fun t x => fluid.rho t x • fluid.velocity t x
The convective momentum flux rho u ⊗ u.
def momentumFlux (d : ℕ) (fluid : FluidFlow d) : Time → Space d → Matrix (Fin d) (Fin d) ℝ :=
fun t x =>
fluid.rho t x • Matrix.vecMulVec (fun i => fluid.velocity t x i)
(fun j => fluid.velocity t x j)B. Momentum transport identity
Product rule for the time derivative of a scalar field times a velocity field.
d:ℕrhoAtPosition:Time → ℝvelocityAtPosition:Time → EuclideanSpace ℝ (Fin d)t:TimehRho:DifferentiableAt ℝ rhoAtPosition thVelocity:DifferentiableAt ℝ velocityAtPosition t⊢ (rhoAtPosition t • fderiv ℝ velocityAtPosition t + (fderiv ℝ rhoAtPosition t).smulRight (velocityAtPosition t)) 1 =
rhoAtPosition t • (fderiv ℝ velocityAtPosition t) 1 + (fderiv ℝ rhoAtPosition t) 1 • velocityAtPosition t
rfl All goals completed! 🐙
Product rule for the time derivative of the momentum density rho u.
lemma timeDeriv_momentumDensity (d : ℕ) (fluid : FluidFlow d)
(t : Time) (x : Space d)
(hRho : DifferentiableAt ℝ (fluid.rho · x) t)
(hVelocity : DifferentiableAt ℝ (fluid.velocity · x) t) :
∂ₜ (momentumDensity d fluid · x) t =
fluid.rho t x • ∂ₜ (fluid.velocity · x) t + ∂ₜ (fluid.rho · x) t • fluid.velocity t x := by d:ℕfluid:FluidFlow dt:Timex:Space dhRho:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocity:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) t⊢ ∂ₜ (fun x_1 => momentumDensity d fluid x_1 x) t =
fluid.rho t x • ∂ₜ (fun x_1 => fluid.velocity x_1 x) t + ∂ₜ (fun x_1 => fluid.rho x_1 x) t • fluid.velocity t x
simpa [momentumDensity] using
timeDeriv_smul_velocity d (fluid.rho · x) (fluid.velocity · x) t hRho hVelocity All goals completed! 🐙
Product rule for one spatial derivative of one component of rho u ⊗ u.
lemma spaceDeriv_momentumFlux_component (d : ℕ) (fluid : FluidFlow d)
(t : Time) (x : Space d) (i j : Fin d)
(hMomentumDensity : Differentiable ℝ (momentumDensity d fluid t))
(hVelocity : Differentiable ℝ (fluid.velocity t)) :
∂[j] (fun x' => momentumFlux d fluid t x' i j) x =
fluid.velocity t x i • ∂[j] (fun x' => momentumDensity d fluid t x' j) x +
∂[j] (fun x' => fluid.velocity t x' i) x • momentumDensity d fluid t x j := by d:ℕfluid:FluidFlow dt:Timex:Space di:Fin dj:Fin dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)⊢ Space.deriv j (fun x' => momentumFlux d fluid t x' i j) x =
(fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp j
have hProduct := Space.deriv_smul (u := j) (x := x)
(c := fun x' => fluid.velocity t x' i)
(f := fun x' => momentumDensity d fluid t x' j)
((differentiable_euclidean.mp hVelocity i).differentiableAt)
((differentiable_euclidean.mp hMomentumDensity j).differentiableAt) d:ℕfluid:FluidFlow dt:Timex:Space di:Fin dj:Fin dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)hProduct:Space.deriv j ((fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j) x =
(fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp j⊢ Space.deriv j (fun x' => momentumFlux d fluid t x' i j) x =
(fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp j
rw [← hProduct d:ℕfluid:FluidFlow dt:Timex:Space di:Fin dj:Fin dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)hProduct:Space.deriv j ((fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j) x =
(fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp j⊢ Space.deriv j (fun x' => momentumFlux d fluid t x' i j) x =
Space.deriv j ((fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j) x d:ℕfluid:FluidFlow dt:Timex:Space di:Fin dj:Fin dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)hProduct:Space.deriv j ((fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j) x =
(fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp j⊢ Space.deriv j (fun x' => momentumFlux d fluid t x' i j) x =
Space.deriv j ((fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j) x] d:ℕfluid:FluidFlow dt:Timex:Space di:Fin dj:Fin dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)hProduct:Space.deriv j ((fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j) x =
(fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp j⊢ Space.deriv j (fun x' => momentumFlux d fluid t x' i j) x =
Space.deriv j ((fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j) x
congr e_f d:ℕfluid:FluidFlow dt:Timex:Space di:Fin dj:Fin dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)hProduct:Space.deriv j ((fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j) x =
(fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp j⊢ (fun x' => momentumFlux d fluid t x' i j) =
(fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j
funext x' e_f d:ℕfluid:FluidFlow dt:Timex:Space di:Fin dj:Fin dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)hProduct:Space.deriv j ((fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j) x =
(fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp jx':Space d⊢ momentumFlux d fluid t x' i j =
((fun x' => (fluid.velocity t x').ofLp i) • fun x' => (momentumDensity d fluid t x').ofLp j) x'
simp [momentumFlux, momentumDensity, Matrix.vecMulVec_apply, mul_left_comm] All goals completed! 🐙
The matrix divergence of rho u ⊗ u split into continuity and convective parts.
lemma matrixDiv_momentumFlux (d : ℕ) (fluid : FluidFlow d)
(t : Time) (x : Space d)
(hMomentumDensity : Differentiable ℝ (momentumDensity d fluid t))
(hVelocity : Differentiable ℝ (fluid.velocity t)) :
matrixDiv d (momentumFlux d fluid t) x =
(∇ ⬝ momentumDensity d fluid t) x • fluid.velocity t x +
fluid.rho t x • convectiveTerm d fluid t x := by d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)⊢ matrixDiv d (momentumFlux d fluid t) x =
div (momentumDensity d fluid t) x • fluid.velocity t x + fluid.rho t x • convectiveTerm d fluid t x
ext i d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ (matrixDiv d (momentumFlux d fluid t) x).ofLp i =
(div (momentumDensity d fluid t) x • fluid.velocity t x + fluid.rho t x • convectiveTerm d fluid t x).ofLp i
simp [matrixDiv_apply, div, convectiveTerm, smul_eq_mul] d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ j, Space.deriv j (fun x => momentumFlux d fluid t x i j) x =
(∑ x_1, Space.deriv x_1 (fun x => (momentumDensity d fluid t x).ofLp x_1) x) * (fluid.velocity t x).ofLp i +
fluid.rho t x * ∑ x_1, (fluid.velocity t x).ofLp x_1 * (Space.deriv x_1 (fluid.velocity t) x).ofLp i
change (∑ j, ∂[j] (fun x' => momentumFlux d fluid t x' i j) x) =
(∑ j, ∂[j] (fun x' => momentumDensity d fluid t x' j) x) * fluid.velocity t x i +
fluid.rho t x * (∑ j, fluid.velocity t x j * ∂[j] (fluid.velocity t) x i) d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ j, Space.deriv j (fun x' => momentumFlux d fluid t x' i j) x =
(∑ j, Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x) * (fluid.velocity t x).ofLp i +
fluid.rho t x * ∑ j, (fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i
calc
(∑ j, ∂[j] (fun x' => momentumFlux d fluid t x' i j) x)
= ∑ j,
(fluid.velocity t x i * ∂[j] (fun x' => momentumDensity d fluid t x' j) x +
∂[j] (fun x' => fluid.velocity t x' i) x * momentumDensity d fluid t x j) := by d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ j, Space.deriv j (fun x' => momentumFlux d fluid t x' i j) x =
∑ j,
((fluid.velocity t x).ofLp i * Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp j)
apply Finset.sum_congr rfl d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∀ x_1 ∈ Finset.univ,
Space.deriv x_1 (fun x' => momentumFlux d fluid t x' i x_1) x =
(fluid.velocity t x).ofLp i * Space.deriv x_1 (fun x' => (momentumDensity d fluid t x').ofLp x_1) x +
Space.deriv x_1 (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp x_1
intro j _ d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin dj:Fin da✝:j ∈ Finset.univ⊢ Space.deriv j (fun x' => momentumFlux d fluid t x' i j) x =
(fluid.velocity t x).ofLp i * Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp j
rw [spaceDeriv_momentumFlux_component d fluid t x i j
hMomentumDensity hVelocity d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin dj:Fin da✝:j ∈ Finset.univ⊢ (fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp j =
(fluid.velocity t x).ofLp i * Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp j d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin dj:Fin da✝:j ∈ Finset.univ⊢ (fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp j =
(fluid.velocity t x).ofLp i * Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp j] d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin dj:Fin da✝:j ∈ Finset.univ⊢ (fluid.velocity t x).ofLp i • Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x • (momentumDensity d fluid t x).ofLp j =
(fluid.velocity t x).ofLp i * Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp j
simp [smul_eq_mul] All goals completed! 🐙
_ = fluid.velocity t x i * (∑ j, ∂[j] (fun x' => momentumDensity d fluid t x' j) x) +
fluid.rho t x * (∑ j, fluid.velocity t x j * ∂[j] (fluid.velocity t) x i) := by d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ j,
((fluid.velocity t x).ofLp i * Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp j) =
(fluid.velocity t x).ofLp i * ∑ j, Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
fluid.rho t x * ∑ j, (fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i
rw [Finset.sum_add_distrib d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, (fluid.velocity t x).ofLp i * Space.deriv x_1 (fun x' => (momentumDensity d fluid t x').ofLp x_1) x +
∑ x_1, Space.deriv x_1 (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp x_1 =
(fluid.velocity t x).ofLp i * ∑ j, Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
fluid.rho t x * ∑ j, (fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, (fluid.velocity t x).ofLp i * Space.deriv x_1 (fun x' => (momentumDensity d fluid t x').ofLp x_1) x +
∑ x_1, Space.deriv x_1 (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp x_1 =
(fluid.velocity t x).ofLp i * ∑ j, Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
fluid.rho t x * ∑ j, (fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i] d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, (fluid.velocity t x).ofLp i * Space.deriv x_1 (fun x' => (momentumDensity d fluid t x').ofLp x_1) x +
∑ x_1, Space.deriv x_1 (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp x_1 =
(fluid.velocity t x).ofLp i * ∑ j, Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
fluid.rho t x * ∑ j, (fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i
congr 1 e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, (fluid.velocity t x).ofLp i * Space.deriv x_1 (fun x' => (momentumDensity d fluid t x').ofLp x_1) x =
(fluid.velocity t x).ofLp i * ∑ j, Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) xe_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, Space.deriv x_1 (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp x_1 =
fluid.rho t x * ∑ j, (fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i
· e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, (fluid.velocity t x).ofLp i * Space.deriv x_1 (fun x' => (momentumDensity d fluid t x').ofLp x_1) x =
(fluid.velocity t x).ofLp i * ∑ j, Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x rw [Finset.mul_sum e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, (fluid.velocity t x).ofLp i * Space.deriv x_1 (fun x' => (momentumDensity d fluid t x').ofLp x_1) x =
∑ i_1, (fluid.velocity t x).ofLp i * Space.deriv i_1 (fun x' => (momentumDensity d fluid t x').ofLp i_1) x All goals completed! 🐙] All goals completed! 🐙
· e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, Space.deriv x_1 (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp x_1 =
fluid.rho t x * ∑ j, (fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i rw [Finset.mul_sum e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, Space.deriv x_1 (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp x_1 =
∑ i_1, fluid.rho t x * ((fluid.velocity t x).ofLp i_1 * (Space.deriv i_1 (fluid.velocity t) x).ofLp i) e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, Space.deriv x_1 (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp x_1 =
∑ i_1, fluid.rho t x * ((fluid.velocity t x).ofLp i_1 * (Space.deriv i_1 (fluid.velocity t) x).ofLp i)]e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∑ x_1, Space.deriv x_1 (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp x_1 =
∑ i_1, fluid.rho t x * ((fluid.velocity t x).ofLp i_1 * (Space.deriv i_1 (fluid.velocity t) x).ofLp i)
apply Finset.sum_congr rfl e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ ∀ x_1 ∈ Finset.univ,
Space.deriv x_1 (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp x_1 =
fluid.rho t x * ((fluid.velocity t x).ofLp x_1 * (Space.deriv x_1 (fluid.velocity t) x).ofLp i)
intro j _ e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin dj:Fin da✝:j ∈ Finset.univ⊢ Space.deriv j (fun x' => (fluid.velocity t x').ofLp i) x * (momentumDensity d fluid t x).ofLp j =
fluid.rho t x * ((fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i)
rw [Space.deriv_euclid (ν := j) (μ := i) (f := fluid.velocity t)
hVelocity x e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin dj:Fin da✝:j ∈ Finset.univ⊢ (Space.deriv j (fun x => fluid.velocity t x) x).ofLp i * (momentumDensity d fluid t x).ofLp j =
fluid.rho t x * ((fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i) e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin dj:Fin da✝:j ∈ Finset.univ⊢ (Space.deriv j (fun x => fluid.velocity t x) x).ofLp i * (momentumDensity d fluid t x).ofLp j =
fluid.rho t x * ((fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i)]e_a d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin dj:Fin da✝:j ∈ Finset.univ⊢ (Space.deriv j (fun x => fluid.velocity t x) x).ofLp i * (momentumDensity d fluid t x).ofLp j =
fluid.rho t x * ((fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i)
simp [momentumDensity, mul_comm, mul_assoc] All goals completed! 🐙
_ = (∑ j, ∂[j] (fun x' => momentumDensity d fluid t x' j) x) * fluid.velocity t x i +
fluid.rho t x * (∑ j, fluid.velocity t x j * ∂[j] (fluid.velocity t) x i) := by d:ℕfluid:FluidFlow dt:Timex:Space dhMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocity:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ (fluid.velocity t x).ofLp i * ∑ j, Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x +
fluid.rho t x * ∑ j, (fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i =
(∑ j, Space.deriv j (fun x' => (momentumDensity d fluid t x').ofLp j) x) * (fluid.velocity t x).ofLp i +
fluid.rho t x * ∑ j, (fluid.velocity t x).ofLp j * (Space.deriv j (fluid.velocity t) x).ofLp i
ring All goals completed! 🐙The conservative momentum transport terms equal mass density times material acceleration plus the continuity residual times velocity.
lemma momentumTransport_eq_materialAcceleration_add_continuityResidual
(d : ℕ) (fluid : FluidFlow d)
(t : Time) (x : Space d)
(hRhoTime : DifferentiableAt ℝ (fluid.rho · x) t)
(hVelocityTime : DifferentiableAt ℝ (fluid.velocity · x) t)
(hMomentumDensity : Differentiable ℝ (momentumDensity d fluid t))
(hVelocitySpace : Differentiable ℝ (fluid.velocity t)) :
∂ₜ (momentumDensity d fluid · x) t + matrixDiv d (momentumFlux d fluid t) x =
fluid.rho t x • materialAcceleration d fluid t x +
continuityResidual d fluid t x • fluid.velocity t x := by d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)⊢ ∂ₜ (fun x_1 => momentumDensity d fluid x_1 x) t + matrixDiv d (momentumFlux d fluid t) x =
fluid.rho t x • materialAcceleration d fluid t x + continuityResidual d fluid t x • fluid.velocity t x
rw [continuityResidual d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)⊢ ∂ₜ (fun x_1 => momentumDensity d fluid x_1 x) t + matrixDiv d (momentumFlux d fluid t) x =
fluid.rho t x • materialAcceleration d fluid t x +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t + div (fun x' => fluid.rho t x' • fluid.velocity t x') x) • fluid.velocity t x d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)⊢ ∂ₜ (fun x_1 => momentumDensity d fluid x_1 x) t + matrixDiv d (momentumFlux d fluid t) x =
fluid.rho t x • materialAcceleration d fluid t x +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t + div (fun x' => fluid.rho t x' • fluid.velocity t x') x) • fluid.velocity t x] d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)⊢ ∂ₜ (fun x_1 => momentumDensity d fluid x_1 x) t + matrixDiv d (momentumFlux d fluid t) x =
fluid.rho t x • materialAcceleration d fluid t x +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t + div (fun x' => fluid.rho t x' • fluid.velocity t x') x) • fluid.velocity t x
rw [timeDeriv_momentumDensity d fluid t x hRhoTime hVelocityTime d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)⊢ fluid.rho t x • ∂ₜ (fun x_1 => fluid.velocity x_1 x) t + ∂ₜ (fun x_1 => fluid.rho x_1 x) t • fluid.velocity t x +
matrixDiv d (momentumFlux d fluid t) x =
fluid.rho t x • materialAcceleration d fluid t x +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t + div (fun x' => fluid.rho t x' • fluid.velocity t x') x) • fluid.velocity t x d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)⊢ fluid.rho t x • ∂ₜ (fun x_1 => fluid.velocity x_1 x) t + ∂ₜ (fun x_1 => fluid.rho x_1 x) t • fluid.velocity t x +
matrixDiv d (momentumFlux d fluid t) x =
fluid.rho t x • materialAcceleration d fluid t x +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t + div (fun x' => fluid.rho t x' • fluid.velocity t x') x) • fluid.velocity t x] d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)⊢ fluid.rho t x • ∂ₜ (fun x_1 => fluid.velocity x_1 x) t + ∂ₜ (fun x_1 => fluid.rho x_1 x) t • fluid.velocity t x +
matrixDiv d (momentumFlux d fluid t) x =
fluid.rho t x • materialAcceleration d fluid t x +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t + div (fun x' => fluid.rho t x' • fluid.velocity t x') x) • fluid.velocity t x
rw [matrixDiv_momentumFlux d fluid t x hMomentumDensity hVelocitySpace d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)⊢ fluid.rho t x • ∂ₜ (fun x_1 => fluid.velocity x_1 x) t + ∂ₜ (fun x_1 => fluid.rho x_1 x) t • fluid.velocity t x +
(div (momentumDensity d fluid t) x • fluid.velocity t x + fluid.rho t x • convectiveTerm d fluid t x) =
fluid.rho t x • materialAcceleration d fluid t x +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t + div (fun x' => fluid.rho t x' • fluid.velocity t x') x) • fluid.velocity t x d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)⊢ fluid.rho t x • ∂ₜ (fun x_1 => fluid.velocity x_1 x) t + ∂ₜ (fun x_1 => fluid.rho x_1 x) t • fluid.velocity t x +
(div (momentumDensity d fluid t) x • fluid.velocity t x + fluid.rho t x • convectiveTerm d fluid t x) =
fluid.rho t x • materialAcceleration d fluid t x +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t + div (fun x' => fluid.rho t x' • fluid.velocity t x') x) • fluid.velocity t x] d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)⊢ fluid.rho t x • ∂ₜ (fun x_1 => fluid.velocity x_1 x) t + ∂ₜ (fun x_1 => fluid.rho x_1 x) t • fluid.velocity t x +
(div (momentumDensity d fluid t) x • fluid.velocity t x + fluid.rho t x • convectiveTerm d fluid t x) =
fluid.rho t x • materialAcceleration d fluid t x +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t + div (fun x' => fluid.rho t x' • fluid.velocity t x') x) • fluid.velocity t x
ext i d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ (fluid.rho t x • ∂ₜ (fun x_1 => fluid.velocity x_1 x) t + ∂ₜ (fun x_1 => fluid.rho x_1 x) t • fluid.velocity t x +
(div (momentumDensity d fluid t) x • fluid.velocity t x + fluid.rho t x • convectiveTerm d fluid t x)).ofLp
i =
(fluid.rho t x • materialAcceleration d fluid t x +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t + div (fun x' => fluid.rho t x' • fluid.velocity t x') x) •
fluid.velocity t x).ofLp
i
simp [materialAcceleration, convectiveTerm, div, momentumDensity, smul_eq_mul] d:ℕfluid:FluidFlow dt:Timex:Space dhRhoTime:DifferentiableAt ℝ (fun x_1 => fluid.rho x_1 x) thVelocityTime:DifferentiableAt ℝ (fun x_1 => fluid.velocity x_1 x) thMomentumDensity:Differentiable ℝ (momentumDensity d fluid t)hVelocitySpace:Differentiable ℝ (fluid.velocity t)i:Fin d⊢ fluid.rho t x * (∂ₜ (fun x_1 => fluid.velocity x_1 x) t).ofLp i +
∂ₜ (fun x_1 => fluid.rho x_1 x) t * (fluid.velocity t x).ofLp i +
((∑ x_1, Space.deriv x_1 (fun x => fluid.rho t x * (fluid.velocity t x).ofLp x_1) x) * (fluid.velocity t x).ofLp i +
fluid.rho t x * ∑ x_1, (fluid.velocity t x).ofLp x_1 * (Space.deriv x_1 (fluid.velocity t) x).ofLp i) =
fluid.rho t x * (∂ₜ (fun x_1 => fluid.velocity x_1 x) t).ofLp i +
fluid.rho t x * ∑ x_1, (fluid.velocity t x).ofLp x_1 * (Space.deriv x_1 (fluid.velocity t) x).ofLp i +
(∂ₜ (fun x_1 => fluid.rho x_1 x) t +
∑ x_1, Space.deriv x_1 (fun x => fluid.rho t x * (fluid.velocity t x).ofLp x_1) x) *
(fluid.velocity t x).ofLp i
ring_nf All goals completed! 🐙