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.MatrixDiv

Momentum 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 section

A. 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 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 := 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 All goals completed! 🐙

Product rule for one spatial derivative of one component of rho u ⊗ u.

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 jSpace.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(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 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 dmomentumFlux d fluid t x' i j = ((fun x' => (fluid.velocity t x').ofLp i) fun x' => (momentumDensity d fluid t x').ofLp j) x' All goals completed! 🐙

The matrix divergence of rho u ⊗ u split into continuity and convective parts.

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) 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) := 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 All goals completed! 🐙

The conservative momentum transport terms equal mass density times material acceleration plus the continuity residual times velocity.

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)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 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 dfluid.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 All goals completed! 🐙