AtmosphericPressureProfile
Atmospheric pressure, density, and vertical pressure gradient as a function of altitude for an isothermal atmosphere. Couples the hydrostatic equation with the ideal gas law: the scale height H = R*T/(M_air*g) (Eq. 1.4) sets the e-folding altitude, the barometric formula p = p_0*exp(-z/H) (Eq. 1.5) gives pressure, the ideal gas law rho = M_air*p/(R*T) (Eq. 1.2) gives density, and the hydrostatic equation dpdz = -rho*g (Eqs. 1.1/1.3) gives the pressure gradient. Migrated from AtmosphericDynamics.jl@816cc391 src/seinfeld_pandis_ch1.jl:151 (`AtmosphericPressureProfile` @component). Implements Seinfeld & Pandis (2006) Chapter 1 Equations 1.1-1.5 for an isothermal atmosphere — the integrated, constant-scale-height form; a non-isothermal atmosphere would require numerical integration of Eq. 1.3. Parameterized as observed-only: altitude z and temperature T are inputs (parameters in standalone form, with R, M_air, g, p_0 as further parameter inputs carrying their upstream @constant values), and H, p, rho, dpdz are the four algebraic outputs. The upstream `5.3 AtmosphericPressureProfile Compilation` test compiles the component with `inputs = [app_nns.T]`, confirming T is an input.
Description
Atmospheric pressure, density, and vertical pressure gradient as a function of altitude for an isothermal atmosphere. Couples the hydrostatic equation with the ideal gas law: the scale height H = RT/(M_airg) (Eq. 1.4) sets the e-folding altitude, the barometric formula p = p_0exp(-z/H) (Eq. 1.5) gives pressure, the ideal gas law rho = M_airp/(RT) (Eq. 1.2) gives density, and the hydrostatic equation dpdz = -rhog (Eqs. 1.1/1.3) gives the pressure gradient. Migrated from AtmosphericDynamics.jl@816cc391 src/seinfeld_pandis_ch1.jl:151 (AtmosphericPressureProfile @component). Implements Seinfeld & Pandis (2006) Chapter 1 Equations 1.1-1.5 for an isothermal atmosphere — the integrated, constant-scale-height form; a non-isothermal atmosphere would require numerical integration of Eq. 1.3. Parameterized as observed-only: altitude z and temperature T are inputs (parameters in standalone form, with R, M_air, g, p_0 as further parameter inputs carrying their upstream @constant values), and H, p, rho, dpdz are the four algebraic outputs. The upstream 5.3 AtmosphericPressureProfile Compilation test compiles the component with inputs = [app_nns.T], confirming T is an input.
Reference
_source_ref: AtmosphericDynamics.jl@816cc391:src/seinfeld_pandis_ch1.jl:151
Upstream AtmosphericPressureProfile is an MTK @component with R, M_air, g, p_0 as @constants, z as a @parameter, and T(t), H(t), p(t), rho(t), dpdz(t) as @variables. It carries four algebraic equations (Seinfeld & Pandis Ch 1): H = RT/(M_airg) (Eq. 1.4), p = p_0exp(-z/H) (Eq. 1.5), rho = M_airp/(RT) (Eq. 1.2), and dpdz = -rhog (Eqs. 1.1/1.3). T appears only on equation right-hand sides — it is an input, not a computed output — so the four equations close exactly over the four states H, p, rho, dpdz. For standalone serialization (and to make the component well-posed in isolation) T, z, R, M_air, g, and p_0 are declared as parameters here, leaving H, p, rho, dpdz as the algebraic states. This matches the bead’s (S, observed-only) classification in docs/migration-tracker.md and the IdealGasLaw / ScaleHeight / BarometricFormula serialization pattern in this directory. The upstream 5.3 AtmosphericPressureProfile Compilation test (test/seinfeld_pandis_ch1_test.jl:471) confirms this input/output split: it compiles the component with inputs = [app_nns.T], leaving H, p, rho, dpdz as the computed unknowns. Constant values (R = 8.314 J/(mol*K), M_air = 0.02897 kg/mol, g = 9.807 m/s^2, p_0 = 101325.0 Pa) come from the upstream module’s R_GAS / M_AIR / G_ACCEL / P_0 (Seinfeld & Pandis Appendix A). The four algebraic equations are unchanged from upstream.
Upstream provides only structural (1.3 AtmosphericPressureProfile Structure) and compilation (5.3 AtmosphericPressureProfile Compilation) tests for this component — no numerical-accuracy test. The inline tests here therefore anchor on physical reference values: standard sea-level conditions (p = p_0, rho ~ 1.226 kg/m^3, dpdz ~ -12.0 Pa/m at T = 288 K), the e-folding property at z = H (p = p_0/e), and the scale heights cross-checked against scale_height.esm (8427.87 m at 288 K, 7403.65 m at 253 K, 9305.77 m at 318 K).
Tolerance rationale (model-level rel=1e-6): observed-only algebraic system (no ODE integration); 1e-6 covers float64 roundoff in the multiply/divide and exp(-z/H) expression chain across the altitude range (0-20 km) and the atmospheric temperature range (253-318 K)._
Parameters
| Name | Units | Default | Description |
|---|---|---|---|
z | m | 0.0 | Altitude above sea level (sea-level datum z = 0) |
T | K | 288.0 | Temperature of the isothermal atmospheric column — an input, assumed constant with altitude (sea-level standard 288 K) |
R | J/(mol*K) | 8.314 | Universal gas constant |
M_air | kg/mol | 0.02897 | Molecular weight of dry air (28.97 g/mol) |
g | m/s^2 | 9.807 | Gravitational acceleration |
p_0 | Pa | 101325.0 | Standard sea-level pressure (Seinfeld & Pandis Appendix A) |
Observed
| Name | Units | Default | Description |
|---|---|---|---|
H | m | Atmospheric scale height H = RT/(M_airg) — the altitude over which pressure falls by a factor e (Eq. 1.4) | |
p | Pa | Atmospheric pressure at altitude z (barometric formula, Eq. 1.5) | |
rho | kg/m^3 | Air density at altitude z (ideal gas law, Eq. 1.2) | |
dpdz | Pa/m | Vertical pressure gradient dp/dz = -rho*g (hydrostatic equation, Eqs. 1.1/1.3) |
Observed expressions
$$ H = \frac{R \cdot T}{M_{air} \cdot g} $$Atmospheric scale height H = RT/(M_airg) — the altitude over which pressure falls by a factor e (Eq. 1.4)
$$ p = p_{0} \cdot e^{-\frac{z}{H}} $$Atmospheric pressure at altitude z (barometric formula, Eq. 1.5)
$$ rho = \frac{M_{air} \cdot p}{R \cdot T} $$Air density at altitude z (ideal gas law, Eq. 1.2)
$$ dpdz = -rho \cdot g $$Vertical pressure gradient dp/dz = -rho*g (hydrostatic equation, Eqs. 1.1/1.3)
Analyses
profile_vs_altitude
Pressure and density as a function of altitude for an isothermal atmosphere at the sea-level standard temperature (T = 288 K, H ~ 8428 m). Reproduces the canonical exponential decay of Seinfeld & Pandis Eqs. 1.5 and 1.2 from the surface to 30 km.
Time span: 0.0 → 1.0
Swept over: z


pressure_over_altitude_and_temperature
Two-dimensional sweep over altitude z (surface to 20 km) and the isothermal column temperature T (250-310 K). Surfaces the joint dependence of pressure on altitude and on temperature: warmer columns have a larger scale height and so decay more slowly with altitude.
Time span: 0.0 → 1.0
Swept over: z, T

Raw .esm
Raw .esm JSON (this component)
{
"reference": {
"notes": "source_ref: AtmosphericDynamics.jl@816cc391:src/seinfeld_pandis_ch1.jl:151\nUpstream `AtmosphericPressureProfile` is an MTK `@component` with R, M_air, g, p_0 as `@constants`, z as a `@parameter`, and T(t), H(t), p(t), rho(t), dpdz(t) as `@variables`. It carries four algebraic equations (Seinfeld & Pandis Ch 1): H = R*T/(M_air*g) (Eq. 1.4), p = p_0*exp(-z/H) (Eq. 1.5), rho = M_air*p/(R*T) (Eq. 1.2), and dpdz = -rho*g (Eqs. 1.1/1.3). T appears only on equation right-hand sides — it is an input, not a computed output — so the four equations close exactly over the four states H, p, rho, dpdz. For standalone serialization (and to make the component well-posed in isolation) T, z, R, M_air, g, and p_0 are declared as parameters here, leaving H, p, rho, dpdz as the algebraic states. This matches the bead's `(S, observed-only)` classification in docs/migration-tracker.md and the IdealGasLaw / ScaleHeight / BarometricFormula serialization pattern in this directory. The upstream `5.3 AtmosphericPressureProfile Compilation` test (test/seinfeld_pandis_ch1_test.jl:471) confirms this input/output split: it compiles the component with `inputs = [app_nns.T]`, leaving H, p, rho, dpdz as the computed unknowns. Constant values (R = 8.314 J/(mol*K), M_air = 0.02897 kg/mol, g = 9.807 m/s^2, p_0 = 101325.0 Pa) come from the upstream module's R_GAS / M_AIR / G_ACCEL / P_0 (Seinfeld & Pandis Appendix A). The four algebraic equations are unchanged from upstream.\n\nUpstream provides only structural (`1.3 AtmosphericPressureProfile Structure`) and compilation (`5.3 AtmosphericPressureProfile Compilation`) tests for this component — no numerical-accuracy test. The inline `tests` here therefore anchor on physical reference values: standard sea-level conditions (p = p_0, rho ~ 1.226 kg/m^3, dpdz ~ -12.0 Pa/m at T = 288 K), the e-folding property at z = H (p = p_0/e), and the scale heights cross-checked against scale_height.esm (8427.87 m at 288 K, 7403.65 m at 253 K, 9305.77 m at 318 K).\n\nTolerance rationale (model-level rel=1e-6): observed-only algebraic system (no ODE integration); 1e-6 covers float64 roundoff in the multiply/divide and exp(-z/H) expression chain across the altitude range (0-20 km) and the atmospheric temperature range (253-318 K)."
},
"tolerance": {
"rel": 1e-06
},
"variables": {
"z": {
"type": "parameter",
"units": "m",
"default": 0.0,
"description": "Altitude above sea level (sea-level datum z = 0)"
},
"T": {
"type": "parameter",
"units": "K",
"default": 288.0,
"description": "Temperature of the isothermal atmospheric column — an input, assumed constant with altitude (sea-level standard 288 K)"
},
"R": {
"type": "parameter",
"units": "J/(mol*K)",
"default": 8.314,
"description": "Universal gas constant"
},
"M_air": {
"type": "parameter",
"units": "kg/mol",
"default": 0.02897,
"description": "Molecular weight of dry air (28.97 g/mol)"
},
"g": {
"type": "parameter",
"units": "m/s^2",
"default": 9.807,
"description": "Gravitational acceleration"
},
"p_0": {
"type": "parameter",
"units": "Pa",
"default": 101325.0,
"description": "Standard sea-level pressure (Seinfeld & Pandis Appendix A)"
},
"H": {
"type": "unknown",
"units": "m",
"description": "Atmospheric scale height H = R*T/(M_air*g) — the altitude over which pressure falls by a factor e (Eq. 1.4)"
},
"p": {
"type": "unknown",
"units": "Pa",
"description": "Atmospheric pressure at altitude z (barometric formula, Eq. 1.5)"
},
"rho": {
"type": "unknown",
"units": "kg/m^3",
"description": "Air density at altitude z (ideal gas law, Eq. 1.2)"
},
"dpdz": {
"type": "unknown",
"units": "Pa/m",
"description": "Vertical pressure gradient dp/dz = -rho*g (hydrostatic equation, Eqs. 1.1/1.3)"
}
},
"equations": [
{
"_comment": "Eq. 1.4 - Atmospheric scale height: H = R*T/(M_air*g)",
"lhs": "H",
"rhs": {
"op": "/",
"args": [
{
"op": "*",
"args": [
"R",
"T"
]
},
{
"op": "*",
"args": [
"M_air",
"g"
]
}
]
}
},
{
"_comment": "Eq. 1.5 - Barometric formula (isothermal atmosphere): p = p_0*exp(-z/H)",
"lhs": "p",
"rhs": {
"op": "*",
"args": [
"p_0",
{
"op": "exp",
"args": [
{
"op": "-",
"args": [
{
"op": "/",
"args": [
"z",
"H"
]
}
]
}
]
}
]
}
},
{
"_comment": "Eq. 1.2 - Ideal gas law for air density: rho = M_air*p/(R*T)",
"lhs": "rho",
"rhs": {
"op": "/",
"args": [
{
"op": "*",
"args": [
"M_air",
"p"
]
},
{
"op": "*",
"args": [
"R",
"T"
]
}
]
}
},
{
"_comment": "Eqs. 1.1/1.3 - Hydrostatic equation: dpdz = -rho*g",
"lhs": "dpdz",
"rhs": {
"op": "-",
"args": [
{
"op": "*",
"args": [
"rho",
"g"
]
}
]
}
}
],
"tests": [
{
"id": "sea_level_standard",
"description": "Standard sea-level reference (z = 0, T = 288 K). The barometric formula reduces to p = p_0 at the datum; the ideal gas law then gives the standard sea-level air density (~1.226 kg/m^3) and the hydrostatic gradient dpdz = -rho*g (~-12.0 Pa/m). This is the boundary condition the whole profile is anchored to. The system is algebraic, so p is also asserted at t = 1.0 to confirm time-invariance.",
"parameter_overrides": {
"z": 0.0,
"T": 288.0
},
"time_span": {
"start": 0.0,
"end": 1.0
},
"assertions": [
{
"variable": "H",
"time": 0.0,
"expected": 8427.870183108378
},
{
"variable": "p",
"time": 0.0,
"expected": 101325.0
},
{
"variable": "rho",
"time": 0.0,
"expected": 1.2259213249739396
},
{
"variable": "dpdz",
"time": 0.0,
"expected": -12.022610434019425
},
{
"variable": "p",
"time": 1.0,
"expected": 101325.0
}
]
},
{
"id": "one_scale_height",
"description": "At an altitude equal to the scale height (z = H(288 K) = 8427.87 m) the pressure falls by exactly a factor e: p = p_0/e ~ 37275 Pa. This is the defining property of the scale height (Seinfeld & Pandis Eq. 1.5); the expected p matches barometric.esm's one_scale_height case. Density and the pressure gradient fall by the same factor e.",
"parameter_overrides": {
"z": 8427.870183108378,
"T": 288.0
},
"time_span": {
"start": 0.0,
"end": 1.0
},
"assertions": [
{
"variable": "H",
"time": 0.0,
"expected": 8427.870183108378
},
{
"variable": "p",
"time": 0.0,
"expected": 37275.38437669639
},
{
"variable": "rho",
"time": 0.0,
"expected": 0.450991251951567
},
{
"variable": "dpdz",
"time": 0.0,
"expected": -4.422871207889018
}
]
},
{
"id": "troposphere_10km",
"description": "Upper-troposphere case at 10 km altitude (T = 288 K). With the isothermal scale height H ~ 8428 m the estimate is p ~ 309 mbar; the real atmosphere is ~265 mbar near this altitude (Seinfeld & Pandis Table 1.4), the expected overshoot of the constant-H idealization. Exercises pressure and density well above the surface.",
"parameter_overrides": {
"z": 10000.0,
"T": 288.0
},
"time_span": {
"start": 0.0,
"end": 1.0
},
"assertions": [
{
"variable": "p",
"time": 0.0,
"expected": 30932.07823850794
},
{
"variable": "rho",
"time": 0.0,
"expected": 0.3742442076323634
}
]
},
{
"id": "stratosphere_20km",
"description": "Deep-decay case at 20 km altitude (z ~ 2.37 H, T = 288 K): pressure has fallen to ~9.4 kPa and the hydrostatic gradient to ~-1.1 Pa/m. Exercises the small-pressure tail of the exponential.",
"parameter_overrides": {
"z": 20000.0,
"T": 288.0
},
"time_span": {
"start": 0.0,
"end": 1.0
},
"assertions": [
{
"variable": "p",
"time": 0.0,
"expected": 9442.817312145833
},
{
"variable": "dpdz",
"time": 0.0,
"expected": -1.1204274753865657
}
]
},
{
"id": "cold_atmosphere_5km",
"description": "Cold mid-troposphere column (T = 253 K) at z = 5 km. The lower temperature shrinks the scale height to H ~ 7404 m (cross-checked against scale_height.esm cold_253K), so pressure decays faster with altitude than the 288 K case.",
"parameter_overrides": {
"z": 5000.0,
"T": 253.0
},
"time_span": {
"start": 0.0,
"end": 1.0
},
"assertions": [
{
"variable": "H",
"time": 0.0,
"expected": 7403.649848355624
},
{
"variable": "p",
"time": 0.0,
"expected": 51572.60347926007
}
]
},
{
"id": "warm_atmosphere_5km",
"description": "Warm column (T = 318 K, ~45 C) at z = 5 km. The higher temperature stretches the scale height to H ~ 9306 m (cross-checked against scale_height.esm warm_318K), so pressure decays more slowly with altitude than the 288 K case. With cold_atmosphere_5km this brackets the temperature dependence at fixed altitude.",
"parameter_overrides": {
"z": 5000.0,
"T": 318.0
},
"time_span": {
"start": 0.0,
"end": 1.0
},
"assertions": [
{
"variable": "H",
"time": 0.0,
"expected": 9305.773327182167
},
{
"variable": "p",
"time": 0.0,
"expected": 59206.55805835972
}
]
},
{
"id": "nonstandard_p0",
"description": "Non-default sea-level pressure (p_0 = 100000 Pa) at z = 5 km, T = 288 K. Verifies p scales linearly with p_0 while the exponential decay factor stays fixed; density rho = M_air*p/(R*T) follows p proportionally.",
"parameter_overrides": {
"z": 5000.0,
"T": 288.0,
"p_0": 100000.0
},
"time_span": {
"start": 0.0,
"end": 1.0
},
"assertions": [
{
"variable": "p",
"time": 0.0,
"expected": 55251.776171869395
},
{
"variable": "rho",
"time": 0.0,
"expected": 0.6684858687567893
}
]
}
],
"analyses": [
{
"id": "profile_vs_altitude",
"description": "Pressure and density as a function of altitude for an isothermal atmosphere at the sea-level standard temperature (T = 288 K, H ~ 8428 m). Reproduces the canonical exponential decay of Seinfeld & Pandis Eqs. 1.5 and 1.2 from the surface to 30 km.",
"initial_state": {},
"parameters": {
"T": 288.0
},
"time_span": {
"start": 0.0,
"end": 1.0
},
"parameter_sweep": {
"type": "cartesian",
"dimensions": [
{
"parameter": "z",
"range": {
"start": 0.0,
"stop": 30000.0,
"count": 31,
"scale": "linear"
}
}
]
},
"plots": [
{
"id": "p_vs_z",
"type": "line",
"description": "Atmospheric pressure p as a function of altitude z at T = 288 K (Eq. 1.5).",
"x": {
"variable": "z",
"label": "Altitude (m)"
},
"y": {
"variable": "p",
"label": "Pressure (Pa)"
}
},
{
"id": "rho_vs_z",
"type": "line",
"description": "Air density rho as a function of altitude z at T = 288 K (Eq. 1.2).",
"x": {
"variable": "z",
"label": "Altitude (m)"
},
"y": {
"variable": "rho",
"label": "Air density (kg/m^3)"
}
}
]
},
{
"id": "pressure_over_altitude_and_temperature",
"description": "Two-dimensional sweep over altitude z (surface to 20 km) and the isothermal column temperature T (250-310 K). Surfaces the joint dependence of pressure on altitude and on temperature: warmer columns have a larger scale height and so decay more slowly with altitude.",
"initial_state": {},
"parameters": {},
"time_span": {
"start": 0.0,
"end": 1.0
},
"parameter_sweep": {
"type": "cartesian",
"dimensions": [
{
"parameter": "z",
"range": {
"start": 0.0,
"stop": 20000.0,
"count": 21,
"scale": "linear"
}
},
{
"parameter": "T",
"range": {
"start": 250.0,
"stop": 310.0,
"count": 13,
"scale": "linear"
}
}
]
},
"plots": [
{
"id": "p_heatmap",
"type": "heatmap",
"description": "Atmospheric pressure p as a function of altitude z and isothermal column temperature T.",
"x": {
"variable": "z",
"label": "Altitude (m)"
},
"y": {
"variable": "T",
"label": "Temperature (K)"
},
"value": {
"variable": "p",
"reduce": "final"
}
}
]
}
]
}