|
1 | | -# HydroChrono |
2 | 1 |
|
3 | | -**HydroChrono** is an emerging hydrodynamics simulation tool designed to model complex ocean systems. Seamlessly integrated with the [Project Chrono](https://projectchrono.org/) physics engine, it offers a powerful C++ API for a wide range of simulations. |
| 2 | +<p align="center"> |
| 3 | + <img src="docs/assets/img/hydrochrono_banner.png" /> |
| 4 | + <br/> |
| 5 | + <a href="https://github.com/NREL/HydroChrono/releases"><img src="https://img.shields.io/badge/version-v0.3-blue.svg" /></a> |
| 6 | + <a href="#"><img src="https://img.shields.io/badge/status-Prototype-orange.svg" /></a> |
| 7 | +</p> |
4 | 8 |
|
5 | | -## Capabilities |
| 9 | +> [!NOTE] |
| 10 | +> HydroChrono is under active development (v0.3 prototype). This early release focuses on a YAML‑driven CLI and portable HDF5 outputs so you can try the code and share feedback. Expect rapid iteration over the coming year — please open issues/feature requests and join discussions. |
| 11 | +> |
| 12 | +> • Issues: https://github.com/NREL/HydroChrono/issues |
| 13 | +> • Discussions: https://github.com/NREL/HydroChrono/discussions |
6 | 14 |
|
7 | | -HydroChrono extends the versatility of Project Chrono to hydrodynamic applications, enabling you to simulate multibody wave energy converters (WECs) and floating offshore wind turbines (FOWTs) with Chrono::FEA for flexible bodies. |
| 15 | +HydroChrono (Hydrodynamics for Project Chrono) is a hydrodynamics simulation toolkit built on [Project Chrono](https://projectchrono.org/). This repo ships a prototype, YAML‑driven CLI app for running simulations and exporting portable results. |
8 | 16 |
|
9 | | -## Get Started |
| 17 | +## What it does (under the hood) |
10 | 18 |
|
11 | | -Visit the [HydroChrono website](https://nrel.github.io/HydroChrono/) for information about the underlying theory, build instructions, and usage details. Currently, HydroChrono is available as a source build, offering customization and optimization opportunities. A binary distribution with Python wrapper is in development and coming soon. |
| 19 | +- Uses Boundary Element Method (BEM) hydrodynamic coefficients (e.g., from [Capytaine](https://github.com/capytaine/capytaine)) to describe added mass, radiation damping, and wave excitation. HydroChrono reads these coefficients from BEMIO‑format HDF5 (.h5) files, an approach familiar to [WEC‑Sim](https://github.com/WEC-Sim/WEC-Sim) users. |
| 20 | +- Runs time‑domain simulations via the Cummins equation (impulse‑response/convolution form for radiation effects). |
| 21 | +- Builds complex, nonlinear multibody systems using Project Chrono; hydrodynamic loads are currently first‑order, with expanded models planned. |
| 22 | +- Exports portable results to HDF5 for post‑processing and validation. |
12 | 23 |
|
13 | | -## Limitations |
| 24 | +## Download |
14 | 25 |
|
15 | | -- Currently only supports first-order linear potential flow forces. |
16 | | -- Hydrodynamic forces are currently limited to rigid bodies. |
| 26 | +- Get the latest Windows binaries from the [Releases](https://github.com/NREL/HydroChrono/releases) page. |
17 | 27 |
|
18 | | -## Vision and Future Goals |
| 28 | +## Quick start (CLI) |
19 | 29 |
|
20 | | -- Expand hydrodynamics to incorporate nonlinear and 2nd order forces. |
21 | | -- Integrate advanced simulation features using Project Chrono's DEM and FEA modules. |
22 | | -- Support seamless transitioning from potential flow to CFD and SPH for detailed FSI analysis. |
23 | | -- Develop a Python API to broaden accessibility and ease of use. |
24 | | -- Foster and support open-source collaboration in the research community. |
| 30 | +After downloading, open a terminal in the app folder and run: |
25 | 31 |
|
26 | | -## Build Instructions |
| 32 | +```powershell |
| 33 | +run_hydrochrono.exe -h # help |
| 34 | +run_hydrochrono.exe -i # info/banner |
| 35 | +
|
| 36 | +# Run a case by directory (auto-detects setup) |
| 37 | +run_hydrochrono.exe .\cases\my_model\ |
| 38 | +
|
| 39 | +# Or run directly from a setup file |
| 40 | +run_hydrochrono.exe .\cases\my_model\my_model.setup.yaml |
| 41 | +
|
| 42 | +# Useful options |
| 43 | +run_hydrochrono.exe .\cases\my_model\ --nogui --output-h5 results.h5 |
| 44 | +``` |
27 | 45 |
|
28 | | -### Prerequisites |
| 46 | +### CLI Example |
29 | 47 |
|
30 | | -- **Visual Studio 2022** with C++ toolchain |
31 | | -- **CMake 3.18+** |
32 | | -- **Project Chrono** (built from source; tested v9.0.0–v9.0.1) |
33 | | -- **HDF5 1.10.8+** |
34 | | -- **Eigen 3.4+** (header-only unzip is fine) |
35 | | -- **Irrlicht 1.8.x** (optional but required for GUI helper) |
36 | | -- **Python 3.8+** (only for docs/tools) |
| 48 | +The CLI prints a concise summary of what will run so you can check inputs and spot mistakes quickly: |
37 | 49 |
|
38 | | -### Building from Source (using `build-config.json` + script) |
| 50 | +- Banner and version/status |
| 51 | +- Input summary: directory or setup file, resolved `*.model.yaml`, `*.simulation.yaml`, `*.hydro.yaml`, output directory |
| 52 | +- Simulation summary: bodies, constraints, estimated DoFs, time step, duration |
| 53 | +- Hydrodynamic data summary (from HDF5): file name, number of bodies, DoFs/body, frequency count, IRF/excitation/radiation/added‑mass flags |
| 54 | +- Wave model summary (type, height, period or spectrum) |
| 55 | +- Start/complete markers with steps and wall time; exported HDF5 path echoed for traceability |
39 | 56 |
|
40 | | -1. **Clone the repository** |
41 | | - ```powershell |
42 | | - git clone https://github.com/NREL/HydroChrono.git |
43 | | - cd HydroChrono |
44 | | - ``` |
| 57 | +Tips: use `--quiet` to reduce logs, `--debug`/`--trace` for deeper diagnostics. |
45 | 58 |
|
46 | | -2. **Create your local config from the example** |
47 | | - ```powershell |
48 | | - copy build-config.example.json build-config.json |
49 | | - ``` |
| 59 | +<p align="center"><img src="docs/assets/img/cli_example.png" width="75%" /></p> |
50 | 60 |
|
51 | | -3. **Edit `build-config.json`** and set paths for your machine |
| 61 | +### GUI Example |
52 | 62 |
|
53 | | - **Example:** |
54 | | - ```json |
55 | | - { |
56 | | - "ChronoDir": "C:/path/to/chrono/build/cmake", |
57 | | - "Hdf5Dir": "C:/path/to/hdf5/share/cmake", |
58 | | - "EigenDir": "C:/path/to/eigen-3.4.0", |
59 | | - "IrrlichtDir": "C:/path/to/irrlicht-1.8.4", |
60 | | - "PythonRoot": "C:/Users/<you>/.conda/envs/<env>", |
61 | | - "CMakeModulePath": "C:/path/to/chrono/build/cmake" |
62 | | - } |
63 | | - ``` |
| 63 | +Use the GUI to visually inspect the assembled multibody system (bodies, joints, actuators) and verify that YAML inputs are wired correctly. Use the `--nogui` option to disable visualization straight from CLI, or change the settings in the `*.simulation.yaml` file. |
64 | 64 |
|
65 | | -4. **Build (from repo root)** |
| 65 | +<p align="center"><img src="docs/assets/img/gui_example.png" width="40%" /></p> |
66 | 66 |
|
67 | | - - Clean configure + build (default `Release`): |
68 | | - ```powershell |
69 | | - .\quick-build.ps1 -Clean |
70 | | - ``` |
71 | | - - Build a different configuration (e.g., `Debug`): |
72 | | - ```powershell |
73 | | - .\quick-build.ps1 -BuildType Debug |
74 | | - ``` |
75 | 67 |
|
76 | | -4. **Post-Build Steps** |
| 68 | +## YAML-based UI |
77 | 69 |
|
78 | | -Copy the following DLL files from your Chrono build directory to your build directory's `build/bin` folder: |
79 | | -- ChronoEngine.dll |
80 | | -- ChronoEngine_irrlicht.dll (if using Irrlicht) |
81 | | -- Irrlicht.dll (if using Irrlicht) |
| 70 | +HydroChrono uses separate YAML files so you can describe a mechanical system once and run it across different hydrodynamic backends (potential flow today; SPH/CFD next). This keeps your Chrono model clean and reusable. Everything is defined in text based files - making it easier to automate. |
82 | 71 |
|
83 | | -5. **Run the tests** |
84 | | - ```powershell |
85 | | - cd build |
86 | | - ctest -C Release |
87 | | - ``` |
| 72 | +``` |
| 73 | +cases/my_model/ |
| 74 | + my_model.setup.yaml # references the files below (recommended) |
| 75 | + my_model.model.yaml # bodies, joints, actuators |
| 76 | + my_model.simulation.yaml # time step, duration, GUI, waves |
| 77 | + my_model.hydro.yaml # hydrodynamics |
| 78 | +``` |
88 | 79 |
|
89 | | ---- |
| 80 | +- `my_model.setup.yaml` — simulation 'orchestrator' |
| 81 | + - Specifies the input files you want to run |
| 82 | +- `my_model.model.yaml` — the multibody system |
| 83 | + - Bodies, joints, constraints, actuators, sensors (pure Chrono) |
| 84 | +- `my_model.simulation.yaml` — how to run it |
| 85 | + - Time step, duration, output options, GUI flags (pure Chrono) |
| 86 | +- `my_model.hydro.yaml` — hydrodynamics inputs |
| 87 | + - BEMIO `.h5` path (e.g., from Capytaine), body ↔ hydrodynamic body mapping, desired wave inputs |
90 | 88 |
|
91 | | -### Clean Build |
92 | 89 |
|
| 90 | +Run with either the folder path (auto-detects `*.setup.yaml`) or the setup file directly: |
93 | 91 | ```powershell |
94 | | -# From the project root |
95 | | -Remove-Item -Recurse -Force build |
96 | | -# then reconfigure/build |
97 | | -.\quick-build.ps1 -Clean |
| 92 | +run_hydrochrono.exe .\cases\my_model\ |
| 93 | +run_hydrochrono.exe .\cases\my_model\my_model.setup.yaml |
98 | 94 | ``` |
99 | 95 |
|
100 | | -For more detailed build instructions, including Visual Studio setup and running demos, see the [developer documentation](https://nrel.github.io/HydroChrono/developer_docs/build_instructions.html). |
| 96 | +### Example *.model.yaml file |
| 97 | + |
| 98 | +<p align="center"><img src="docs/assets/img/yaml_example.png" width="25%" /></p> |
| 99 | + |
| 100 | + |
| 101 | +## HDF5 outputs (portable) |
| 102 | + |
| 103 | +- Simulations produce a single `.h5` file with time series and model results. |
| 104 | +- Typical datasets include: |
| 105 | + - body position (XYZ): |
| 106 | + - `/results/model/bodies/<body_name>/position` (columns 0..2) |
| 107 | + - body orientation (roll, pitch, yaw): |
| 108 | + - `/results/model/bodies/<body_name>/orientation_xyz` (columns 0..2) |
| 109 | + - translational spring–dampers: |
| 110 | + - `/results/model/tsdas/<actuator_name>/` (force components, extension, speed, etc.) |
| 111 | + - rotational spring–dampers: |
| 112 | + - `/results/model/rsdas/<actuator_name>/` (torque components, angle, angular_velocity, etc.) |
| 113 | +- View/plot with HDFView or VS Code HDF5 extensions. |
| 114 | + - HDFView: `https://www.hdfgroup.org/downloads/hdfview/` |
| 115 | + |
| 116 | +<p align="center"><img src="docs/assets/img/h5_example.png" width="75%" /></p> |
| 117 | + |
| 118 | +## Examples |
| 119 | + |
| 120 | +- Additional ready‑to‑run cases will be included on the Releases page. |
| 121 | +- They double as regression tests: |
| 122 | + ```powershell |
| 123 | + python .\run_tests.py --all |
| 124 | + ``` |
| 125 | + |
| 126 | +## Developers |
| 127 | + |
| 128 | +- Full build and contribution docs: [Developer documentation](https://nrel.github.io/HydroChrono/developer_docs/build_instructions.html) |
0 commit comments