Search arXiv⌕ Search

arXiv · 2610.12662

Evaluating LLMs for Translating Legacy Fortran Atmospheric Physics to GPU-Accelerated JAX

Abstract

Legacy Fortran physics packages in atmospheric models such as CESM, WRF, and E3SM pose a barrier to GPU modernization, while manual porting requires accelerator-programming expertise. We present LAFT (LLM-Assisted Fortran Translation), an agentic framework for converting Fortran atmospheric physics parameterizations into GPU-accelerated JAX while preserving numerical agreement with the Fortran reference. LAFT coordinates source-code analysis, translation, repair, runtime validation, and performance profiling. It combines a deterministic front end for metadata extraction and bridge generation, structured translation prompts, numerical validation, and profiling-guided feedback to identify inefficient execution patterns. The bridge handles array-layout conversion separately from scientific computation. We evaluate LAFT using the Kessler warm-rain microphysics scheme and four LLMs: Claude, GPT, Gemini, and Qwen. All four validated translations reproduce the Fortran reference outputs to near floating-point precision for the evaluated case, but their GPU performance differs substantially with execution design. The Gemini-generated implementation achieves up to a 357-fold speedup over serial Fortran in cached execution at 1,000,000 atmospheric columns, excluding compilation and host-device transfers. The results demonstrate that numerical agreement alone does not ensure efficient GPU execution and motivate combining numerical validation with hardware-aware performance analysis. LAFT provides a practical workflow for modernizing legacy atmospheric physics code through LLM-assisted translation, deterministic interface generation, automated validation and repair, and reproducible profiling.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Iris Linck, John Dennis, John Schreck, Karen Stengel, David John Gagne II. 2026-10-08. Evaluating LLMs for Translating Legacy Fortran Atmospheric Physics to GPU-Accelerated JAX. https://arxiv.org/abs/2610.12662

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

ACE2-NEMO: Coupling an ML atmospheric emulator to a full-depth dynamical ocean model

Understanding how fast atmospheric variability shapes slow climate variability and sensitivity remains a central challenge in Earth-system science. Recent advances in machine-learned (ML) atmospheric models have demonstrated remarkable skill on weather timescales, but their emergent behaviour in a fully coupled climate system remains largely unexplored. We present early results from a new hybrid modelling framework, in which the ACE2 ML atmospheric emulator is interactively coupled to the NEMO ocean model. We report on a set of 70-year coupled simulations (1950-2020 historical forcing and fixed-1950s control). These experiments represent, to our knowledge, one of the first multi-decadal integrations of a machine-learned atmosphere interacting with a full-depth dynamical ocean. Several historical and fixed-1950s control simulations from the fully dynamic global coupled climate model EC-Earth, which has the same ocean component used in ACE2-NEMO, are also considered for comparison. We assess the behaviour of the coupled system, with particular focus on low-frequency tropical variability and the climate response to greenhouse-gas forcing. Analysis of potentially emergent El Nino-like variability reveals realistic fast timescale air-sea coupling in the tropical Pacific, but the temporal variability is unrealistic, with very low amplitude oscillations; this appears to be due to weak atmospheric feedback in the tropical Pacific. The response to CO2 forcing shows initial agreement with EC-Earth3P but deviates due to reduced downward short-wave radiation in ACE2. These results provide a unique test of physical realism and generalisability for atmospheric emulators and evaluate the possible role of entirely machine-learned components in next-generation Earth system models.

physics.ao-ph↗

Arctic bimodality reflects enhanced variability in the clear-cloudy transition rather than bistability

The wintertime Arctic boundary layer is characterized by two distinct states, radiatively clear (cloud-free) and radiatively opaque (cloudy), which is reflected in observations as a bimodal distribution. Previous studies hypothesized that these regimes are related to an underlying bistability of the system's dynamics. We apply a drift-diffusion framework based on the two leading terms of the Kramers-Moyal expansion to observations from 15 winter periods in Ny-Alesund, Norway. Our model captures the bimodality; we find a single stable point for the deterministic drift, however, which questions the existence of bistable deterministic dynamics. Instead, the observed regimes can be attributed to state-dependent stochastic fluctuations with maximum amplitude close to the clear-cloudy transition. The position of the stable point depends on the meteorological conditions. Controlling for synoptic variability does not remove the state-dependence of diffusion, however. The cloudy regime is associated with southwesterly winds, high specific humidities, and uplifting motion, the latter two being conducive for cloud formation, while the cloud-free regime occurs under drier conditions and northeasterly winds. Through an illustrative example, we suggest a possible process-based interpretation of our statistical analysis. The nonlinear onset of cloud formation, once atmospheric humidity reaches saturation, could map state-independent fluctuations in humidity to state-dependent fluctuations in cloudiness.

physics.ao-ph↗

BridgeCast: Bridging Ocean Wave Forecasts to Reanalysis via Flow Matching with Exogenous Variables

Ocean wave forecasting is essential for maritime safety, offshore operations, and coastal resilience, yet remains challenging due to systematic biases in physics-based models. Physical models, while widely used, rely on approximations and parameterizations that limit their accuracy under complex ocean-atmosphere conditions. To enhance ocean wave forecasting, we propose BridgeCast, within a physics-AI hybrid framework for bias correction. BridgeCast is a probabilistic model based on conditional flow matching (CFM) that learns to transform physical model forecasts into reanalysis-like fields. It treats physical forecasts as corrupted observations and employs a continuous-time generative process to bridge their distribution toward that of reanalysis data. BridgeCast is parameterized by a Transformer-based architecture that enables spatiotemporal modeling, incorporation of exogenous atmospheric variables, and flexible inference via both ordinary and stochastic differential equation formulations. Extensive experiments on real-world datasets demonstrate that BridgeCast consistently outperforms state-of-the-art baselines across regions and forecast lead times.

physics.ao-ph↗