Embedding Python COSIPY in WRF for improved simulations over glaciers

Applicant

Dr. Emily Collier
Institut für Geographie / Friedrich-Alexander-Universität Erlangen-Nürnberg
Department of Atmospheric and Cryospheric Sciences (ACINN), University of Innsbruck, Austria

Prof. Tobias Sauter
Climate Geography, Department of Geography, Humboldt-Universität zu Berlin, Germany

Project Summary

Atmospheric models are increasingly being used to generate high-spatial and high-temporal resolution meteorological forcing for glaciological simulations. However, the representation of snow and glacier physics in atmospheric models is often overly simplistic, leading to unrealistic surface boundary conditions, and glacier feedbacks and rapid adjustments are typically neglected.

As part of a Competence Network for Scientific High Performance Computing in Bavaria (KONWIHR) project, we developed a minimally invasive wrapper to couple the Weather and Research Forecasting (WRF) model, written in Fortran, and the glacier climatic mass balance model COSIPY, written in python, to create the coupled modelling system WRF_X_CSPY. The coupling was implemented using the Common Foreign Function Interface package.

A key challenge was speeding up the python component, which was achieved by implementing numba in bottlenecks as well as other code optimizations, leading to only a ~25% slowdown compared with a clean WRF build. A scientific publication about the model is in preparation and the code will be publicly available shortly. The coupled modelling system has large potential to improve the utility of WRF for answering glaciological and hydrological questions in regions of complex terrain.