vinihcrosaandClaude Sonnet 4.6 dd4e79cbd6 feat(naval): add naval domain module (M2)
NavalForceModel bridge pattern keeps core::ForceModel interface intact
while providing NavalContext (environment, speedToWater, speedToWind,
EMA q_avg) to all naval models via bindContext.

Force models: Inertial (Coriolis), Restoring (hydrostatic spring),
Damping (potential + linear/quadratic), Squat (ICORELS shallow-water),
Wind (REGULAR/ACSINKAGE), Current (OBOKATA section-integration and
REGULAR with Van der Pol VIM RK4), Thrust (open-water Kt), Rudder
(Prandtl lift), Tug (PUSH/PULL/ESCORTING with bilinear table).

Wave engine: JONSWAP/PIERSON/REGULAR spectrum, Mitsuyasu cos-2S
directional spreading, WAMIT RAO interpolation in WaveForces.

NavalSimulation wraps core::Simulation, rebuilds NavalContext each
step, maintains EMA (tau=16.5s). 63/63 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 01:14:23 -03:00
2026-06-21 22:31:35 -03:00
2026-06-21 22:31:35 -03:00
2026-06-21 22:59:35 -03:00
2026-06-21 22:31:35 -03:00

Ymir

General-purpose physics engine. Designed to simulate the dynamics of physical bodies under arbitrary force systems — extensible to any domain. Coupled with any viewer or simulator via a clean C API.

Current scope: naval domain. First implementation covers 6-DOF hydrodynamics for ships and floating platforms (current, wind, waves, thrusters, rudders, tugs). The architecture is domain-agnostic by design.

What it does (naval module)

  • Simulates vessel motion under current, wind, and waves
  • Models propulsion (thrusters, rudders), mooring forces, and tug interactions
  • Exposes a C API (DLL/.so/.dylib) for integration with Unity, C#, Python, or any host
  • Runs in fast-time (pure simulation) or real-time (frame-driven by external host)

Requirements

Concern Decision
Language C++17
Mesh library CGAL
ODE solver SUNDIALS CVODE
Build system CMake ≥ 3.16
Tests Catch2
Docs Doxygen
Targets Linux, macOS, Windows — x86_64 & ARM64

Architecture

Ports and Adapters. Physics core is pure library — no I/O, no rendering, no file dependencies. Adapters handle JSON input, CSV output, and the public C API.

ymir/
├── core/           # Pure physics — forces, integrator, vessel state
├── adapters/       # JSON I/O, CSV writer, C API (DLL boundary)
├── applications/   # Executables: fasttime, realtime
├── tests/          # Catch2 unit + integration tests
├── docs/           # Architecture docs, design decisions
└── include/        # Public C headers (DLL interface)

Folder structure is provisional — see docs/ as the project evolves.

Building

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Cross-compilation targets and packaging scripts will be documented once the build system is established.

Design principles

  • No global state in the physics core
  • No runtime allocations inside the integration loop
  • Pure C interface at the DLL boundary — no STL, no exceptions crossing the ABI
  • Every public function documented with Doxygen
  • Every module covered by unit tests before integration
S
Description
6-DOF ship dynamics simulator (C++)
Readme MIT
3.2 MiB
0 Stars 1 Watchers 0 Forks
Languages
C++ 58.1%
TypeScript 39.1%
CMake 1.5%
Shell 0.8%
Dockerfile 0.3%