Version: dev

IsentropicBaseState

Isentropic base-state atmosphere for the Clark (1977) terrain-following mountain-wave model, "A Small-Scale Dynamic Model Using a Terrain-Following Coordinate Transformation", Eqs. 2.6-2.9. The base state assumes a constant potential temperature Θ — the deep, isentropic reference atmosphere of Ogura and Phillips (1962) adopted in Clark (1977) Eq. 2.6 — and derives the height-dependent thermodynamic profiles that satisfy hydrostatic balance: from the reference potential temperature Θ, the surface pressure P_0, and the height above the surface z, the component computes the isentropic scale height H_s = c_p*Θ/g, the base-state temperature T_bar = Θ*(1 - z/H_s) (Eq. 2.7), the base-state pressure p_bar = P_0*(1 - z/H_s)^(c_p/R_d) (Eq. 2.8), and the base-state density ρ_bar = P_0/(R_d*Θ)*(1 - z/H_s)^(c_p/R_d - 1) (Eq. 2.9). Temperature falls linearly with height while pressure and density fall as powers of the same (1 - z/H_s) factor, all three vanishing at the top of the isentropic atmosphere z = H_s. Four purely-algebraic equations, no time integration. Migrated from AtmosphericDynamics.jl@816cc391 src/clark1977.jl:49 (`IsentropicBaseState` @component); the five upstream @constants — g, R_d, c_p and the derived exponents inv_kappa = c_p/R_d and inv_kappa_m1 = c_p/R_d - 1 — are declared as fixed-default parameters.

.esm schema
1.0.0
Source
components/atmospheric_dynamics/clark1977/isentropic_base_state.esm

Description

Isentropic base-state atmosphere for the Clark (1977) terrain-following mountain-wave model, “A Small-Scale Dynamic Model Using a Terrain-Following Coordinate Transformation”, Eqs. 2.6-2.9. The base state assumes a constant potential temperature Θ — the deep, isentropic reference atmosphere of Ogura and Phillips (1962) adopted in Clark (1977) Eq. 2.6 — and derives the height-dependent thermodynamic profiles that satisfy hydrostatic balance: from the reference potential temperature Θ, the surface pressure P_0, and the height above the surface z, the component computes the isentropic scale height H_s = c_pΘ/g, the base-state temperature T_bar = Θ(1 - z/H_s) (Eq. 2.7), the base-state pressure p_bar = P_0*(1 - z/H_s)^(c_p/R_d) (Eq. 2.8), and the base-state density ρ_bar = P_0/(R_dΘ)(1 - z/H_s)^(c_p/R_d - 1) (Eq. 2.9). Temperature falls linearly with height while pressure and density fall as powers of the same (1 - z/H_s) factor, all three vanishing at the top of the isentropic atmosphere z = H_s. Four purely-algebraic equations, no time integration. Migrated from AtmosphericDynamics.jl@816cc391 src/clark1977.jl:49 (IsentropicBaseState @component); the five upstream @constants — g, R_d, c_p and the derived exponents inv_kappa = c_p/R_d and inv_kappa_m1 = c_p/R_d - 1 — are declared as fixed-default parameters.

Reference

Clark, T. L. (1977), J. Comput. Phys. 24(2), 186-215, Eqs. 2.6-2.9.

_source_ref: AtmosphericDynamics.jl@816cc3918e1eef2c2ee6d8fa8dd73c8f13a85a47:src/clark1977.jl:49

Upstream IsentropicBaseState is a ModelingToolkit @component returning System(eqs, t; name) that implements the isentropic base-state atmosphere of Clark (1977), Sec. 2 — the constant-potential-temperature reference state (Eqs. 2.6-2.9) underlying the paper’s mountain-wave model. It is one of the building-block components of the full Clark1977AnelasticSystem. All four equations are algebraic — there is no ODE integration and no D(.) operator.

System classification. The upstream test IsentropicBaseState Structure (test/clark1977_test.jl:22-27) asserts length(unknowns(bs)) == 4 and length(equations(bs)) == 4. The .esm preserves this exactly: four type: state variables (T_bar, p_bar, ρ_bar, H_s) and four entries in equations. Each equation is an explicit algebraic assignment — H_s depends only on parameters; T_bar, p_bar and ρ_bar each depend on parameters and the previously-defined H_s — so the four equations form an explicit cascade with no implicit/coupled solve. After mtkcompile they resolve to observed quantities and the compiled system has zero differential states, exactly as for the sibling explicit-algebraic components diagnostic_pressure.esm and anelastic_thermo.esm. The migration therefore leaves system_kind unset (default ‘ode’); this is deliberately NOT the system_kind: nonlinear class, which is reserved for components needing an implicit Newton solve with initial guesses.

Constants → parameters. The upstream component declares two symbol blocks: an @constants block (g, R_d, c_p, inv_kappa, inv_kappa_m1) and an @parameters block (Θ, P_0, z). The .esm schema has no dedicated constant variable type, so all eight symbols are encoded type: parameter with their upstream defaults — the same treatment the sibling diagnostic_pressure.esm applies to its @constant g. inv_kappa and inv_kappa_m1 are derived constants: upstream they are defined symbolically as inv_kappa = c_p / R_d and inv_kappa_m1 = c_p / R_d - 1.0. Their default fields here carry the evaluated IEEE-754 double values 3.4982578397212545 (= 1004.0/287.0) and 2.4982578397212545 (= 1004.0/287.0 - 1.0); the .esm default field is numeric, so the upstream defining expressions are evaluated at migration time. All eight parameters appear in the equations — Θ in three, P_0 in two, z in three, g and c_p in the H_s equation, R_d in the ρ_bar equation, inv_kappa in the p_bar equation, inv_kappa_m1 in the ρ_bar equation — so none is pruned (cf. the unused-parameter pruning applied in general_circulation.esm).

Variable classification. T_bar, p_bar, ρ_bar, H_s are encoded type: state with no default — each is the LHS of exactly one purely-algebraic equation, an observed quantity with no time derivative and hence no initial condition, the convention used for the algebraic outputs of sibling diagnostic_pressure.esm and anelastic_thermo.esm. The Greek-named symbols Θ and ρ_bar are carried with their exact Unicode names, as the sibling anelastic_thermo.esm does for ρ_bar / dθ_dx.

Equation faithfulness. The four upstream equations (src/clark1977.jl:77-80) are preserved verbatim: H_s ~ c_pΘ/g (the isentropic scale height); T_bar ~ Θ(1 - z/H_s) (Eq. 2.7); p_bar ~ P_0*(1 - z/H_s)^inv_kappa (Eq. 2.8); ρ_bar ~ P_0/(R_dΘ)(1 - z/H_s)^inv_kappa_m1 (Eq. 2.9). Julia operator precedence is preserved in the op trees: ^ binds tighter than * and /, and *// are left-associative — so c_p*Θ/g is (c_p*Θ)/g and P_0/(R_d*Θ)*(...)^inv_kappa_m1 is (P_0/(R_d*Θ))*((...)^inv_kappa_m1). The shared sub-expression (1 - z/H_s) is written out in each of the three height-dependent equations rather than introduced as a separate observed variable, mirroring the upstream source.

Units and dimensional consistency. The upstream declares g in u"m/s^2"; R_d and c_p in u"J/(kgK)"; Θ and T_bar in u"K"; P_0 and p_bar in u"Pa"; z and H_s in u"m"; ρ_bar in u"kg/m^3"; inv_kappa and inv_kappa_m1 are dimensionless (recorded as units “1”). All are carried verbatim. Unlike the sibling DiagnosticPressure component, the upstream uses a plain System(eqs, t; name) with no checks = false: the four equations are dimensionally consistent — H_s ~ c_pΘ/g is (J/(kgK))K/(m/s^2) = (m^2/s^2)/(m/s^2) = m; the z/H_s ratio is dimensionless, so T_bar ~ Θ(1-z/H_s) is K and p_bar ~ P_0(…)^inv_kappa is Pa; ρ_bar ~ P_0/(R_dΘ)(…)^inv_kappa_m1 is Pa/(J/kg) = (kg/(m*s^2))/(m^2/s^2) = kg/m^3.

Tolerance rationale (model-level rel=1e-6, abs=1e-9). The system is a closed-form algebraic evaluation — no ODE integration, no implicit solve — so there is no integrator error to bound. rel=1e-6 covers float64 round-off in the multiply/divide chains and, in particular, the pow evaluations of the (1 - z/H_s)^inv_kappa and ^inv_kappa_m1 terms, where the migration’s op-tree order and the canonical runner’s evaluation may differ by a few ULP; it matches the sibling explicit-algebraic components. abs=1e-9 is a floor for the assertions; every output in the test suite is an O(1)-or-larger physical quantity (densities ~0.43-1.39 kg/m^3, temperatures ~202-320 K, pressures ~2.5e4-1e5 Pa, scale heights ~2.6e4-3.3e4 m), so the relative tolerance governs every comparison.

Test reproduction. The upstream package provides four testsets touching this component (test/clark1977_test.jl): Structure (a System with 4 unknowns and 4 equations); Surface Values (T_bar=300, p_bar=1e5, ρ_bar=1e5/(287300), H_s=1004300/9.81 at the defaults); Profile (the z=5000 m profile, with T_bar<300 and p_bar<1e5); Hydrostatic Balance (the finite-difference dp/dz between z=0 and z=100 m equals -ρ̄g to rtol 1e-3); and Isentropic Scale Height Validation (H_s ≈ 30683 m to 1%). The eight inline tests here reproduce all of these — surface_values exercises all four outputs at the defaults (covering Structure, Surface Values and the scale-height validation); hydrostatic_balance_100m pins the z=100 m profile (the upstream finite-difference check dp/dz ≈ -ρ̄g is satisfied by the surface_values and hydrostatic_balance_100m pressures and densities to a relative error of 3.3e-6); profile_at_5km reproduces the Profile testset — and add coverage the upstream suite lacks: upper_troposphere_10km (a higher-altitude profile, all three profiles monotonically decreasing); warm_potential_temperature and cold_potential_temperature (the scale height H_s = c_p*Θ/g and the surface temperature T_bar(0) = Θ both scale with the reference potential temperature); elevated_surface_pressure (p_bar and ρ_bar scale linearly with P_0 while H_s is independent of it); and combined_profile (all three free parameters off their defaults, sampled at t=0 and t=1 to confirm the algebraic system is time-invariant). Every expected value is the IEEE-754 double produced by evaluating the four equations in float64 at the test’s parameter set — equivalently the value the canonical ESS runner computes._

Parameters

NameUnitsDefaultDescription
gm/s^29.81Gravitational acceleration. Upstream @constant carried as a fixed-default parameter.
R_dJ/(kg*K)287.0Dry-air gas constant. Upstream @constant carried as a fixed-default parameter.
c_pJ/(kg*K)1004.0Specific heat of dry air at constant pressure. Upstream @constant carried as a fixed-default parameter.
inv_kappa13.4982578397212545Pressure-profile exponent c_p/R_d = 1/κ (dimensionless). Derived upstream @constant inv_kappa = c_p/R_d; the default is the evaluated value 1004.0/287.0.
inv_kappa_m112.4982578397212545Density-profile exponent c_p/R_d - 1 (dimensionless). Derived upstream @constant inv_kappa_m1 = c_p/R_d - 1.0; the default is the evaluated value 1004.0/287.0 - 1.0.
ΘK300.0Reference potential temperature of the isentropic base state (constant with height, Clark 1977 Eq. 2.6).
P_0Pa100000.0Surface (z = 0) pressure of the base-state atmosphere.
zm0.0Height above the surface at which the base-state profiles are evaluated.

Observed

NameUnitsDefaultDescription
T_barKBase-state temperature T_bar = Θ*(1 - z/H_s) (Clark 1977 Eq. 2.7). An observed (algebraic) output — the LHS of one purely-algebraic equation, with no time derivative and hence no initial condition. Falls linearly with height.
p_barPaBase-state pressure p_bar = P_0*(1 - z/H_s)^(c_p/R_d) (Clark 1977 Eq. 2.8). An observed (algebraic) output; no time derivative, no initial condition. Falls as a power of (1 - z/H_s) with height.
ρ_barkg/m^3Base-state (anelastic reference) air density ρ_bar = P_0/(R_dΘ)(1 - z/H_s)^(c_p/R_d - 1) (Clark 1977 Eq. 2.9). An observed (algebraic) output; no time derivative, no initial condition.
H_smIsentropic scale height H_s = c_p*Θ/g — the depth of the isentropic atmosphere, at which the base-state temperature, pressure and density reach zero. An observed (algebraic) output; depends only on the reference potential temperature Θ.

Observed expressions

$$ T_{bar} = Θ \cdot \left(1 - \frac{z}{H_{s}}\right) $$

Base-state temperature T_bar = Θ*(1 - z/H_s) (Clark 1977 Eq. 2.7). An observed (algebraic) output — the LHS of one purely-algebraic equation, with no time derivative and hence no initial condition. Falls linearly with height.

$$ p_{bar} = P_{0} \cdot \left(1 - \frac{z}{H_{s}}\right)^{inv_{kappa}} $$

Base-state pressure p_bar = P_0*(1 - z/H_s)^(c_p/R_d) (Clark 1977 Eq. 2.8). An observed (algebraic) output; no time derivative, no initial condition. Falls as a power of (1 - z/H_s) with height.

$$ ρ_{bar} = \frac{P_{0}}{R_{d} \cdot Θ} \cdot \left(1 - \frac{z}{H_{s}}\right)^{inv_{kappa\,m1}} $$

Base-state (anelastic reference) air density ρ_bar = P_0/(R_dΘ)(1 - z/H_s)^(c_p/R_d - 1) (Clark 1977 Eq. 2.9). An observed (algebraic) output; no time derivative, no initial condition.

$$ H_{s} = \frac{c_{p} \cdot Θ}{g} $$

Isentropic scale height H_s = c_p*Θ/g — the depth of the isentropic atmosphere, at which the base-state temperature, pressure and density reach zero. An observed (algebraic) output; depends only on the reference potential temperature Θ.

Analyses

base_state_vertical_profile

The three base-state thermodynamic profiles — temperature T_bar (Eq. 2.7), pressure p_bar (Eq. 2.8) and density ρ_bar (Eq. 2.9) — as functions of height z from the surface to 15 km, at the default isentropic base state (Θ = 300 K, P_0 = 1e5 Pa). Temperature falls linearly with height; pressure and density fall as powers of the same (1 - z/H_s) factor. This is the canonical vertical structure of the Clark (1977) isentropic reference atmosphere.

Time span: 0.0 → 1.0

Swept over: z

Base-state temperature T_bar vs height (Clark 1977 Eq. 2.7).

Base-state pressure p_bar vs height (Clark 1977 Eq. 2.8).

Base-state density ρ_bar vs height (Clark 1977 Eq. 2.9).

scale_height_vs_potential_temperature

Isentropic scale height H_s = c_p*Θ/g as a function of the reference potential temperature Θ swept from 250 to 400 K. H_s is linear in Θ and independent of the surface pressure and height — a warmer isentropic atmosphere is deeper.

Time span: 0.0 → 1.0

Swept over: Θ

Isentropic scale height H_s as a function of reference potential temperature Θ.

surface_density_vs_potential_temperature

Surface (z = 0) base-state density ρ_bar as a function of the reference potential temperature Θ swept from 250 to 400 K, at the default surface pressure P_0 = 1e5 Pa. At the surface (1 - z/H_s) = 1, so Eq. 2.9 reduces to the ideal-gas relation ρ_bar = P_0/(R_d*Θ): density is inversely proportional to the potential temperature.

Time span: 0.0 → 1.0

Swept over: Θ

Surface base-state density ρ_bar as a function of reference potential temperature Θ (the ideal-gas limit of Eq. 2.9 at z = 0).

Raw .esm

Raw .esm JSON (this component)
{
  "reference": {
    "citation": "Clark, T. L. (1977), J. Comput. Phys. 24(2), 186-215, Eqs. 2.6-2.9.",
    "notes": "source_ref: AtmosphericDynamics.jl@816cc3918e1eef2c2ee6d8fa8dd73c8f13a85a47:src/clark1977.jl:49\n\nUpstream `IsentropicBaseState` is a ModelingToolkit `@component` returning `System(eqs, t; name)` that implements the isentropic base-state atmosphere of Clark (1977), Sec. 2 — the constant-potential-temperature reference state (Eqs. 2.6-2.9) underlying the paper's mountain-wave model. It is one of the building-block components of the full `Clark1977AnelasticSystem`. All four equations are algebraic — there is no ODE integration and no `D(.)` operator.\n\nSystem classification. The upstream test `IsentropicBaseState Structure` (test/clark1977_test.jl:22-27) asserts `length(unknowns(bs)) == 4` and `length(equations(bs)) == 4`. The .esm preserves this exactly: four `type: state` variables (T_bar, p_bar, ρ_bar, H_s) and four entries in `equations`. Each equation is an explicit algebraic assignment — H_s depends only on parameters; T_bar, p_bar and ρ_bar each depend on parameters and the previously-defined H_s — so the four equations form an explicit cascade with no implicit/coupled solve. After `mtkcompile` they resolve to observed quantities and the compiled system has zero differential states, exactly as for the sibling explicit-algebraic components diagnostic_pressure.esm and anelastic_thermo.esm. The migration therefore leaves `system_kind` unset (default 'ode'); this is deliberately NOT the `system_kind: nonlinear` class, which is reserved for components needing an implicit Newton solve with initial guesses.\n\nConstants → parameters. The upstream component declares two symbol blocks: an `@constants` block (g, R_d, c_p, inv_kappa, inv_kappa_m1) and an `@parameters` block (Θ, P_0, z). The .esm schema has no dedicated constant variable type, so all eight symbols are encoded `type: parameter` with their upstream defaults — the same treatment the sibling diagnostic_pressure.esm applies to its `@constant g`. inv_kappa and inv_kappa_m1 are derived constants: upstream they are defined symbolically as `inv_kappa = c_p / R_d` and `inv_kappa_m1 = c_p / R_d - 1.0`. Their `default` fields here carry the evaluated IEEE-754 double values 3.4982578397212545 (= 1004.0/287.0) and 2.4982578397212545 (= 1004.0/287.0 - 1.0); the .esm `default` field is numeric, so the upstream defining expressions are evaluated at migration time. All eight parameters appear in the equations — Θ in three, P_0 in two, z in three, g and c_p in the H_s equation, R_d in the ρ_bar equation, inv_kappa in the p_bar equation, inv_kappa_m1 in the ρ_bar equation — so none is pruned (cf. the unused-parameter pruning applied in general_circulation.esm).\n\nVariable classification. T_bar, p_bar, ρ_bar, H_s are encoded `type: state` with no `default` — each is the LHS of exactly one purely-algebraic equation, an observed quantity with no time derivative and hence no initial condition, the convention used for the algebraic outputs of sibling diagnostic_pressure.esm and anelastic_thermo.esm. The Greek-named symbols Θ and ρ_bar are carried with their exact Unicode names, as the sibling anelastic_thermo.esm does for ρ_bar / dθ_dx.\n\nEquation faithfulness. The four upstream equations (src/clark1977.jl:77-80) are preserved verbatim: H_s ~ c_p*Θ/g (the isentropic scale height); T_bar ~ Θ*(1 - z/H_s) (Eq. 2.7); p_bar ~ P_0*(1 - z/H_s)^inv_kappa (Eq. 2.8); ρ_bar ~ P_0/(R_d*Θ)*(1 - z/H_s)^inv_kappa_m1 (Eq. 2.9). Julia operator precedence is preserved in the op trees: `^` binds tighter than `*` and `/`, and `*`/`/` are left-associative — so `c_p*Θ/g` is `(c_p*Θ)/g` and `P_0/(R_d*Θ)*(...)^inv_kappa_m1` is `(P_0/(R_d*Θ))*((...)^inv_kappa_m1)`. The shared sub-expression (1 - z/H_s) is written out in each of the three height-dependent equations rather than introduced as a separate observed variable, mirroring the upstream source.\n\nUnits and dimensional consistency. The upstream declares g in u\"m/s^2\"; R_d and c_p in u\"J/(kg*K)\"; Θ and T_bar in u\"K\"; P_0 and p_bar in u\"Pa\"; z and H_s in u\"m\"; ρ_bar in u\"kg/m^3\"; inv_kappa and inv_kappa_m1 are dimensionless (recorded as units \"1\"). All are carried verbatim. Unlike the sibling DiagnosticPressure component, the upstream uses a plain `System(eqs, t; name)` with no `checks = false`: the four equations are dimensionally consistent — H_s ~ c_p*Θ/g is (J/(kg*K))*K/(m/s^2) = (m^2/s^2)/(m/s^2) = m; the z/H_s ratio is dimensionless, so T_bar ~ Θ*(1-z/H_s) is K and p_bar ~ P_0*(...)^inv_kappa is Pa; ρ_bar ~ P_0/(R_d*Θ)*(...)^inv_kappa_m1 is Pa/(J/kg) = (kg/(m*s^2))/(m^2/s^2) = kg/m^3.\n\nTolerance rationale (model-level rel=1e-6, abs=1e-9). The system is a closed-form algebraic evaluation — no ODE integration, no implicit solve — so there is no integrator error to bound. rel=1e-6 covers float64 round-off in the multiply/divide chains and, in particular, the `pow` evaluations of the (1 - z/H_s)^inv_kappa and ^inv_kappa_m1 terms, where the migration's op-tree order and the canonical runner's evaluation may differ by a few ULP; it matches the sibling explicit-algebraic components. abs=1e-9 is a floor for the assertions; every output in the test suite is an O(1)-or-larger physical quantity (densities ~0.43-1.39 kg/m^3, temperatures ~202-320 K, pressures ~2.5e4-1e5 Pa, scale heights ~2.6e4-3.3e4 m), so the relative tolerance governs every comparison.\n\nTest reproduction. The upstream package provides four testsets touching this component (test/clark1977_test.jl): `Structure` (a System with 4 unknowns and 4 equations); `Surface Values` (T_bar=300, p_bar=1e5, ρ_bar=1e5/(287*300), H_s=1004*300/9.81 at the defaults); `Profile` (the z=5000 m profile, with T_bar<300 and p_bar<1e5); `Hydrostatic Balance` (the finite-difference dp/dz between z=0 and z=100 m equals -ρ̄g to rtol 1e-3); and `Isentropic Scale Height Validation` (H_s ≈ 30683 m to 1%). The eight inline tests here reproduce all of these — surface_values exercises all four outputs at the defaults (covering Structure, Surface Values and the scale-height validation); hydrostatic_balance_100m pins the z=100 m profile (the upstream finite-difference check dp/dz ≈ -ρ̄g is satisfied by the surface_values and hydrostatic_balance_100m pressures and densities to a relative error of 3.3e-6); profile_at_5km reproduces the Profile testset — and add coverage the upstream suite lacks: upper_troposphere_10km (a higher-altitude profile, all three profiles monotonically decreasing); warm_potential_temperature and cold_potential_temperature (the scale height H_s = c_p*Θ/g and the surface temperature T_bar(0) = Θ both scale with the reference potential temperature); elevated_surface_pressure (p_bar and ρ_bar scale linearly with P_0 while H_s is independent of it); and combined_profile (all three free parameters off their defaults, sampled at t=0 and t=1 to confirm the algebraic system is time-invariant). Every `expected` value is the IEEE-754 double produced by evaluating the four equations in float64 at the test's parameter set — equivalently the value the canonical ESS runner computes."
  },
  "tolerance": {
    "rel": 1e-06,
    "abs": 1e-09
  },
  "variables": {
    "g": {
      "type": "parameter",
      "units": "m/s^2",
      "default": 9.81,
      "description": "Gravitational acceleration. Upstream @constant carried as a fixed-default parameter."
    },
    "R_d": {
      "type": "parameter",
      "units": "J/(kg*K)",
      "default": 287.0,
      "description": "Dry-air gas constant. Upstream @constant carried as a fixed-default parameter."
    },
    "c_p": {
      "type": "parameter",
      "units": "J/(kg*K)",
      "default": 1004.0,
      "description": "Specific heat of dry air at constant pressure. Upstream @constant carried as a fixed-default parameter."
    },
    "inv_kappa": {
      "type": "parameter",
      "units": "1",
      "default": 3.4982578397212545,
      "description": "Pressure-profile exponent c_p/R_d = 1/κ (dimensionless). Derived upstream @constant inv_kappa = c_p/R_d; the default is the evaluated value 1004.0/287.0."
    },
    "inv_kappa_m1": {
      "type": "parameter",
      "units": "1",
      "default": 2.4982578397212545,
      "description": "Density-profile exponent c_p/R_d - 1 (dimensionless). Derived upstream @constant inv_kappa_m1 = c_p/R_d - 1.0; the default is the evaluated value 1004.0/287.0 - 1.0."
    },
    "Θ": {
      "type": "parameter",
      "units": "K",
      "default": 300.0,
      "description": "Reference potential temperature of the isentropic base state (constant with height, Clark 1977 Eq. 2.6)."
    },
    "P_0": {
      "type": "parameter",
      "units": "Pa",
      "default": 100000.0,
      "description": "Surface (z = 0) pressure of the base-state atmosphere."
    },
    "z": {
      "type": "parameter",
      "units": "m",
      "default": 0.0,
      "description": "Height above the surface at which the base-state profiles are evaluated."
    },
    "T_bar": {
      "type": "unknown",
      "units": "K",
      "description": "Base-state temperature T_bar = Θ*(1 - z/H_s) (Clark 1977 Eq. 2.7). An observed (algebraic) output — the LHS of one purely-algebraic equation, with no time derivative and hence no initial condition. Falls linearly with height."
    },
    "p_bar": {
      "type": "unknown",
      "units": "Pa",
      "description": "Base-state pressure p_bar = P_0*(1 - z/H_s)^(c_p/R_d) (Clark 1977 Eq. 2.8). An observed (algebraic) output; no time derivative, no initial condition. Falls as a power of (1 - z/H_s) with height."
    },
    "ρ_bar": {
      "type": "unknown",
      "units": "kg/m^3",
      "description": "Base-state (anelastic reference) air density ρ_bar = P_0/(R_d*Θ)*(1 - z/H_s)^(c_p/R_d - 1) (Clark 1977 Eq. 2.9). An observed (algebraic) output; no time derivative, no initial condition."
    },
    "H_s": {
      "type": "unknown",
      "units": "m",
      "description": "Isentropic scale height H_s = c_p*Θ/g — the depth of the isentropic atmosphere, at which the base-state temperature, pressure and density reach zero. An observed (algebraic) output; depends only on the reference potential temperature Θ."
    }
  },
  "equations": [
    {
      "_comment": "Isentropic scale height H_s = c_p*Θ/g (Clark 1977 Sec. 2) — the e-folding-like depth that sets the vertical structure of the base-state profiles.",
      "lhs": "H_s",
      "rhs": {
        "op": "/",
        "args": [
          {
            "op": "*",
            "args": [
              "c_p",
              "Θ"
            ]
          },
          "g"
        ]
      }
    },
    {
      "_comment": "Clark 1977 Eq. 2.7 — base-state temperature T_bar = Θ*(1 - z/H_s); linear decrease with height.",
      "lhs": "T_bar",
      "rhs": {
        "op": "*",
        "args": [
          "Θ",
          {
            "op": "-",
            "args": [
              1,
              {
                "op": "/",
                "args": [
                  "z",
                  "H_s"
                ]
              }
            ]
          }
        ]
      }
    },
    {
      "_comment": "Clark 1977 Eq. 2.8 — base-state pressure p_bar = P_0*(1 - z/H_s)^inv_kappa, with inv_kappa = c_p/R_d.",
      "lhs": "p_bar",
      "rhs": {
        "op": "*",
        "args": [
          "P_0",
          {
            "op": "^",
            "args": [
              {
                "op": "-",
                "args": [
                  1,
                  {
                    "op": "/",
                    "args": [
                      "z",
                      "H_s"
                    ]
                  }
                ]
              },
              "inv_kappa"
            ]
          }
        ]
      }
    },
    {
      "_comment": "Clark 1977 Eq. 2.9 — base-state density ρ_bar = P_0/(R_d*Θ)*(1 - z/H_s)^inv_kappa_m1, with inv_kappa_m1 = c_p/R_d - 1.",
      "lhs": "ρ_bar",
      "rhs": {
        "op": "*",
        "args": [
          {
            "op": "/",
            "args": [
              "P_0",
              {
                "op": "*",
                "args": [
                  "R_d",
                  "Θ"
                ]
              }
            ]
          },
          {
            "op": "^",
            "args": [
              {
                "op": "-",
                "args": [
                  1,
                  {
                    "op": "/",
                    "args": [
                      "z",
                      "H_s"
                    ]
                  }
                ]
              },
              "inv_kappa_m1"
            ]
          }
        ]
      }
    }
  ],
  "tests": [
    {
      "id": "surface_values",
      "description": "All parameters at their declared defaults (Θ = 300 K, P_0 = 1e5 Pa, z = 0). At the surface (1 - z/H_s) = 1, so T_bar = Θ = 300 K and p_bar = P_0 = 1e5 Pa exactly; ρ_bar = P_0/(R_d*Θ) = 1e5/(287*300) = 1.1614401858304297 kg/m^3 (the surface ideal-gas density); H_s = c_p*Θ/g = 1004*300/9.81 = 30703.363914373087 m. Exercises all four outputs at once — reproduces the upstream `Structure` (4 unknowns, 4 equations), `Surface Values`, and `Isentropic Scale Height Validation` (H_s ≈ 30683 m to 1%) testsets.",
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "T_bar",
          "time": 0.0,
          "expected": 300.0
        },
        {
          "variable": "p_bar",
          "time": 0.0,
          "expected": 100000.0
        },
        {
          "variable": "ρ_bar",
          "time": 0.0,
          "expected": 1.1614401858304297
        },
        {
          "variable": "H_s",
          "time": 0.0,
          "expected": 30703.363914373087
        }
      ]
    },
    {
      "id": "hydrostatic_balance_100m",
      "description": "Base-state profile 100 m above the surface (z = 100, all other parameters default). T_bar = 300*(1 - 100/H_s) = 299.0229083665339 K, p_bar = 1e5*(1 - 100/H_s)^inv_kappa = 98865.25504023193 Pa, ρ_bar = 1e5/(287*300)*(1 - 100/H_s)^inv_kappa_m1 = 1.1520128756692036 kg/m^3; H_s = 30703.363914373087 m is unchanged (independent of z). Reproduces the z = 100 m point of the upstream `Hydrostatic Balance` testset: with the surface_values pressures and densities, the finite-difference (p_bar(100) - p_bar(0))/100 = -11.347 Pa/m matches -ρ̄*g (ρ̄ the 0-100 m mean density) to a relative error of 3.3e-6.",
      "parameter_overrides": {
        "z": 100.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "T_bar",
          "time": 0.0,
          "expected": 299.0229083665339
        },
        {
          "variable": "p_bar",
          "time": 0.0,
          "expected": 98865.25504023193
        },
        {
          "variable": "ρ_bar",
          "time": 0.0,
          "expected": 1.1520128756692036
        },
        {
          "variable": "H_s",
          "time": 0.0,
          "expected": 30703.363914373087
        }
      ]
    },
    {
      "id": "profile_at_5km",
      "description": "Base-state profile at z = 5000 m (mid-troposphere), all other parameters default. (1 - z/H_s) = 0.8371... gives T_bar = 251.14541832669323 K (< 300 K), p_bar = 53696.81236367263 Pa (< 1e5 Pa), ρ_bar = 0.7449743994418361 kg/m^3; H_s = 30703.363914373087 m. Reproduces the upstream `Profile` testset, including its T_bar < 300 and p_bar < 1e5 checks.",
      "parameter_overrides": {
        "z": 5000.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "T_bar",
          "time": 0.0,
          "expected": 251.14541832669323
        },
        {
          "variable": "p_bar",
          "time": 0.0,
          "expected": 53696.81236367263
        },
        {
          "variable": "ρ_bar",
          "time": 0.0,
          "expected": 0.7449743994418361
        },
        {
          "variable": "H_s",
          "time": 0.0,
          "expected": 30703.363914373087
        }
      ]
    },
    {
      "id": "upper_troposphere_10km",
      "description": "Base-state profile at z = 10000 m (upper troposphere), all other parameters default. (1 - z/H_s) = 0.6743... gives T_bar = 202.29083665338644 K, p_bar = 25193.61612123406 Pa, ρ_bar = 0.43394271347629165 kg/m^3 — all three profiles continue their monotonic decrease with height; H_s = 30703.363914373087 m. Confirms the profiles stay positive and well-behaved at large height fractions z/H_s (here 0.326).",
      "parameter_overrides": {
        "z": 10000.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "T_bar",
          "time": 0.0,
          "expected": 202.29083665338644
        },
        {
          "variable": "p_bar",
          "time": 0.0,
          "expected": 25193.61612123406
        },
        {
          "variable": "ρ_bar",
          "time": 0.0,
          "expected": 0.43394271347629165
        },
        {
          "variable": "H_s",
          "time": 0.0,
          "expected": 30703.363914373087
        }
      ]
    },
    {
      "id": "warm_potential_temperature",
      "description": "Warmer base state Θ = 320 K at the surface (z = 0). The scale height grows with Θ: H_s = c_p*Θ/g = 1004*320/9.81 = 32750.25484199796 m. At the surface T_bar = Θ = 320 K and p_bar = P_0 = 1e5 Pa; the surface density falls with Θ, ρ_bar = 1e5/(287*320) = 1.088850174216028 kg/m^3. Isolates the Θ-dependence of the scale height and the surface temperature.",
      "parameter_overrides": {
        "Θ": 320.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "T_bar",
          "time": 0.0,
          "expected": 320.0
        },
        {
          "variable": "p_bar",
          "time": 0.0,
          "expected": 100000.0
        },
        {
          "variable": "ρ_bar",
          "time": 0.0,
          "expected": 1.088850174216028
        },
        {
          "variable": "H_s",
          "time": 0.0,
          "expected": 32750.25484199796
        }
      ]
    },
    {
      "id": "cold_potential_temperature",
      "description": "Colder base state Θ = 250 K at the surface (z = 0). The scale height shrinks with Θ: H_s = c_p*Θ/g = 1004*250/9.81 = 25586.136595310905 m. At the surface T_bar = Θ = 250 K and p_bar = P_0 = 1e5 Pa; the surface density rises with the colder base state, ρ_bar = 1e5/(287*250) = 1.3937282229965158 kg/m^3. Together with warm_potential_temperature this brackets the linear H_s = c_p*Θ/g relation.",
      "parameter_overrides": {
        "Θ": 250.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "T_bar",
          "time": 0.0,
          "expected": 250.0
        },
        {
          "variable": "p_bar",
          "time": 0.0,
          "expected": 100000.0
        },
        {
          "variable": "ρ_bar",
          "time": 0.0,
          "expected": 1.3937282229965158
        },
        {
          "variable": "H_s",
          "time": 0.0,
          "expected": 25586.136595310905
        }
      ]
    },
    {
      "id": "elevated_surface_pressure",
      "description": "Higher surface pressure P_0 = 1.05e5 Pa evaluated at z = 2000 m (Θ default). Pressure and density scale linearly with P_0: p_bar = 1.05e5*(1 - z/H_s)^inv_kappa = 82957.22050236931 Pa and ρ_bar = 1.05e5/(287*300)*(1 - z/H_s)^inv_kappa_m1 = 1.0306333794442013 kg/m^3. T_bar = 280.45816733067727 K and H_s = 30703.363914373087 m are independent of P_0. Confirms the P_0 prefactor of Eqs. 2.8-2.9 and the P_0-independence of the temperature profile and scale height.",
      "parameter_overrides": {
        "P_0": 105000.0,
        "z": 2000.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "T_bar",
          "time": 0.0,
          "expected": 280.45816733067727
        },
        {
          "variable": "p_bar",
          "time": 0.0,
          "expected": 82957.22050236931
        },
        {
          "variable": "ρ_bar",
          "time": 0.0,
          "expected": 1.0306333794442013
        },
        {
          "variable": "H_s",
          "time": 0.0,
          "expected": 30703.363914373087
        }
      ]
    },
    {
      "id": "combined_profile",
      "description": "All three free parameters off their defaults at once: Θ = 290 K, P_0 = 9.5e4 Pa, z = 3000 m. H_s = c_p*290/g = 29679.91845056065 m; T_bar = 290*(1 - 3000/H_s) = 260.68725099601596 K; p_bar = 9.5e4*(1 - 3000/H_s)^inv_kappa = 65438.0742158486 Pa; ρ_bar = 9.5e4/(287*290)*(1 - 3000/H_s)^inv_kappa_m1 = 0.8746389643596594 kg/m^3. Sampled at t = 0 and t = 1 to confirm the algebraic system is time-invariant.",
      "parameter_overrides": {
        "Θ": 290.0,
        "P_0": 95000.0,
        "z": 3000.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "assertions": [
        {
          "variable": "T_bar",
          "time": 0.0,
          "expected": 260.68725099601596
        },
        {
          "variable": "p_bar",
          "time": 0.0,
          "expected": 65438.0742158486
        },
        {
          "variable": "ρ_bar",
          "time": 0.0,
          "expected": 0.8746389643596594
        },
        {
          "variable": "H_s",
          "time": 0.0,
          "expected": 29679.91845056065
        },
        {
          "variable": "T_bar",
          "time": 1.0,
          "expected": 260.68725099601596
        },
        {
          "variable": "p_bar",
          "time": 1.0,
          "expected": 65438.0742158486
        },
        {
          "variable": "ρ_bar",
          "time": 1.0,
          "expected": 0.8746389643596594
        },
        {
          "variable": "H_s",
          "time": 1.0,
          "expected": 29679.91845056065
        }
      ]
    }
  ],
  "analyses": [
    {
      "id": "base_state_vertical_profile",
      "description": "The three base-state thermodynamic profiles — temperature T_bar (Eq. 2.7), pressure p_bar (Eq. 2.8) and density ρ_bar (Eq. 2.9) — as functions of height z from the surface to 15 km, at the default isentropic base state (Θ = 300 K, P_0 = 1e5 Pa). Temperature falls linearly with height; pressure and density fall as powers of the same (1 - z/H_s) factor. This is the canonical vertical structure of the Clark (1977) isentropic reference atmosphere.",
      "initial_state": {},
      "parameters": {},
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "parameter_sweep": {
        "type": "cartesian",
        "dimensions": [
          {
            "parameter": "z",
            "range": {
              "start": 0.0,
              "stop": 15000.0,
              "count": 31,
              "scale": "linear"
            }
          }
        ]
      },
      "plots": [
        {
          "id": "temperature_profile",
          "type": "line",
          "description": "Base-state temperature T_bar vs height (Clark 1977 Eq. 2.7).",
          "x": {
            "variable": "z",
            "label": "Height above surface z (m)"
          },
          "y": {
            "variable": "T_bar",
            "label": "Base-state temperature T_bar (K)"
          }
        },
        {
          "id": "pressure_profile",
          "type": "line",
          "description": "Base-state pressure p_bar vs height (Clark 1977 Eq. 2.8).",
          "x": {
            "variable": "z",
            "label": "Height above surface z (m)"
          },
          "y": {
            "variable": "p_bar",
            "label": "Base-state pressure p_bar (Pa)"
          }
        },
        {
          "id": "density_profile",
          "type": "line",
          "description": "Base-state density ρ_bar vs height (Clark 1977 Eq. 2.9).",
          "x": {
            "variable": "z",
            "label": "Height above surface z (m)"
          },
          "y": {
            "variable": "ρ_bar",
            "label": "Base-state density ρ_bar (kg/m^3)"
          }
        }
      ]
    },
    {
      "id": "scale_height_vs_potential_temperature",
      "description": "Isentropic scale height H_s = c_p*Θ/g as a function of the reference potential temperature Θ swept from 250 to 400 K. H_s is linear in Θ and independent of the surface pressure and height — a warmer isentropic atmosphere is deeper.",
      "initial_state": {},
      "parameters": {},
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "parameter_sweep": {
        "type": "cartesian",
        "dimensions": [
          {
            "parameter": "Θ",
            "range": {
              "start": 250.0,
              "stop": 400.0,
              "count": 31,
              "scale": "linear"
            }
          }
        ]
      },
      "plots": [
        {
          "id": "H_s_vs_theta",
          "type": "line",
          "description": "Isentropic scale height H_s as a function of reference potential temperature Θ.",
          "x": {
            "variable": "Θ",
            "label": "Reference potential temperature Θ (K)"
          },
          "y": {
            "variable": "H_s",
            "label": "Isentropic scale height H_s (m)"
          }
        }
      ]
    },
    {
      "id": "surface_density_vs_potential_temperature",
      "description": "Surface (z = 0) base-state density ρ_bar as a function of the reference potential temperature Θ swept from 250 to 400 K, at the default surface pressure P_0 = 1e5 Pa. At the surface (1 - z/H_s) = 1, so Eq. 2.9 reduces to the ideal-gas relation ρ_bar = P_0/(R_d*Θ): density is inversely proportional to the potential temperature.",
      "initial_state": {},
      "parameters": {
        "z": 0.0
      },
      "time_span": {
        "start": 0.0,
        "end": 1.0
      },
      "parameter_sweep": {
        "type": "cartesian",
        "dimensions": [
          {
            "parameter": "Θ",
            "range": {
              "start": 250.0,
              "stop": 400.0,
              "count": 31,
              "scale": "linear"
            }
          }
        ]
      },
      "plots": [
        {
          "id": "rho_bar_surface_vs_theta",
          "type": "line",
          "description": "Surface base-state density ρ_bar as a function of reference potential temperature Θ (the ideal-gas limit of Eq. 2.9 at z = 0).",
          "x": {
            "variable": "Θ",
            "label": "Reference potential temperature Θ (K)"
          },
          "y": {
            "variable": "ρ_bar",
            "label": "Surface base-state density ρ_bar (kg/m^3)"
          }
        }
      ]
    }
  ]
}