@@ -1647,24 +1647,32 @@ add_diagnostic_variable!(
16471647function compute_mslp! (out, state, cache, time)
16481648 thermo_params = CAP. thermodynamics_params (cache. params)
16491649 g = TD. Parameters. grav (thermo_params)
1650- R_m_surf = Fields. level (
1651- lazy .(TD. gas_constant_air .(thermo_params, cache. precomputed. ᶜts)),
1652- 1 ,
1653- )
1650+ ts_level = Fields. level (cache. precomputed. ᶜts, 1 )
1651+ R_m_surf = @. lazy (TD. gas_constant_air (thermo_params, ts_level))
16541652
1655- # get pressure, temperature, and height at the lowest atmospheric level
16561653 p_level = Fields. level (cache. precomputed. ᶜp, 1 )
1657- t_level = Fields. level (
1658- lazy .(TD. air_temperature .(thermo_params, cache. precomputed. ᶜts)),
1659- 1 ,
1660- )
1654+ t_level = @. lazy (TD. air_temperature (thermo_params, ts_level))
16611655 z_level = Fields. level (Fields. coordinate_field (state. c. ρ). z, 1 )
16621656
1663- # compute sea level pressure using the hypsometric equation
1657+ # Reduce to mean sea level using hypsometric formulation with lapse rate adjustment
1658+ # Using constant lapse rate Γ = 6.5 K/km, with virtual temperature
1659+ # represented via R_m_surf. This reduces biases over
1660+ # very cold or very warm high-topography regions.
1661+ FT = Spaces. undertype (Fields. axes (state. c. ρ))
1662+ Γ = FT (6.5e-3 ) # K m^-1
1663+
1664+ # p_msl = p_z0 * [1 + Γ * z / T_z0]^( g / (R_m Γ))
1665+ # where:
1666+ # - p_z0 pressure at the lowest model level
1667+ # - T_z0 air temperature at the lowest model level
1668+ # - R_m moist-air gas constant at the surface (R_m_surf), which
1669+ # accounts for virtual-temperature effects in the exponent
1670+ # - Γ constant lapse rate (6.5 K/km here)
1671+
16641672 if isnothing (out)
1665- return @. p_level * exp (g * z_level / (R_m_surf * t_level) )
1673+ return p_level .* ( 1 .+ Γ . * z_level ./ t_level) .^ (g / Γ ./ R_m_surf )
16661674 else
1667- @. out = p_level * exp (g * z_level / (R_m_surf * t_level) )
1675+ out . = p_level .* ( 1 .+ Γ . * z_level ./ t_level) .^ (g / Γ ./ R_m_surf )
16681676 end
16691677end
16701678
@@ -1673,7 +1681,7 @@ add_diagnostic_variable!(
16731681 long_name = " Mean Sea Level Pressure" ,
16741682 standard_name = " mean_sea_level_pressure" ,
16751683 units = " Pa" ,
1676- comments = " Mean sea level pressure computed from the hypsometric equation " ,
1684+ comments = " Mean sea level pressure computed using a lapse-rate-dependent hypsometric reduction (ERA-style; Γ=6.5 K/km with virtual temperature via moist gas constant). " ,
16771685 compute! = compute_mslp!,
16781686)
16791687
0 commit comments