Version: dev

RelativeHumidity

Relative humidity from water-vapor partial pressure and saturation vapor pressure: RH = 100 * p_H2O / p_sat. Migrated from AtmosphericDynamics.jl@816cc391 src/seinfeld_pandis_ch1.jl:397 (`RelativeHumidity` @component). Implements Seinfeld & Pandis Ch 1 Eq. 1.9. Relative humidity is expressed as a percentage (0-100 for subsaturated air, >100 under transient supersaturation), stored as a dimensionless ratio scaled by 100. Parameterized as observed-only: p_H2O and p_sat are inputs (parameters in standalone form), RH is the algebraic output. Upstream the Julia @component declares p_H2O and p_sat as @variables for composition into a parent system; for standalone serialization (3 unknowns vs 1 equation otherwise), they are declared as parameters here, mirroring the IdealGasLaw / ScaleHeight serialization pattern in this directory.

Domain
atmospheric_dynamics
Subdomain
sp_ch1
Type
model
.esm schema
1.0.0
Source
components/atmospheric_dynamics/sp_ch1/relative_humidity.esm
Tags
#atmospheric_dynamics #sp_ch1 #model #seinfeld-pandis #observed-only #ch1 #humidity

Description

Relative humidity from water-vapor partial pressure and saturation vapor pressure: RH = 100 * p_H2O / p_sat. Migrated from AtmosphericDynamics.jl@816cc391 src/seinfeld_pandis_ch1.jl:397 (RelativeHumidity @component). Implements Seinfeld & Pandis Ch 1 Eq. 1.9. Relative humidity is expressed as a percentage (0-100 for subsaturated air, >100 under transient supersaturation), stored as a dimensionless ratio scaled by 100. Parameterized as observed-only: p_H2O and p_sat are inputs (parameters in standalone form), RH is the algebraic output. Upstream the Julia @component declares p_H2O and p_sat as @variables for composition into a parent system; for standalone serialization (3 unknowns vs 1 equation otherwise), they are declared as parameters here, mirroring the IdealGasLaw / ScaleHeight serialization pattern in this directory.

Reference

_source_ref: AtmosphericDynamics.jl@816cc391:src/seinfeld_pandis_ch1.jl:397 Upstream RelativeHumidity is an MTK @component with percent_factor as a @constants and p_H2O(t), p_sat(t), RH(t) as @variables. For standalone serialization (and to make the component well-posed in isolation — 3 unknowns against 1 equation otherwise), percent_factor, p_H2O, and p_sat are declared as parameters here, with RH the single algebraic state. This matches the bead’s (S, observed-only) classification in docs/migration-tracker.md and the IdealGasLaw / ScaleHeight serialization pattern in this directory. The single algebraic equation RH = percent_factor * p_H2O / p_sat is unchanged from upstream (Eq. 1.9); percent_factor = 100.0 converts the dimensionless p_H2O/p_sat ratio to a percentage.

Tolerance rationale (model-level rel=1e-6): observed-only single-equation algebraic system (no ODE integration); 1e-6 covers float64 roundoff in the percent_factor * p_H2O / p_sat multiply/divide chain across the tropospheric vapor-pressure range (p_sat 611-101325 Pa, p_H2O from 0 up to and beyond p_sat)._

Parameters

NameUnitsDefaultDescription
p_H2OPa1585.0Partial pressure of water vapor
p_satPa3170.0Saturation vapor pressure of water (e.g. ~3170 Pa at 298 K)
percent_factor1100.0Conversion of the dimensionless p_H2O/p_sat ratio to a percentage

Observed

NameUnitsDefaultDescription
RH1Relative humidity (0-100 for subsaturated air, dimensionless)

Observed expressions

$$ RH = \frac{percent_{factor} \cdot p_{H2O}}{p_{sat}} $$

Relative humidity (0-100 for subsaturated air, dimensionless)

Analyses

rh_vs_water_vapor_pressure

Relative humidity as a function of water-vapor partial pressure at a fixed saturation pressure (p_sat = 3170 Pa, ~298 K). Reproduces the linear RH = 100 * p_H2O / p_sat relationship of Eq. 1.9 across the subsaturated range (0 to 100% RH).

Time span: 0.0 → 1.0

Swept over: p_H2O

Relative humidity RH as a function of water-vapor partial pressure at p_sat = 3170 Pa.

rh_vs_saturation_pressure

Relative humidity as a function of saturation vapor pressure at a fixed water-vapor partial pressure (p_H2O = 1585 Pa). Reproduces the inverse RH proportional-to 1/p_sat curve: at fixed water content, warming the air (raising p_sat) lowers RH. p_sat is swept from the freezing-point value (~611 Pa) to the boiling-point value (101325 Pa); RH exceeds 100% at the cold end (supersaturation).

Time span: 0.0 → 1.0

Swept over: p_sat

Relative humidity RH as a function of saturation vapor pressure at p_H2O = 1585 Pa.

rh_pH2O_psat_sweep

Two-dimensional sweep over water-vapor partial pressure and saturation vapor pressure. Surfaces the full RH = 100 * p_H2O / p_sat response: RH rises with p_H2O and falls with p_sat.

Time span: 0.0 → 1.0

Swept over: p_H2O, p_sat

Relative humidity RH as a function of water-vapor partial pressure and saturation vapor pressure.

Raw .esm

Raw .esm JSON (this component)
{
  "reference": {
    "notes": "source_ref: AtmosphericDynamics.jl@816cc391:src/seinfeld_pandis_ch1.jl:397\nUpstream `RelativeHumidity` is an MTK `@component` with `percent_factor` as a `@constants` and p_H2O(t), p_sat(t), RH(t) as `@variables`. For standalone serialization (and to make the component well-posed in isolation — 3 unknowns against 1 equation otherwise), percent_factor, p_H2O, and p_sat are declared as parameters here, with RH the single algebraic state. This matches the bead's `(S, observed-only)` classification in docs/migration-tracker.md and the IdealGasLaw / ScaleHeight serialization pattern in this directory. The single algebraic equation RH = percent_factor * p_H2O / p_sat is unchanged from upstream (Eq. 1.9); percent_factor = 100.0 converts the dimensionless p_H2O/p_sat ratio to a percentage.\n\nTolerance rationale (model-level rel=1e-6): observed-only single-equation algebraic system (no ODE integration); 1e-6 covers float64 roundoff in the percent_factor * p_H2O / p_sat multiply/divide chain across the tropospheric vapor-pressure range (p_sat 611-101325 Pa, p_H2O from 0 up to and beyond p_sat)."
  },
  "tolerance": {
    "rel": 1e-06
  },
  "variables": {
    "p_H2O": {
      "type": "parameter",
      "units": "Pa",
      "default": 1585.0,
      "description": "Partial pressure of water vapor"
    },
    "p_sat": {
      "type": "parameter",
      "units": "Pa",
      "default": 3170.0,
      "description": "Saturation vapor pressure of water (e.g. ~3170 Pa at 298 K)"
    },
    "percent_factor": {
      "type": "parameter",
      "units": "1",
      "default": 100.0,
      "description": "Conversion of the dimensionless p_H2O/p_sat ratio to a percentage"
    },
    "RH": {
      "type": "unknown",
      "units": "1",
      "description": "Relative humidity (0-100 for subsaturated air, dimensionless)"
    }
  },
  "equations": [
    {
      "lhs": "RH",
      "rhs": {
        "op": "/",
        "args": [
          {
            "op": "*",
            "args": [
              "percent_factor",
              "p_H2O"
            ]
          },
          "p_sat"
        ]
      }
    }
  ],
  "tests": [
    {
      "id": "half_saturation",
      "description": "Air at 50% relative humidity: water-vapor partial pressure is half the saturation pressure (p_H2O = 1585 Pa, p_sat = 3170 Pa ~ saturation at 298 K). Mirrors the upstream `2.8 Eq. 1.9` 50%-RH test case.",
      "parameter_overrides": {
        "p_H2O": 1585.0,
        "p_sat": 3170.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "RH",
          "time": 0.0,
          "expected": 50.0
        }
      ]
    },
    {
      "id": "saturation",
      "description": "Saturated air: water-vapor partial pressure equals the saturation pressure (p_H2O = p_sat = 3170 Pa), giving RH = 100%. Mirrors the upstream `2.8 Eq. 1.9` saturation test case. RH is algebraic, so the value is also asserted at t=1.0 to confirm time-invariance.",
      "parameter_overrides": {
        "p_H2O": 3170.0,
        "p_sat": 3170.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "RH",
          "time": 0.0,
          "expected": 100.0
        },
        {
          "variable": "RH",
          "time": 1.0,
          "expected": 100.0
        }
      ]
    },
    {
      "id": "subsaturation",
      "description": "Subsaturated air, non-round ratio (p_H2O = 1500 Pa, p_sat = 3170 Pa): RH lies strictly between 0 and 100. Mirrors the upstream `4.3 Relative Humidity Bounds` subsaturation case (p_H2O/p_sat = 15.0/31.7 mbar, identical ratio).",
      "parameter_overrides": {
        "p_H2O": 1500.0,
        "p_sat": 3170.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "RH",
          "time": 0.0,
          "expected": 47.3186119873817
        }
      ]
    },
    {
      "id": "dry_air",
      "description": "Very dry air at 10% relative humidity (p_H2O = 317 Pa, p_sat = 3170 Pa). Exercises the low-RH end of the range.",
      "parameter_overrides": {
        "p_H2O": 317.0,
        "p_sat": 3170.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "RH",
          "time": 0.0,
          "expected": 10.0
        }
      ]
    },
    {
      "id": "near_saturation",
      "description": "Nearly saturated air at 95% relative humidity (p_H2O = 3011.5 Pa, p_sat = 3170 Pa). Exercises the high-RH end of the subsaturated range.",
      "parameter_overrides": {
        "p_H2O": 3011.5,
        "p_sat": 3170.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "RH",
          "time": 0.0,
          "expected": 95.0
        }
      ]
    },
    {
      "id": "cold_freezing",
      "description": "50% RH at the freezing point: p_sat ~ 611 Pa (saturation at 273 K) with p_H2O = 305.5 Pa. Verifies the ratio is independent of the absolute pressure regime by reproducing RH = 50% at a saturation pressure ~5x lower than the 298 K case.",
      "parameter_overrides": {
        "p_H2O": 305.5,
        "p_sat": 611.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "RH",
          "time": 0.0,
          "expected": 50.0
        }
      ]
    },
    {
      "id": "supersaturation",
      "description": "Transient supersaturation (p_H2O = 3487 Pa > p_sat = 3170 Pa) giving RH = 110%. Confirms the model does not clamp RH at 100% — values above saturation are passed through, as in the upstream equation.",
      "parameter_overrides": {
        "p_H2O": 3487.0,
        "p_sat": 3170.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "RH",
          "time": 0.0,
          "expected": 110.0
        }
      ]
    },
    {
      "id": "boiling_point",
      "description": "50% RH at the boiling-point saturation pressure: p_sat = 101325 Pa (saturation at 373 K) with p_H2O = 50662.5 Pa. Exercises the large-p_sat regime and again confirms RH is set by the ratio, not the absolute pressures.",
      "parameter_overrides": {
        "p_H2O": 50662.5,
        "p_sat": 101325.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "RH",
          "time": 0.0,
          "expected": 50.0
        }
      ]
    }
  ],
  "analyses": [
    {
      "id": "rh_vs_water_vapor_pressure",
      "description": "Relative humidity as a function of water-vapor partial pressure at a fixed saturation pressure (p_sat = 3170 Pa, ~298 K). Reproduces the linear RH = 100 * p_H2O / p_sat relationship of Eq. 1.9 across the subsaturated range (0 to 100% RH).",
      "initial_state": {},
      "parameters": {
        "p_sat": 3170.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "parameter_sweep": {
        "type": "cartesian",
        "dimensions": [
          {
            "parameter": "p_H2O",
            "range": {
              "start": 0.0,
              "stop": 3170.0,
              "count": 25,
              "scale": "linear"
            }
          }
        ]
      },
      "plots": [
        {
          "id": "RH_vs_pH2O",
          "type": "line",
          "description": "Relative humidity RH as a function of water-vapor partial pressure at p_sat = 3170 Pa.",
          "x": {
            "variable": "p_H2O",
            "label": "Water-vapor partial pressure (Pa)"
          },
          "y": {
            "variable": "RH",
            "label": "Relative humidity (%)"
          }
        }
      ]
    },
    {
      "id": "rh_vs_saturation_pressure",
      "description": "Relative humidity as a function of saturation vapor pressure at a fixed water-vapor partial pressure (p_H2O = 1585 Pa). Reproduces the inverse RH proportional-to 1/p_sat curve: at fixed water content, warming the air (raising p_sat) lowers RH. p_sat is swept from the freezing-point value (~611 Pa) to the boiling-point value (101325 Pa); RH exceeds 100% at the cold end (supersaturation).",
      "initial_state": {},
      "parameters": {
        "p_H2O": 1585.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "parameter_sweep": {
        "type": "cartesian",
        "dimensions": [
          {
            "parameter": "p_sat",
            "range": {
              "start": 611.0,
              "stop": 101325.0,
              "count": 25,
              "scale": "linear"
            }
          }
        ]
      },
      "plots": [
        {
          "id": "RH_vs_psat",
          "type": "line",
          "description": "Relative humidity RH as a function of saturation vapor pressure at p_H2O = 1585 Pa.",
          "x": {
            "variable": "p_sat",
            "label": "Saturation vapor pressure (Pa)"
          },
          "y": {
            "variable": "RH",
            "label": "Relative humidity (%)"
          }
        }
      ]
    },
    {
      "id": "rh_pH2O_psat_sweep",
      "description": "Two-dimensional sweep over water-vapor partial pressure and saturation vapor pressure. Surfaces the full RH = 100 * p_H2O / p_sat response: RH rises with p_H2O and falls with p_sat.",
      "initial_state": {},
      "parameters": {},
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "parameter_sweep": {
        "type": "cartesian",
        "dimensions": [
          {
            "parameter": "p_H2O",
            "range": {
              "start": 0.0,
              "stop": 3170.0,
              "count": 12,
              "scale": "linear"
            }
          },
          {
            "parameter": "p_sat",
            "range": {
              "start": 611.0,
              "stop": 101325.0,
              "count": 12,
              "scale": "linear"
            }
          }
        ]
      },
      "plots": [
        {
          "id": "RH_heatmap",
          "type": "heatmap",
          "description": "Relative humidity RH as a function of water-vapor partial pressure and saturation vapor pressure.",
          "x": {
            "variable": "p_H2O",
            "label": "Water-vapor partial pressure (Pa)"
          },
          "y": {
            "variable": "p_sat",
            "label": "Saturation vapor pressure (Pa)"
          },
          "value": {
            "variable": "RH",
            "reduce": "final"
          }
        }
      ]
    }
  ]
}