A PyTorch 1D QBO model.
The essential components of the code include:
adsolver.ADSolver
: a class for solving a forced advection-diffusion equation in one space dimension.utils.load_model
: a utility for loading a Pytorch model, defined by aModelClass
and astate_dict
, and containing the source term.
Features:
- Can be forced using a spectrum of waves.
- Can use backpropagation to optimize model parameters to a desired outcome.
The code requires (imports) PyTorch, NumPy, Matplotlib, and SciPy. To enjoy the
example notebook you will also need Jupyter Notebook. A tested environment is
provided in qbo1d-environment-spec-file.txt
and can be replicated as follows:
conda create --name qbo1d --file qbo1d-environment-spec-file.txt
conda activate qbo1d
Please refer to the Documentation.
A working example is provided in the example.ipynb
notebook. Here is a figure.
The forcing in the figure consists of two waves of equal and opposite
amplitudes ± 6 mPa, opposite phase speeds ± 32 m s-1,
and equal wavenumbers 1. The vertical advection in this case equals
10-5 m s-1. Note, the figure shows the
last 12 years of a 96 year long integration. The amplitudes and period
estimates were estimated after 12 years of spinup.