Equation-of-State

  • WRFColumnGeometry model atmospheric_dynamics wrf_arw

    Diagnostic thermodynamic and geometric state of a single WRF-ARW column with a fixed dry column mass, on the EarthSciDiscretizations column_nonuniform_1d grid: everything the physics schemes are handed about the column, computed from the dynamical state (geopotential, moist potential temperature, moisture) and the hydrostatic base state. Two WRF routines are transcribed. (1) calc_p_rho_phi (dyn_em/module_big_step_utilities_em.F, non-hydrostatic, hypsometric_opt = 1, use_theta_m = 1): the inverse dry density from the geopotential, alpha_d = -(1/mu_d) dphi/deta, in its base-state split alpha' = -(alpha_b mu' + dphi'/deta)/mu_d, and the pressure from the equation of state p = p0 (R_d theta_m / (p0 alpha_d))^gamma with the moist potential temperature theta_m (no separate vapour factor, because theta_m already carries 1 + (R_v/R_d) q_v). (2) phy_prep (module_big_step_utilities_em.F:4730-4973): dry theta = theta_m/(1 + (R_v/R_d) q_v), the Exner function, temperature, moist density (1 + q_v)/alpha_d, interface and layer heights from the geopotential, layer thicknesses (WRF dz8w), pressure and temperature on the interfaces (eta-linear interpolation inside the column; linear-in-height extrapolation at the surface, and at the top linear-in-height for temperature but in log pressure for pressure, WRF's positive-definite fix exp(w ln p_N + (1-w) ln p_{N-1}), written here in the identical dimensionally clean form p_{N-1} (p_N/p_{N-1})^w), and the hydrostatic pressure (WRF p_hyd_w, p_hyd) integrated downward from the lid p_top over the full (dry plus all water species) column mass, p_hyd(s) = p_top + integral_s^top (1 + q_t) mu_d ds', the pressure the radiation schemes use. The column coordinate is s = 1 - eta (0 at the surface, 1 at the top, increasing with the lev index as the grid requires), so dphi/deta = -dphi/ds and the grid's layer thickness dz is -dnw; the layer-wise geopotential difference is the grid rule face_flux_D_lev_supplied_faces and the downward integral the rule integral_lev_nodes_cumulative_to_top, both over that dz. Heights are named z_w, z_c and dz8w to keep them apart from the coordinate. Real32 note: WRF evaluates p' = p0 temp^gamma - p_b in single precision, a difference of two ~1e5 Pa numbers, so the dumped p' carries O(1e-2) Pa rounding while this float64 evaluation does not; the tests assert p' with an absolute tolerance for that reason. Consumer-supplied column fields are rewrite-target ops input_<name>.

  • WrightEOS model ocean mom6

    Stage-2 implementation of the MOM6 equation of state (stage 1 boundary B1 of stage1/runs/MOM6_LANE.md; MOM6 dev/ncar_260909 @301879336, fork stage1/EqESM-cesm-mom6 branch instrument/mom6-dumps): the Wright 1997 full-range in-situ density rho(T, S, p) and its analytic first derivatives drho/dT, drho/dS, as evaluated by the model's calculate_density / calculate_density_derivs_scalar calls in KPP_compute_BLD (MOM_CVMix_KPP.F90:1437; the EOS law itself is density_elem_Wright_full / calculate_density_derivs_elem_Wright_full, MOM_EOS_Wright_full.F90:75-91 / 179-204). The model WrightEOS binds the 15 Fortran coefficients by reference from the wright_coeff_a0..c5 constant fragments of ./mom6_templates.esm (MOM_EOS_Wright_full.F90:23-37; the fragments are the single shared source of the coefficient values, also used by the wright_rho composition and by the KPPBLD model of mom6_kpp.esm), computes the three shared polynomials al0/p0/lambda as intermediate unknowns via the wright_alpha0 and wright_poly templates of ./mom6_templates.esm (p0 and lambda are the same wright_poly law under the b- and c-coefficients), then rho = (p + p0)/(lambda + al0*(p + p0)) via the wright_density template and the Fortran's hand-coded derivative formulas (wright_drho_dT / wright_drho_dS templates) with the shared denominator inverse I_denom2 = 1/(lambda + al0*(p + p0))^2 (F90:198). The derivatives are transcribed formulas, NOT symbolic D(rho, T)/D(rho, S): in esm 1.3.0 the D operator is a rewrite-target for discretization stencils (esm-spec 4.2 / 9.6.8) and the CLI 0.7.0 evaluator rejects it for algebraic expressions ('unlowered_operator ... reached evaluation without being lowered to a stencil'), so the Fortran derivative formulas are reproduced exactly instead (operation order identical to the Fortran, so the tests pin the derivative columns to round-off, rel 1e-12). State units: T potential temperature [degC], S salinity [ppt], p pressure at the top interface of the layer [Pa] (surface pressure + hydrostatic weight of the layers above, MOM_CVMix_KPP.F90:1428-1440), rho in-situ density [kg m-3], drho/dT [kg m-3 degC-1], drho/dS [kg m-3 ppt-1]. The run configuration (C_JRA_t62_mom6_inst) uses EQN_OF_STATE = WRIGHT_FULL (the MOM6 default), USE_PSURF_IN_EOS = True, and all unit rescale factors 1.0, so the dumped values are the physical-unit law values.