Twine Models
Domain-specific models and model-building tools for Twine.
What this crate provides
twine-models offers opinionated Model implementations for engineering domains, along with the supporting utilities needed to build and compose them.
It is organized into two top-level modules:
models— ready-to-useModelimplementationssupport— utilities used by models, also available for downstream use
See the crate docs for details on each module.
Models
Thermal
Heat exchangers (models::thermal::hx)
Recuperator— a discretized counter-flow heat exchanger that solves for outlet conditions given a UA value and inlet streams
Tanks (models::thermal::tank)
StratifiedTank— a multi-node stratified thermal storage tank with configurable ports, auxiliary heat, conductive losses, and buoyancy-driven mixing
Feature flags
| Feature | What it enables | Default |
|---|---|---|
coolprop |
support::thermo::model::CoolProp (via rfluids) |
no |
Opt in via Cargo.toml:
= { = "0.1", = ["coolprop"] }
Examples
Stratified tank simulation
Simulates five days of residential hot water tank operation with a thermostat-controlled heating element, a daily draw schedule, and an interactive time-series plot.
Utility code (support)
Modules in support are public because they're useful, but their APIs are not yet stable — breaking changes may occur. The lifecycle for utility code is:
- Model-specific — starts private inside a model's
coremodule - Domain-specific — moves to a domain support module when useful across models in a domain
- Crate-level — moves to
supportwhen useful across domains - Standalone — may become its own crate if broadly useful and stable
Twine ecosystem
| Crate | Description |
|---|---|
twine-core |
Model trait and core abstractions |
twine-solvers |
ODE solvers (Euler, etc.) |
twine-observers |
Observer utilities (plotting, logging) |