Skip to main content

rscm_components/
lib.rs

1//! Shared climate model components for RSCM
2//!
3//! This crate provides a collection of reusable climate model components that implement
4//! the [`Component`](rscm_core::component::Component) trait from `rscm-core`. These components
5//! can be combined using the [`Model`](rscm_core::model::Model) orchestrator to build
6//! reduced-complexity climate models.
7//!
8//! # Available Components
9//!
10//! ## Carbon Cycle
11//!
12//! - [`CarbonCycle`] - A one-box carbon cycle model that tracks atmospheric CO2 concentrations
13//!   and land uptake based on emissions and temperature
14//!
15//! ## Radiative Forcing
16//!
17//! - [`CO2ERF`] - Calculates effective radiative forcing from CO2 concentrations using the
18//!   standard logarithmic relationship
19//!
20//! ## Ocean Heat Uptake
21//!
22//! - [`FourBoxOceanHeatUptake`] - Distributes scalar ERF to regional ocean heat uptake using
23//!   a four-box grid structure (Northern/Southern Ocean/Land)
24//!
25//! ## Ocean Carbon Cycle
26//!
27//! - [`ocean_carbon_cycle::OceanSurfacePartialPressure`] - Calculates partial pressure of CO2
28//!   at the ocean surface based on temperature and dissolved inorganic carbon
29//!
30//! # Usage
31//!
32//! Components are designed to be composed into a [`Model`](rscm_core::model::Model) using
33//! the [`ModelBuilder`](rscm_core::model::ModelBuilder). Each component declares its input
34//! and output requirements, and the model orchestrator automatically resolves dependencies
35//! and executes components in the correct order.
36//!
37//! ```rust,ignore
38//! use rscm_core::model::ModelBuilder;
39//! use rscm_components::{CarbonCycle, CarbonCycleParameters, CO2ERF, CO2ERFParameters};
40//!
41//! let carbon_cycle = CarbonCycle::from_parameters(CarbonCycleParameters {
42//!     tau: 30.0,
43//!     conc_pi: 278.0,
44//!     alpha_temperature: 0.0,
45//! });
46//!
47//! let co2_erf = CO2ERF::from_parameters(CO2ERFParameters {
48//!     erf_2xco2: 3.7,
49//!     conc_pi: 278.0,
50//! });
51//!
52//! let model = ModelBuilder::new()
53//!     .with_component(Box::new(carbon_cycle))
54//!     .with_component(Box::new(co2_erf))
55//!     .build();
56//! ```
57//!
58//! # Constants
59//!
60//! The [`constants`] module provides physical constants used across components, such as
61//! the conversion factor between GtC and ppm of atmospheric CO2.
62
63mod components;
64pub mod constants;
65pub mod python;
66
67pub use components::*;