Last updated: April 2026 β See Recent Changes for latest additions.
Repository for curvature-aware MoninβObukhov Similarity Theory (MOST) diagnostics, Richardson number closures, and grid-dependent corrections for stable boundary layer parameterizations.
Coarse vertical grids in atmospheric models systematically underestimate near-surface stability in the stable boundary layer (SBL), leading to excessive turbulent mixing and warm-biased surface temperatures. This toolkit provides:
- Analytic curvature diagnostics for gradient Richardson number Ri_g(ΞΆ)
- Neutral-curvature-preserving corrections (preserves 2Ξ invariant)
- Grid-aware damping factors reducing coarse-grid bias by 40%+
- Richardson number series inversion (ΞΆ β Ri) with Newton refinement
- Geometric vs logarithmic mean height analysis for bulk transfer coefficients
- Dynamic critical Richardson number framework (Ri_c*)
- Ultraspherical (Gegenbauer) representation of MOST similarity operators
- CBC/Legendre series for power-law Ο functions with equator-evaluation identity
- Safeguarded Newtonβbisection inversion for ΞΆ(Ri_g) across all SBL regimes
Key Innovation: The neutral curvature invariant Ξ = Ξ±_h Ξ²_h β 2Ξ±_m Ξ²_m governs initial departure from linearity; preserving 2Ξ anchors corrections to physically consistent near-neutral behavior. The momentum similarity function Ο_m = (1 β b_m ΞΆ)^{β1/4} is an ultraspherical (Gegenbauer, Ξ»=1/4) generating-function evaluation; Ο_h is Legendre (Ξ»=1/2); their ratio identity Ο_h = Ο_mΒ² when a_h=1, b_m=b_h gives an exact ClebschβGordan product in polynomial space.
Open the interactive demo directly in your browser:
Run the first cell to install dependencies automatically.
# Clone repository
git clone https://github.com/DavidEngland/ABL.git
cd ABL
# Create virtual environment (Python 3.10+)
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install --upgrade pip
pip install -r requirements.txt
# Launch Jupyter
jupyter lab
# Open notebooks/Curvature_Demo.ipynbbash setup_dev.sh # Creates venv, installs deps, checks for gfortran
source .venv/bin/activateInstall the Julia packages once:
julia -e 'using Pkg; Pkg.add(["CSV", "DataFrames", "LsqFit"])'
# Optional plotting
julia -e 'using Pkg; Pkg.add("CairoMakie")'Run the general prototype first when you have any site-level dataset with zeta and phi_obs:
julia julia/ultraspherical_practical_run.jl data/station_phi_m.csv output/ultra_demoRun the same script in synthetic mode before touching observations. This generates known Gegenbauer coefficients plus additive white Gaussian noise so students can test recovery under realistic conditions:
julia julia/ultraspherical_practical_run.jl --synthetic output/ultra_synth
julia julia/ultraspherical_practical_run.jl --synthetic output/ultra_synth 0.08 320Use the HSNBL-oriented script only when the dataset is stable-only and has a credible very-stable tail:
julia julia/sheba_ultra.jl data/stable_site_phi.csv output/sheba_styleWhen to use which script:
julia/ultraspherical_practical_run.jl: first-pass workflow, mixed-regime or generic stable-capable sites, student projects, synthetic recovery tests.julia/sheba_ultra.jl: stage-two calibration for HSNBL-like data, especially once SHEBA or equivalent Arctic strong-stability cases are available.
ABL/
βββ ReadMe.md # This file
βββ CHANGELOG.md # Version history
βββ CONTRIBUTING.md # Contribution guidelines
βββ requirements.txt # Python dependencies
βββ setup_dev.sh # Development environment setup
βββ .gitignore # Git ignore patterns
β
βββ examples/ # β
Active Fortran 90 development
β βββ README.md # Module index and build instructions
β βββ module_most_profile_utils.F90 # MOST inversion utilities (safeguarded Newton)
β βββ module_cbc_legendre_most.F90 # CBC/Gegenbauer series evaluation
β βββ driver_cbc_gegenbauer_errors.F90 # Error-tabulation driver
β βββ wrf_integration_example.F90 # WRF/MYNN integration sketch
β βββ overview.md # Jensen's Inequality / grid-bias overview
β
βββ drafts/ # Working manuscript drafts
β βββ README.md # Draft index
β βββ ultraspherical_subsection.md # Ultraspherical MOST structure (McNider-Biazar Β§3)
β βββ SBL_IBEx_expansions.md # IBEx series framework for SBL inversions
β βββ quad heat shear.md # Linear Ο_m / quadratic Ο_h analysis
β βββ quad heat z-less.md # Z-less scaling & higher-degree Ο_h
β βββ Momentum as a Gegenbauer ultraspherical problem.md
β
βββ manuscripts/ # Near-submission papers
β βββ README.md # Manuscript status & action items
β βββ Grid_Curvature_SBL_v01.md # Primary paper (BLM target)
β βββ CBC_Gegenbauer_Backward_Workflow_v01.md
β βββ WRF_Ri_Curvature_Integration_Outline_v01.md
β
βββ notes/ # Research working notes
β βββ README.md # Notes index
β βββ parameters.md / parameters2.md # MOST parameter tables
β βββ Legendre.md # Legendre / Gegenbauer identities
β βββ Central Binomial UBL heat shear.md
β βββ SBL-IBEx.md # IBEx reference sheet
β
βββ code/ # Python & legacy Fortran utilities
β βββ most_similarity.md # MOST similarity function reference
β βββ most.f # Original Fortran 77 MOST code
β βββ module_bl_mynn.F90 # WRF MYNN scheme (reference copy)
β βββ select_f_form.py # Stability-function selector
β βββ profiles.py # Profile evaluation utilities
β βββ [additional scripts]
β
βββ hw/ # Educational / homework materials
β βββ README.md # Problem set index
β βββ CBC.md # Central binomial coefficient problems
β βββ Legendre.md # Legendre polynomial problems
β βββ stability functions.md # Stability function derivation problems
β βββ [additional problem sets]
β
βββ param/ # Parameterization scaffolding (Julia/SCM)
β βββ SCAFFOLDING.md # SCM parameterization design
β βββ core/ # Core substrate/slab modules
β
βββ julia/ # Julia SCM skeleton
β βββ ultraspherical_practical_run.jl # General baseline + residual spectral fit
β βββ sheba_ultra.jl # HSNBL/SHEBA-oriented stable-only fit
β βββ SCMSkeleton.jl # Single-column model skeleton
β βββ SCMSkeleton_vs_SCAFFOLDING.md
β
βββ notebooks/ # Interactive demonstrations
β βββ Curvature_Demo.ipynb # Main demo (Colab-ready)
β
βββ implementations/ # Legacy drop-in correction modules
β βββ McNider_1DBLM_fc_module.f90 # Fortran 90 correction module
β βββ McNider_1DBLM_integration_guide.md
β
βββ config/ # Configuration files
β βββ rct_config.yaml # RCT run configuration
β
βββ data/ # Observational / validation data
βββ visuals/ # Figures and plots
βββ refs/ references/ # Reference materials and literature
Compute second derivative of gradient Richardson number:
# Analytic curvature for power-law Ο functions
def curvature_linear(zeta, a_m, a_h):
V_log = a_h/(1.0 + a_h*zeta) - 2.0*a_m/(1.0 + a_m*zeta)
W_log = (a_h**2)/((1.0 + a_h*zeta)**2) - 2.0*(a_m**2)/((1.0 + a_m*zeta)**2)
F = (1 + a_h*zeta) / (1 + a_m*zeta)**2
return F * (2.0 * V_log + zeta * (V_log**2 - W_log))
# Neutral curvature invariant
Delta = a_h - 2*a_m
neutral_curvature = 2 * DeltaPreserve neutral curvature while reducing coarse-grid bias:
# Exponential damping factor
def G_correction(zeta, dz, D=0.8, dz_ref=10.0, zeta_ref=0.5, p=1.0, q=2.0):
exponent = -D * (dz/dz_ref)**p * (zeta/zeta_ref)**q
return np.exp(exponent)
# Apply to diffusivities
K_m_corrected = K_m_original * G_correction(zeta, dz)
K_h_corrected = K_h_original * G_correction(zeta, dz)Fast ΞΆ(Ri) inversion using series + Newton:
# Series seed (O(RiΒ³) accurate)
def zeta_from_ri_series(Ri, Delta, c1):
return Ri - Delta*Ri**2 + (1.5*Delta**2 - 0.5*c1)*Ri**3
# Newton refinement (1-2 iterations to machine precision)
def zeta_from_ri_newton(Ri_target, phi_m, phi_h, z0, tol=1e-10, maxit=20):
z = zeta_from_ri_series(Ri_target, Delta, c1) # seed
for _ in range(maxit):
F = phi_h(z) / phi_m(z)**2
Ri = z * F
if abs(Ri - Ri_target) < tol:
break
dRi_dz = F + z * (...) # derivative
z -= (Ri - Ri_target) / dRi_dz
return z# Representative heights for layer [z0, z1]
z_g = np.sqrt(z0 * z1) # Geometric mean (log-space midpoint)
z_L = (z1 - z0) / np.log(z1/z0) # Logarithmic mean (exact for shear)
z_a = 0.5 * (z0 + z1) # Arithmetic mean (biases high)| Metric | Target (Ξz=100m) | Baseline | With Correction |
|---|---|---|---|
| Bias ratio B | < 1.2 | ~1.8 | ~1.15 |
| Surface flux RMSE | < 15% | ~30% | ~12% |
| Inversion height error | < 20 m | ~50 m | ~18 m |
| Neutral curvature preservation | |2Ξ*β2Ξ|/|2Ξ| < 5% | N/A | 2.3% |
| Computational overhead | < 5% | 0% | 2.8% |
Validation Cases:
- GABLS1 LES (9-hour nocturnal evolution)
- ARM NSA Alaska (persistent stable nights)
- SHEBA Arctic winter inversions
Fortran modules (examples/)
module_most_profile_utils.F90: Addedzeta_from_rig_safeguarded()β safeguarded Newton + bisection fallback with branch-aware brackets;fm_fh_from_rignow calls this as primary solver.module_cbc_legendre_most.F90: CBC/Gegenbauer series evaluation module for power-law Ο functions; implements Legendre equator identity P_{2n}(0) = (β1)^n C(2n,n)/4^n.driver_cbc_gegenbauer_errors.F90: Error-tabulation driver comparing exact Ο_m vs truncated Gegenbauer series at equator.wrf_integration_example.F90: WRF/MYNN-style integration sketch using safeguarded ΞΆ(Ri_g) inversion.
Draft manuscripts (drafts/)
ultraspherical_subsection.md: New Β§3.x subsection for McNider-Biazar paper. Covers Gegenbauer generating functions (Ξ»=1/4 momentum, Ξ»=1/2 heat), Sturm-Liouville operator in stability space, Clebsch-Gordan squaring identity Ο_h=Ο_mΒ², Ri_g mapping, asymptotic 3-term expansions, dynamic Ri_c, and algebra-first inversion decision tree with Mermaid flowchart.SBL_IBEx_expansions.md: IBEx (Internal/Boundary/External) series framework for SBL Richardson mappings; includes ΞΆ/(1+Ξ²ΞΆ) canonical forms and SBL asymptote analysis.quad heat shear.md: Analysis of linear-Ο_m / quadratic-Ο_h mixed MOST form and physical implications.quad heat z-less.md: Connection between z-less scaling and the required degree of Ο_h.
Working notes (notes/)
parameters.md,parameters2.md: Consolidated MOST parameter tables (Businger, Dyer, HΓΆgstrΓΆm, McNider).Legendre.md: Legendre/Gegenbauer orthogonality and generating-function identities.Central Binomial UBL heat shear.md: CBC series for UBL heat-shear asymptotic expansion.SBL-IBEx.md: Quick-reference sheet for IBEx series framework.
Manuscripts (manuscripts/)
WRF_Ri_Curvature_Integration_Outline_v01.md: Outline for WRF integration paper.CBC_Gegenbauer_Backward_Workflow_v01.md: Backward workflow connecting CBC identities to MOST series.
- Vertical Resolution.md β Grid correction framework overview
- McNider_Ri_Corrections_Overview.md β Comprehensive implementation guide
- curvature.md β Full mathematical derivation of βΒ²Ri_g/βΞΆΒ²
- SBL corrections.md β Stable boundary layer implementation
- ultraspherical_subsection.md β Ultraspherical structure of MOST operators
- SBL_IBEx_expansions.md β IBEx series for SBL Richardson mappings
- CANONICAL_GLOSSARY.md β Symbol and notation reference
- examples/README.md β Fortran 90 module index and build instructions
- McNider_1DBLM_integration_guide.md β Legacy Fortran 77/90 drop-in instructions
- IMPLEMENTATION_GUIDE.md β General implementation guide
- hw/README.md β Problem set index
- CBC.md β Central binomial coefficient problem set
- Legendre.md β Legendre/Gegenbauer problem set
- intro.md β Guest lecture outline (60-90 min)
- Arctic Stable Boundary Layers β Reducing warm bias in polar climate models
- Urban Air Quality β Improving nocturnal Oβ/PM2.5 forecasts via better vertical mixing
- Low-Level Jets β Capturing LLJ onset timing and core height
- Slope Flows β Extending to complex terrain (McNider specialty)
Principal Investigators:
- Richard T. McNider (University of Alabama in Huntsville)
- Arastoo P. Biazar (University of Alabama in Huntsville)
- David E. England (Lead Developer)
See emails/McNider_Biazar_Status_2025.md for latest collaboration updates.
# Open test notebook
jupyter lab notebooks/Curvature_Demo.ipynb
# Run key cells
# - Core functions (cell 5)
# - Demo plots (cell 6-8)
# - Synthetic NetCDF (cell 9)- Notebooks execute without errors
- Requirements install in fresh venv
- Key examples produce expected plots
- Code follows PEP 8 (optional:
ruff check .) - Documentation updated for new features
# Build examples (from examples/ directory)
cd examples
# Compile Fortran 90 modules
gfortran -c module_most_profile_utils.F90
gfortran -c module_cbc_legendre_most.F90
gfortran -c driver_cbc_gegenbauer_errors.F90 -o driver_cbc_gegenbauer_errors
# Run CBC/Gegenbauer error table
./driver_cbc_gegenbauer_errors
# Legacy correction module
gfortran -c ../implementations/McNider_1DBLM_fc_module.f90If you use this toolkit in your research, please cite:
@misc{england2025abl,
author = {England, David E. and McNider, Richard T. and Biazar, Arastoo P.},
title = {Curvature-Aware MOST Toolkit for Stable Boundary Layer Corrections},
year = {2025},
year = {2026},
publisher = {GitHub},
url = {https://github.com/DavidEngland/ABL}
}Related Publications:
- England & McNider (1995). "Stability Functions Based Upon Shear Functions." Boundary-Layer Meteorology.
- McNider et al. (1995). [Additional key papers β see refs/]
- JAMC Grid Dependence manuscript β Grid-dependent corrections paper (under review)
We welcome contributions! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feat/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feat/amazing-feature) - Open a Pull Request
Please ensure:
- New features include documentation
- Notebooks remain Colab-compatible
- Code follows existing style conventions
- Tests pass (run demo notebook)
David E. England
Email: [email protected]
GitHub: @DavidEngland
Project Links:
- Repository: https://github.com/DavidEngland/ABL
- Issues: https://github.com/DavidEngland/ABL/issues
- Discussions: https://github.com/DavidEngland/ABL/discussions
This project is licensed under the MIT License - see the LICENSE file for details.
- Funding: NSF Atmospheric & Geospace Sciences, DOE Atmospheric System Research
- Data: ARM Climate Research Facility, SHEBA, GABLS LES intercomparison
- Computing: UAH ESSC cluster, NSF XSEDE allocation
- Inspiration: Businger et al. (1971), Beljaars & Holtslag (1991), Cuxart et al. (2006)
- π Graduate Lecture
- π Interactive Demo
- π Comprehensive Guide
- βοΈ Fortran Integration
- π Publication Topics
Last Updated: January 2025
Version: 1.0.0