Repository navigation
physics: the hull model, forces per triangle against the free surface (O11a) - #1173
Merged
Merged
Conversation
…surface A dynamic body may carry a hull (body_desc::hull, cvc/physics/hull.h): a closed triangle list apart from its collision shape. Fluid fields push on its triangles in place of the 8-cells-per-side sample: each triangle is split at the waterline (the free surface's height at its vertices, or the box top), and its submerged part feels hydrostatic pressure at its centre of pressure, ITTC-57 friction, pressure drag growing with (v.n)^2, a bounded added-mass slamming term and the field's damping in heave. The velocity terms are integrated implicitly in their own linear and rotational rates. det:: math, a fixed order. A world with hulls saves a CVCHULL1 section (each hull's digest and its triangles' last wetted areas), so state_hash covers them and restore refuses other hulls; a world without hulls saves and hashes as before. physics_hull_test covers floating, righting, towing resistance, a drop, a light hull, heave on a swell and the state, and pins a hull scene's hash.
The field's damping on a hull now sums to the cells' c V_sub, shared among the downward faces by the water column over each; upward faces under water took their column too, so a submerged hull was damped more the deeper it went. The horizontal drag is scaled in the rate without the damping, so the damping no longer slows a towed hull. add_body keeps a private copy of the hull mesh, so the cached normals, wetted areas and digest always describe what is simulated. The torque's inertia estimate also takes the collision shape's where that is lower. New tests: the first-step torque on a heeled box is the wall-sided righting moment (12 and 432 triangles), a sinking hull keeps its speed at depth, and changing the caller's mesh after add_body changes nothing. The towing test now checks the absolute resistance. The hull scene's pinned hash is re-measured (2f71a1fe229afa75); the docs say CI has yet to confirm it.
# Conflicts: # docs/PHYSICS_API.md
transfix
enabled auto-merge (squash)
November 12, 2026 08:28
#1159 (O7c) kept the last source sea_surface found in a thread_local, so the velocity a fluid field reads after a cell's height at the same point and time did not invert the sideways move again. A thread_local that keeps state between calls is a static cache, which libcvc's no-singletons rule forbids (VOLROVER-LIBRARY-PORTS-ROADMAP.md 1.3, tools/singleton_scan). #1159's release-grpc job, where the scan runs, was cancelled, so the scan never judged it; the next PR that merges master would fail that lane on it. The memo now belongs to the caller: - sea_surface::source_memo, and height() / velocity() overloads that take one. The plain reads share nothing. - fluid_surface::height_with / velocity_with and a surface_memo the caller owns; the defaults ignore it. ocean_surface passes it to the sea. - field_set::apply keeps one memo per cell, for the cell's height and its velocity at the same clipped centre. The memo is keyed on the point, the time and the digest as before, so every value is unchanged.
…ocal The writable-data scan (#1152 made its allowlist a ratchet) refuses process-wide state, and sea_surface::source kept its last source in a thread_local (O7c, #1159), so every PR's package-linux release-grpc lane now fails on master's code. The memo moves into the time's frame, under the mutex the frame already has for its lattice: a frame is the surface at one time, so the point alone is the key, and as a memo of a pure function it changes no value. ocean_sea_test (19, pins unchanged) and physics_field_test (22, goldens unchanged) pass; the exact height-and-velocity pair still costs about what it did (3.8 us, 1.76 us on the lattice).
… into feat/physics-hull # Conflicts: # docs/PHYSICS_API.md
Owner
Author
|
This branch carried #1193's fix for the sea's source memo, so the writable-data scan would pass. #1193 was closed as superseded by #1181, Joe's pick, so I swapped it:
Until #1181 merges, this PR's diff includes #1181's 10 files. Once #1181 lands they match master, and this PR merges with only its own changes. The other order is safe too: the branch now carries exactly #1181's code, so whichever merges first, the master that results was tested. Physics and ocean tests pass locally on Windows Release. |
…/physics-hull # Conflicts: # docs/PHYSICS_API.md
transfix
added a commit
that referenced
this pull request
Nov 13, 2026
…erf/threaded-s1b #925 starts ws-open's connect and ws-recv's wait where the transport does not block (the browser without threads), and their callbacks settle the call. Its start paths kept the async_host by reference and posted through it; here they take the host's finisher (host.make_finisher()) and settle_started through it, as http_work and uri_fetch_work do: the callbacks answer later, and an isolated document's group's host may be gone by then. - net_intrinsics.cpp: the conflict kept this branch's providers by kind; have_ws takes master's NetAccess::ws. The any provider's comment says a host's own WebSocket transport must be as thread-safe as the compiled backend. - ariadne_runtime_test: both sides' new L4 cases are kept, plus AStartedWebSocketCallKeepsTheHostItStartedOn, the WebSocket twin of AStartedRequestKeepsTheHostItStartedOn.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
O11a in
docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md(section 7, D2): the hull model. A fluid now pushes on a boat's hull triangle by triangle, instead of on the 8-cells-per-side samples crates use.The model (
cvc/physics/hull.h)A body declares a hull with
body_desc::hull: a closed triangle list in its own frame, apart from its collision shape.box_hull()makes a box hull. Each step, for each fluid field, each triangle is split at the waterline (the free surface's height over its vertices, or the field box's top). Its submerged part feels these forces against the water's velocity:suction_coefficienton faces it leaves)save()andstate_hash(). A world without hulls keeps every existing hash and file format.Tests (
physics_hull_test, 15)54099f602b79feb7, measured on Windows MSVC and to be confirmed by CI on Linux and macOS.Checked locally (Windows Release)
Before the review fixes:
ctest -R Physicspassed 134, with 2 skipped by design; thephysics_replaytrace passed;physics_field_testpassed 21/21, its goldens unchanged.An independent review found two medium-severity issues and four low ones, all fixed (
physics_hull_test15/15 after them):TheRightingMomentIsTheWallSidedOne);Master is merged in, after #1159.
Known limits
snapshot()or its JSON, and pycvc doesn't bind them yet.Next: O11, the boat (propulsion and rudder on O10's
add_force_at, water kept out of the hull, a drivable boat in lsystem_coast).