-
Notifications
You must be signed in to change notification settings - Fork 134
feat(FluidDynamics): Adding more fluid dynamics - continuation of PR #949 and #1112 , #1125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
FloWsnr
wants to merge
20
commits into
leanprover-community:master
Choose a base branch
from
FloWsnr:feat/fluid_dynamics_2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e6e290b
feat(FluidDynamics): add incompressibility predicates
FloWsnr ed9ebc5
refactor(FluidDynamics): extract shared continuity and momentum
FloWsnr c2c135c
feat(FluidDynamics): add Euler Bernoulli setup
FloWsnr 8696eec
feat(FluidDynamics): record Bernoulli force convention
FloWsnr 2bebbc2
refactor(FluidDynamics): inline Euler convective form
FloWsnr 58b969a
refactor(FluidDynamics): rename Euler predicates
FloWsnr d59db4c
refactor(FluidDynamics): introduce Cauchy flow data
FloWsnr 7b35664
refactor(FluidDynamics): rename fluid flow carrier
FloWsnr 4119cf2
refactor(FluidDynamics): add shared Cauchy momentum
FloWsnr 94cd05c
refactor(FluidDynamics): use Cauchy flows in Euler theory
FloWsnr e0890ac
refactor(FluidDynamics): express Navier-Stokes via Cauchy momentum
FloWsnr 1324844
refactor(FluidDynamics): clarify force and viscosity names
FloWsnr 8f00c5e
feat(FluidDynamics): relate inviscid stress to pressure gradient
FloWsnr 9b6eb71
refactor(FluidDynamics): move flow time-independence predicates
FloWsnr 1df0fbf
refactor(FluidDynamics): namespace flow-derived APIs
FloWsnr 5ab5fc4
refactor(FluidDynamics): address review naming and docs
FloWsnr 99098ec
refactor(FluidDynamics): move flow-derived scalar APIs
FloWsnr e5dcd53
refactor(FluidDynamics): rename flow core module
FloWsnr ced67cb
refactor(FluidDynamics): organize flow APIs by structure
FloWsnr e151a98
Merge remote-tracking branch 'upstream/master' into feat/fluid_dynami…
FloWsnr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /- | ||
| 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.Basic | ||
| /-! | ||
|
|
||
| # Basic API for Cauchy flows | ||
|
|
||
| ## i. Overview | ||
|
|
||
| This module defines `CauchyFlow`, the momentum-balance layer of the fluid API. | ||
| Specialized predicates and equations for Cauchy flows are organized in sibling modules. | ||
|
|
||
| ## ii. Key results | ||
|
|
||
| - `CauchyFlow` : A fluid flow with Cauchy stress and specific body force. | ||
|
|
||
| ## iii. Table of contents | ||
|
|
||
| - A. Cauchy-flow structure | ||
|
|
||
| ## iv. References | ||
|
|
||
| -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace FluidDynamics | ||
|
|
||
| /-! | ||
|
|
||
| ## A. Cauchy-flow structure | ||
|
|
||
| -/ | ||
|
|
||
| /-- A fluid flow equipped with Cauchy stress and specific body-force fields. | ||
|
|
||
| This is the momentum-balance layer of the fluid API. The Cauchy stress is the primitive | ||
| dynamic field; pressure and viscosity enter through stress laws rather than as fields of | ||
| `CauchyFlow` itself. -/ | ||
| structure CauchyFlow (d : ℕ) extends FluidFlow d where | ||
| /-- The Cauchy stress tensor field. -/ | ||
| stress : StressTensor d | ||
| /-- The specific body-force field, i.e. force per unit mass. -/ | ||
| specificBodyForce : VectorField d | ||
|
|
||
| end FluidDynamics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /- | ||
| Copyright (c) 2026 Florian Wiesner. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Florian Wiesner, Michał Mogielnicki | ||
| -/ | ||
| module | ||
|
|
||
| public import Physlib.FluidDynamics.CauchyFlow.Basic | ||
| public import Physlib.SpaceAndTime.Space.Derivatives.Grad | ||
| /-! | ||
|
|
||
| # Body-force predicates for Cauchy flows | ||
|
|
||
| ## i. Overview | ||
|
|
||
| This module defines predicates for conservative specific body forces on `CauchyFlow`. | ||
|
|
||
| ## ii. Key results | ||
|
|
||
| - `CauchyFlow.HasBodyForcePotential` : Predicate encoding the convention | ||
| `specificBodyForce = -grad Phi`. | ||
| - `CauchyFlow.HasConservativeBodyForce` : Predicate saying the specific body force has some | ||
| potential. | ||
|
|
||
| ## iii. Table of contents | ||
|
|
||
| - A. Conservative-force convention | ||
|
|
||
| ## iv. References | ||
|
|
||
| -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| open Space | ||
|
|
||
| namespace FluidDynamics | ||
|
|
||
| namespace CauchyFlow | ||
|
|
||
| /-! | ||
|
|
||
| ## A. Conservative-force convention | ||
|
|
||
| -/ | ||
|
|
||
| /-- A flow has body-force potential `Phi` when its specific body force is minus the gradient of | ||
| `Phi`. -/ | ||
| def HasBodyForcePotential (d : ℕ) (flow : CauchyFlow d) (potential : Space d → ℝ) : Prop := | ||
| ∀ t x, flow.specificBodyForce t x = -(∇ potential x) | ||
|
|
||
| /-- A flow has conservative body force when its specific body force has some potential. -/ | ||
| def HasConservativeBodyForce (d : ℕ) (flow : CauchyFlow d) : Prop := | ||
| ∃ potential : Space d → ℝ, HasBodyForcePotential d flow potential | ||
|
|
||
| end CauchyFlow | ||
|
|
||
| end FluidDynamics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /- | ||
| Copyright (c) 2026 Florian Wiesner. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Florian Wiesner, Michał Mogielnicki | ||
| -/ | ||
| module | ||
|
|
||
| public import Physlib.FluidDynamics.CauchyFlow.Basic | ||
| public import Physlib.SpaceAndTime.Space.Derivatives.MatrixDiv | ||
| /-! | ||
|
|
||
| # Inviscid stress laws for Cauchy flows | ||
|
|
||
| ## i. Overview | ||
|
|
||
| This module defines the inviscid stress law for `CauchyFlow` and the corresponding | ||
| matrix-divergence identity for pressure stress. | ||
|
|
||
| ## ii. Key results | ||
|
|
||
| - `CauchyFlow.IsInviscid` : Predicate saying the Cauchy stress is the inviscid pressure stress. | ||
| - `CauchyFlow.matrixDiv_stress_eq_neg_grad_pressure_of_is_inviscid` : The inviscid stress | ||
| contributes the usual pressure-gradient force term. | ||
|
|
||
| ## iii. Table of contents | ||
|
|
||
| - A. Inviscid stress law | ||
|
|
||
| ## iv. References | ||
|
|
||
| -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| open Space | ||
|
|
||
| namespace FluidDynamics | ||
|
|
||
| namespace CauchyFlow | ||
|
|
||
| /-! | ||
|
|
||
| ## A. Inviscid stress law | ||
|
|
||
| -/ | ||
|
|
||
| /-- A Cauchy flow is inviscid with pressure `p` when its stress is the isotropic pressure stress | ||
| `-p I`. | ||
|
|
||
| In this formulation, inviscid means that the Cauchy stress has no viscous or shear contribution. | ||
| It does not rule out body forces; those are carried separately by `CauchyFlow.specificBodyForce`. | ||
| -/ | ||
| def IsInviscid (d : ℕ) (flow : CauchyFlow d) (pressure : ScalarField d) : Prop := | ||
| ∀ t x, flow.stress t x = (-(pressure t x)) • (1 : Matrix (Fin d) (Fin d) ℝ) | ||
|
|
||
| /-- The matrix divergence of the inviscid pressure stress `-p I` is `-grad p`. -/ | ||
| lemma matrixDiv_inviscid_pressure_stress (d : ℕ) (pressureAtTime : Space d → ℝ) : | ||
| matrixDiv d (fun x => (-(pressureAtTime x)) • (1 : Matrix (Fin d) (Fin d) ℝ)) = | ||
| -∇ pressureAtTime := by | ||
| ext x i | ||
| rw [matrixDiv_apply] | ||
| rw [Finset.sum_eq_single i] | ||
| · simp [grad, Space.deriv_eq] | ||
| · intro j _ hji | ||
| have hij : i ≠ j := fun h => hji h.symm | ||
| simp [hij] | ||
| · intro hi | ||
| simp at hi | ||
|
|
||
| /-- In an inviscid Cauchy flow, the stress-divergence force is the usual | ||
| negative pressure-gradient term. -/ | ||
| theorem matrixDiv_stress_eq_neg_grad_pressure_of_is_inviscid | ||
| (d : ℕ) (flow : CauchyFlow d) (pressure : ScalarField d) | ||
| (hInviscid : IsInviscid d flow pressure) : | ||
| ∀ t, matrixDiv d (flow.stress t) = -∇ (pressure t) := by | ||
| intro t | ||
| rw [show flow.stress t = | ||
| fun x => (-(pressure t x)) • (1 : Matrix (Fin d) (Fin d) ℝ) by | ||
| funext x | ||
| exact hInviscid t x] | ||
| exact matrixDiv_inviscid_pressure_stress d (pressure t) | ||
|
|
||
| end CauchyFlow | ||
|
|
||
| end FluidDynamics |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.