SearcharxivSearch

arXiv subjects

Sergey Danilov

Publications and source records attributed to Sergey Danilov.

7 recordsLinked to original sources

FESOM2-JAX v1.0: a differentiable shadow of the ocean-sea-ice model FESOM2, cast onto GPUs

We present FESOM2-JAX, a Python re-implementation of the Finite-volumE Sea ice-Ocean Model (FESOM2) in JAX. The model retains the unstructured-mesh, cell-vertex finite-volume formulation of the original, runs unchanged from a laptop CPU to 256 GPUs, and is end-to-end differentiable. FESOM2-JAX is a code shadow of the Fortran model: a projection onto the Python ecosystem, translated with large language models and verified kernel by kernel against the original. It is built to lower the barrier to experimentation, from new numerics and parameterizations to gradient-based calibration and hybrid physics-machine-learning components, while remaining close enough to the original so that what is developed in the shadow can be transferred back. In a 1958-2019 hindcast at 1$^{\circ}$ equivalent resolution with identical physics and forcing, the mean states of the JAX and Fortran versions differ from each other by two orders of magnitude less than either differs from observations, and the two runs agree for six decades in global temperature, salinity, heat content, and sea ice. The complete 1$^{\circ}$ configuration fits on a single GPU, a node of four GH200 superchips integrates $\sim$113 simulated years per wall-clock day, and meshes of up to 7.4 million surface vertices ($\sim$5 km) scale to 128 GPUs. What limits the model is communication rather than arithmetic. What the shadow adds to the original is the gradient: a single reverse-mode pass through the full time loop returns the sensitivity of a model diagnostic to a parameter at every mesh vertex, verified against finite differences. To our knowledge, FESOM2-JAX is the first global ocean-sea-ice model of CMIP-class complexity written natively in a differentiable framework, and the first on an unstructured mesh.

physics.ao-ph

An Ocean Model Ported by a Large Language Model: Experience and Lessons from FESOM2 (Fortran to C to C++/Kokkos)

Large language models (LLMs) can translate and modify source code, and have been shown to do so for codes of different complexity. Whether they can port a complete, production geophysical model to a different language without degrading its physics has not been established. We demonstrate that LLM-assisted code translation can preserve the physics of a complete production ocean model while moving it into a modern performance-portable form. We report our experience using an agentic LLM coding assistant, directed by domain experts, to port the FESOM2 unstructured mesh ocean--sea-ice model (about 74000 lines of core Fortran) first to C and then to C++/Kokkos for performance portability across CPUs and GPUs. We describe the practices that proved necessary, what worked and what did not, and the failure modes that we encountered. Three practices mattered most: translating in two stages that separate reproducing the numerics (Fortran to a clean C reference) from introducing parallelism (C to Kokkos); requiring a strictly literal translation in which the assistant was not permitted to ``improve'' the source; and validating each stage against an acceptance criterion suited to it. The C port reproduces the original Fortran at the level of long-term simulation statistics over five years. The Kokkos port is bit-for-bit identical to the C reference on CPU and statistically close on GPU over multi-year runs. On eddy-rich meshes up to 7.4 million surface vertices a single A100 GPU node runs 1.6--3.7 times faster than a CPU node, reaching the 1-2 simulated-years-per-day required for production integrations. The result is more than a single GPU port: by following a clear validation procedure, an LLM moved a full Fortran ocean model into another language and onto accelerators while preserving its physics in a matter of weeks.

physics.ao-ph

Effects of Horizontal Discretization on Triangular and Hexagonal Grids on Linear Baroclinic and Symmetric Instabilities

As global ocean general circulation models are run at eddy-permitting resolutions, reproducing accurate growth rates of baroclinic instabilities is a major concern when choosing a discretization of the equations of motion. From this viewpoint, we analyze discretizations on triangular and hexagonal grids with different types of variable staggering used in several ocean circulation models. By extending the linear baroclinic instability analysis in the Eady configuration to discretizations on more complex grids, several numerical subtleties are revealed. In comparison to discretizations on quadrilateral grids, the analyzed discretizations are less robust against unstable spurious modes, partly created by the mesh geometry. Some of the subtleties arise because spurious modes on staggered triangular and hexagonal grids do not adhere to Galilean invariance. As a consequence, their growth rates demonstrate a dependence on the alignment between the background flow and the grid, as well as the strength of a uniform background flow. The interactions with spurious modes become more significant on the axis of symmetric instabilities where the physical and spurious branches of instability are more difficult to separate in wavenumber space. Our analysis shows that in most cases moderate biharmonic viscosity and diffusion suppress spurious branches. However, one needs to carefully calibrate the viscosity and diffusivity parameters for each of the considered discretizations in order to achieve this.

physics.ao-ph

Emerging AI-based weather prediction models as downscaling tools

The demand for high-resolution information on climate change is critical for accurate projections and decision-making. Presently, this need is addressed through high-resolution climate models or downscaling. High-resolution models are computationally demanding and creating ensemble simulations with them is typically prohibitively expensive. Downscaling methods are more affordable but are typically limited to small regions. This study proposes the use of existing AI-based numerical weather prediction systems (AI-NWP) to perform global downscaling of climate information from low-resolution climate models. Our results demonstrate that AI-NWP initalized from low-resolution initial conditions can develop detailed forecasts closely resembling the resolution of the training data using a one day lead time. We constructed year-long atmospheric fields using AI-NWP forecasts initialized from smoothed ERA5 and low-resolution CMIP6 models. Our analysis for 2-metre temperature indicates that AI-NWP can generate high-quality, long-term datasets and potentially perform bias correction, bringing climate model outputs closer to observed data. The study highlights the potential for off-the-shelf AI-NWP to enhance climate data downscaling, offering a simple and computationally efficient alternative to traditional downscaling techniques. The downscaled data can be used either directly for localized climate information or as boundary conditions for further dynamical downscaling.

physics.ao-ph

Implementation of implicit filter for spatial spectra extraction

Scale analysis based on coarse-graining has been proposed recently as an alternative to Fourier analysis. It is now broadly used to analyze energy spectra and energy transfers in eddy-resolving ocean simulations. However, for data from unstructured-mesh models it requires interpolation to a regular grid. We present a high-performance Python implementation of an alternative coarse-graining method which relies on implicit filters using discrete Laplacians. This method can work on arbitrary (structured or unstructured) meshes and is applicable to the direct output of unstructured-mesh ocean circulation atmosphere models. The computation is split into two phases: preparation and solving. The first one is specific only to the mesh. This allows for auxiliary arrays that are then computed to be reused, significantly reducing the computation time. The second part consists of sparse matrix algebra and solving linear system. Our implementation is accelerated by GPUs to achieve unmatched performance and scalability. This results in processing data based on meshes with more than 10M surface vertices in a matter of seconds. As an illustration, the method is applied to compute spatial spectra of ocean currents from high-resolution FESOM2 simulations.

physics.ao-ph

Split-explicit external mode solver in finite volume sea ice ocean model FESOM2

A novel split-explicit (SE) external mode solver for the Finite volumE Sea ice-Ocean Model (FESOM2) is presented. It is compared with the semi-implicit (SI) solver currently used in FESOM2. The SE solver utilises a dissipative asynchronous (forward-backward) time-stepping scheme. Its implementation with Arbitrary Lagrangian-Eulerian (ALE) vertical coordinates like Z-star and Z-tilde is explored. The comparisons are performed through multiple test cases involving idealised and realistic global simulations. The SE solver demonstrates lower phase errors and dissipation, but maintain a simulated mean ocean state very similar to the SI solver. The SE solver is also shown to possess better run-time performance and parallel scalability across all tested workloads.

physics.ao-ph

Discrete variance decay analysis of spurious mixing

Expressions for local discrete variance decay (DVD) rates are directly derived from discrete tracer equations without any assumptions on discrete fluxes of the second moment. Spurious mixing (SM) associated with numerical implementations of scalar advection and diffusion is thus estimated. The new framework is shown to avoid the need for second-moment flux definition when solved on finite-volume cell edges but still invoke certain second-moment fluxes when the DVD rates are partitioned to participating cell nodes. These implied discrete fluxes are shown to differ from those proposed in earlier literature (but share the same dissipative part) and thus reveal the non-uniqueness of their nature. They are shown to be ambiguous for high-order advection schemes introducing uncertainty to the locality of any estimates produced by a DVD approach. Additional damping of flux divergence through temporal averaging or some coarse-graining is thus shown to be necessary. Through the application of this technique, SM is found to be correlated with the distribution of eddy kinetic energy. The contribution from vertical advection to SM is found to be relatively small and correlated with the distribution of buoyancy fluxes. The explored high-order schemes are found to demonstrate levels of spurious mixing which may locally exceed background physical mixing.

physics.ao-ph