Skip to content

Add a Navier-Stokes showcase to the README and docs: vortex street figure and animation - #59

Merged
xtalax merged 7 commits into
masterfrom
docs/ns-showcase
Nov 5, 2026
Merged

xtalax merged 7 commits into
masterfrom
docs/ns-showcase

Conversation

@xtalax-droid

@xtalax-droid xtalax-droid commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Adds an end-to-end Navier-Stokes example to the README and the docs, with the code that makes the figure and the animation, and the rendered images committed so they display the moment this merges.

What it shows: the DFG channel at Reynolds number 100 (inflow peak 1.5, the 2D-2 inflow), started from rest and run to t = 6, with the same Q2/Q1 Taylor-Hood DAE as the Re 20 example (h = 0.04, 16,430 dofs, tolerance 1e-6). A von Karman vortex street sheds from about t = 3; the Strouhal number measured from the cross-stream velocity at (0.6, 0.2) is 0.28 to 0.31 (benchmark value about 0.3). The Re 20 case (2D-1) is steady and never sheds, so the animation uses Re 100; at tolerance 1e-5 the steps are too coarse and the shedding is damped out.

README: a "Navier-Stokes" section after the heat example holds the still figure and the animation, a scope paragraph, the simulation code block, and the plotting/animation code block (resampling with sol(ts, xs, ys; dv), NaN inside the cylinder, then Makie). CairoMakie is not a dependency of FiniteElementMethod; the section says so and gives the install line (using Pkg; Pkg.add("CairoMakie")). The images use https://raw.githubusercontent.com/SciML/FiniteElementMethod.jl/master/docs/src/assets/ns_showcase.{png,gif}, so they resolve from the repository as soon as this merges, with no docs deploy needed. The gif is 2.64 MB (720 x 350 px, 90 frames at 18 fps, 5.0 s covering simulated time 0 to 6); the png is 196 KB. The heat gif is committed the same way: docs/src/assets/showcase.gif (1.57 MB) is tracked and the README embeds it by https://raw.githubusercontent.com/SciML/FiniteElementMethod.jl/master/docs/src/assets/showcase.gif (it used to be a docs.sciml.ai URL that resolved only after a docs deploy), so the whole README displays at merge. docs/make.jl renders into a scratch directory for both gifs, so a docs build never dirties the tree, and the freshness checksum covers the heat block too (docs/src/assets/showcase.fnv1a; refresh with julia --project=docs examples/showcase.jl, about 2 minutes).

Single source: both code blocks are extracted from the README by block number. examples/ns_showcase.jl runs blocks 2 and 3 in one module, the README test runs block 2 (the plotting block is only parsed in the test, because CairoMakie is not a test dependency), and docs/make.jl re-runs both into a scratch directory so CI proves they run in the docs environment without dirtying the tree. The docs page and the README use the committed copies.

Freshness: docs/src/assets/ns_showcase.fnv1a holds an FNV-1a checksum of README blocks 2 and 3, written by the render script. The Frontend testset "README Navier-Stokes images are current" recomputes it and fails with "the README Navier-Stokes blocks changed; regenerate docs/src/assets/ns_showcase.gif, ns_showcase.png and ns_showcase.fnv1a with julia --project=docs examples/ns_showcase.jl from the repository root", and checks the three files exist and that block 3 parses. Refresh by hand with that one command (about 3 minutes). The checksum covers the README blocks, not the gif bytes, so a different CairoMakie version could change the gif bytes while the checksum stays valid (two renders here were byte-identical).

Other changes: examples/readme_code.jl gains block and names keywords (defaults unchanged); docs/Project.toml adds Ferrite, Gmsh, LinearSolve and SciMLBase (already in the manifest indirectly); navier_stokes.md embeds the images and describes the test; the two .gitignore lines for the NS assets are gone (docs/src/assets/showcase.gif stays ignored).

Cost: the README simulation block about 150 s including compile, the figure about 22 s, the gif about 7 s; the docs build went from 114 s to about 271 s unloaded (+2.6 min); the Frontend group is about 2 minutes longer.

Honest scope: a showcase, not a validated 2D-2 run. Coarse mesh (blocky vortices), vorticity is a central difference of the sampled velocity (noisy near element edges), and only the Strouhal band is tested, not amplitude or lift oscillation. Only the Re 20 steady case is validated against drag, lift and pressure difference. Relation to #54 (merged): the showcase's open outflow has no condition for u and v (only p = 0 is set), which #54's completeness check reports, so README block 2 declares it natural = [Γ_out] and the navier_stokes.md code does the same (Γout there), exactly as examples/dfg_cylinder/dfg_cylinder.jl does on master. The README checksum changed accordingly (ns_showcase.fnv1a: 143fc665d22ed918 to a3eb010d9c375841); the re-render left the gif and png byte-identical.

Local results on Julia 1.12.1: README test 6/6 (heat), 6/6 (NS) and 4/4 (images current); docs build exit 0; Runic 1.13 clean; Codex approved. The Downgrade job fails on every PR for a reason unrelated to this one (#61 fixes it).


🤖 Posted by an AI agent · harness: Claude Code 2.1.318 · model: claude-sonnet-5-5
Review: unreviewed
Session: 43e03fde-3384-4386-bae9-03e81f19ba7c

…ndered by the docs build

The README gains a second code block, the DFG channel at Reynolds number 100 started from rest, and embeds its figure and animation by the docs.sciml.ai assets URLs the heat gif uses. examples/ns_showcase.jl runs that block (extracted from the README, like the heat one) and records speed and vorticity with CairoMakie; docs/make.jl renders ns_showcase.png and ns_showcase.gif and the Navier–Stokes page embeds them. The Frontend README test runs the block and checks no slip, the inflow peak and the Strouhal number of the shed wake. The docs environment gains Ferrite, Gmsh, LinearSolve and SciMLBase, already in its manifest as indirect dependencies, because the block includes the example mesh generator and names the solver.

Agent-Harness: Claude Code 2.1.318
Agent-Model: claude-sonnet-5-5
Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1)

Time benchmarks
master 89579b8... master / 89579b8...
construction/heat P1 10x10 7.22 ± 0.41 ms 7.24 ± 0.37 ms 0.997 ± 0.076
construction/heat P1 20x20 9.81 ± 0.15 ms 9.81 ± 0.15 ms 1 ± 0.022
time_to_load 5.39 ± 0.00041 s 5.4 ± 0.019 s 0.999 ± 0.0036
Memory benchmarks
master 89579b8... master / 89579b8...
construction/heat P1 10x10 0.0393 M allocs: 2.12 MB 0.0393 M allocs: 2.12 MB 1
construction/heat P1 20x20 0.0702 M allocs: 4.73 MB 0.0702 M allocs: 4.73 MB 1
time_to_load 0.2 k allocs: 11.8 kB 0.2 k allocs: 11.8 kB 1

t and others added 6 commits November 5, 2026 00:35
…dered images

The README gains a third code block, the plotting and animation, next to the simulation block, with the CairoMakie install line. examples/ns_showcase.jl runs both blocks as written and writes ns_showcase.gif, ns_showcase.png and a checksum of the two blocks into docs/src/assets. Those copies are committed and the README embeds them by raw.githubusercontent.com URLs, so the animation shows as soon as this merges. A Frontend test fails when the blocks change without the images being regenerated. The docs build re-runs the blocks into a scratch directory to check that they run, and the Navier–Stokes page shows the committed copies.

Agent-Harness: Claude Code 2.1.318
Agent-Model: claude-sonnet-5-5
Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The README embeds the heat gif by its raw.githubusercontent.com URL, like the Navier–Stokes images, so it shows without a docs deploy. docs/src/assets/showcase.gif is tracked with a checksum of README block 1 (showcase.fnv1a), written by examples/showcase.jl, whose default output is now docs/src/assets. The Frontend test checks both image sets against their README blocks. The docs build re-runs the heat block into a scratch directory and no longer writes to docs/src/assets.

Agent-Harness: Claude Code 2.1.318
Agent-Model: claude-sonnet-5-5
Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.318
Agent-Model: claude-sonnet-5-5
Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
…atural

Agent-Harness: Claude Code 2.1.318
Agent-Model: claude-sonnet-5-5
Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
@xtalax
xtalax marked this pull request as ready for review November 5, 2026 18:41
@xtalax
xtalax merged commit d3677fe into master Nov 5, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants