Skip to content

m2lines/ANN-momentum-buoyancy-mesoscale

 
 

Repository files navigation

ANN parameterization of mesoscale momentum and buoyancy fluxes in ocean model MOM6

This repository is a fork of m2lines/ANN-momentum-mesoscale that extends Pavel Perezhogin's training pipeline from momentum fluxes to buoyancy (ρ) fluxes. The buoyancy extension is developed by Dhruv Balwada with Pavel Perezhogin's help. The original momentum-flux work — paper figures, MOM6 implementation, online experiments — is unchanged from upstream and described below.


This repository contains training algorithm and MOM6 ocean model with implemented parameterization. Additionally, we include figure plotting notebooks for the paper "Generalizable neural-network parameterization of mesoscale eddies in idealized and global ocean models" by Pavel Perezhogin, Laure Zanna and Alistair Adcroft, to be submitted soon.

Example of online simulation with the proposed ANN parameterization in the idealized configuration NeverWorld2 of the MOM6 ocean model (full movie, code):

Example GIF

Online simulation in global ocean model OM4 (full movie, code):

Example GIF

Paper figures

In folder notebooks we show Jupyter notebooks for each Figure plotted in the paper.

Data

Training data, offline and online skill can be found on Zenodo.

Installation

git clone --recursive git@github.com:m2lines/ANN-momentum-mesoscale.git

MOM6 online experiments

Training ANN on global ocean data CM2.6

The ANN parameterization with local dimensional scaling is executed in Python code in training-on-CM2.6/helpers/state_functions.py.

  • Download training dataset from Zenodo.
wget https://zenodo.org/records/15328410/files/factor-15.zip
wget https://zenodo.org/records/15328410/files/factor-12.zip
wget https://zenodo.org/records/15328410/files/factor-9.zip
wget https://zenodo.org/records/15328410/files/factor-4.zip
  • Unpack dataset:
unzip factor-15.zip
unzip factor-12.zip
unzip factor-9.zip
unzip factor-4.zip

Training algorithm and evaluation

Training loop is executed on CPUs via the following script and takes ~9 hours on 4CPU cores and 64GB memory:

cd src/training-on-CM2.6/scripts/
python train_script.py

This script contains the default hyperparameters used in the paper. The skill on the testing dataset will be available in {path_save}/skill-test/factor-{factor}.nc and log of training/validation losses in {path_save}/model/logger.nc.

How training data was generated

In case you want to recreate training data yourself instead of downloading it from Zenodo, here are the instructions.

Downloading raw CM2.6 data

cd src/training-on-CM2.6/scripts/
python download_raw_data.py

Filtering and coarsegraining

cd src/training-on-CM2.6/scripts/
python generate_3d_datasets.py --factor=4
  • Provide the path to newly generated coarse datasets in cm26.py

Filtering and offline analysis in idealized configuration NW2

Filtered dataset with diagnosed subfilter fluxes in idealized configuration NW2 is constructed using scripts filter-NW2-data.py and filter-interfaces-GM-filter.py. Second script is optional and used only to more accurately estimate APE in outcropping regions. Offline prediction of subfilter fluxes and evaluation of offline skill is present in notebook offline-analysis-NW2.ipynb.

Training ANN on buoyancy fluxes (this fork)

The buoyancy-flux pipeline mirrors the momentum-flux pipeline above: same coarsened CM2.6 datasets, same ANN architecture, with a separate training routine targeting subfilter ρ-fluxes.

Run training:

cd src/training-on-CM2.6/scripts/
python train_script_rho_fluxes.py
# or via Slurm:
sbatch slurm_train_ann.sh

About

Source code and figure plotting for paper "Generalizable neural-network parameterization of mesoscale eddies in idealized and global ocean models"

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages