MoonBit Marine Biogeochemical Box Model Engine: Configurable NPZD, oxygen depletion, and carbon cycle simulation framework.
flowchart TD
A[src/types] --> B[src/core]
B --> C[src/solver]
C --> D[src/models]
D --> E[src/analysis]
D --> F[src/extensions]
D & E & F --> G[src/exporter]
G --> H[cmd/main]| Path | Purpose |
|---|---|
| src/types | Physical units, state vectors, parameters, light attenuation, and environmental forcing. |
| src/core | Reaction kinetics, Redfield stoichiometry, gas transfer, and seawater thermodynamics. |
| src/solver | ODE solvers, adaptive stepping, and trajectory integrity validation. |
| src/models | Ecological, oxygen, carbonate, iron, silicon, and microbial-loop model families. |
| src/analysis | Sweeps, sensitivity, uncertainty quantification, trajectory metrics, and scenario checks. |
| src/extensions | Water-column transport, sediment processes, assimilation interfaces, and builders. |
| src/exporter | Serializers, reports, plots, and diagram exporters. |
| cmd/main | Interactive demonstration of the main simulation workflow. |
| cmd/benchmark | Deterministic native workloads used for repeatable performance measurements. |
| scripts | Source accounting and benchmark runners. |
moon check
moon test
moon run cmd/main --target native --releaselet model = @models.create_npzd_model(15.0, 0.5, 0.1, 0.2)
let env_fn = fn(t) { @types.EnvironmentForcing::seasonal_forcing(t, 45.0) }
let trajectory = @solver.solve_rk4(model, 30.0, 0.5, env_fn).unwrap()
let series = trajectory.get_time_series("P").unwrap()
let plot = @exporter.render_ascii_plot(series, "Phytoplankton (mmol N/m^3)", 30, 6)
println(plot)let validation = trajectory.validate()
let summary = @analysis.summarize_trajectory(trajectory).unwrap()
println(summary.duration.to_string())pwsh -NoProfile -File scripts/run-benchmark.ps1 -Runs 5pwsh -NoProfile -File scripts/measure-source.ps1moon fmt
moon info
moon check --target all --deny-warn
moon test --target all --deny-warn
moon fmt --checkmoon test --enable-coverage
moon coverage report -f summary
moon coverage analyzeMoonBit Marine Biogeochemical Box Model Engine: Configurable NPZD, oxygen depletion, and carbon cycle simulation framework.