Framework for Idealized Ocean Models
Project description
Framework for Idealized Ocean Models (FRIDOM)
-
Purpose & Flexibility: FRIDOM is a powerful and modular framework originally developed for running simulations of idealized ocean models. Thanks to its modular design, it can be used to simulate any model represented by a set of partial differential equations, such as $\partial_t \boldsymbol{z} = \boldsymbol{f}(\boldsymbol{z}, t)$.
-
Minimizing Boilerplate Code: To streamline the development process, FRIDOM provides base classes for common components like grids, differential and interpolation operators, time-stepping schemes, netCDF output, animations, etc.
-
Easy Model Modifications: Every component of a model in FRIDOM is fully exchangeable without changing the model's source code. This feature makes FRIDOM an excellent sandbox for testing new ideas and a useful tool for educational purposes.
-
Balancing Flexibility & Usability: While modular frameworks often compromise user-friendliness for flexibility, FRIDOM strives to be both flexible and easy to use. It offers a high-level API, comprehensive tutorials, and numerous examples available within the documentation.
-
Performance through Python & JAX: Written in Python for ease of use, FRIDOM overcomes Python's performance limitations by leveraging the Just-In-Time (JIT) compiler from JAX. This approach allows FRIDOM to achieve speeds comparable to compiled languages like Fortran or C, and it can further accelerate simulations by running on GPUs.
NOTE: FRIDOM is in en early development stage, and as such, it may undergo significant changes.
Documentation
Learn more about FRIDOM in its official documentation.
Installation
To install FRIDOM from the source code repository, clone the repository in your desired directory and install the package using pip:
git clone https://github.com/Gordi42/FRIDOM
cd FRIDOM
pip install -e '.[jax-cuda]'
see here for more information on the installation.
Example
The following example showcases a simulation run in the shallow water model. The initial condition is a jet that is barotropic instable. The instabilities grow and form vortices.
import fridom.shallowwater as sw
# Create the grid and model settings
grid = sw.grid.cartesian.Grid(N=(256,256), L=(1,1), periodic_bounds=(True, True))
mset = sw.ModelSettings(grid=grid, f0=1, csqr=1)
mset.time_stepper.dt = 0.7e-3
mset.setup()
# Create the initial condition
z = sw.initial_conditions.Jet(mset, width=0.1, wavenum=2, waveamp=0.05)
# Create the model and run it
model = sw.Model(mset)
model.z = z # set the initial condition
model.run(runlen=2.5)
# Plot the final total energy (kinetic + potential)
model.z.etot.xr.plot(cmap="RdBu_r")
List of available models
- nonhydro: A 3D pseudo-spectral non-hydrostatic Boussinesq model adapted from ps3d.
- shallowwater: A 2D rotating shallow water model.
Parallelization
Although the basic structure for parallelization is already prepared, FRIDOM does not yet support parallelization. We plan to parallelize the framework using jaxDecomp. Nevertheless, thanks to its compatibility with GPUs, simulations with grid sizes on the order of (10^6) grid points—such as (512^3) or (8192^2) grid points—can already be run in a reasonable amount of time.
Alternatives
FRIDOM draws inspiration from several existing modeling frameworks and tools, which have influenced its design and capabilities. Some notable inspirations include:
-
Oceananigans.jl: A very powerfull ocean model written in Julia with CPU and GPU support. Oceananigans is suitable for both idealized and realistic ocean setups.
-
pyOM2: An ocean model written in Fortran with many available parameterizations and closudes.
-
Veros: A python implementation of
pyOM2that runs on CPUs and GPUs using JAX. -
ps3D: A pseudo spectral non-hydrostatic incompressible flow solver written in Fortran.
-
Shenfun: A python framework for solving systems of partial differential equations using the spectral Galerkin method.
Gallery
https://github.com/Gordi42/FRIDOM/assets/118457787/66cca07d-5893-4c1b-af13-901dc78bdd6b
Roadmap
Todos for version 0.1.0:
- parallelization using jaxDecomp
- make mpi4py dependency optional
- adapt shallowwater to new model structure
- adapt optimal balance to new model structure
- make NNMD work
- fix the CG pressure solver in nonhydro model
- increase test coverage to at least 90%
- adjust code to linting standards
Long term Todos:
Grid:
- Add a rectilinear grid with variable $\Delta x(x)$
- Add a (pseudo) spherical grid
- Add unstructured grids.
Models:
- Add a hydrostatic primitive equations model (like pyOM2)
- Add a quasi-geostrophic model
- Add a compressible flow solver
Time Steppers:
- Adding implicit and semi implicit time steppers
Advection Schemes:
- Add higher order advection schemes like WENO
Others:
- Optimize parallelization for CPUs
- Add possibility to couple multiple fridom models
How to cite
@software{Rosenau_fridom_2024,
author = {Rosenau, Silvano Gordian},
doi = {10.5281/zenodo.14536979},
month = dec,
title = {{Fridom: A framework for idealized ocean models.}},
url = {https://github.com/Gordi42/fridom},
version = {0.0.1},
year = {2024}
}
Author
* Silvano Rosenau
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fridom-0.0.5.tar.gz.
File metadata
- Download URL: fridom-0.0.5.tar.gz
- Upload date:
- Size: 152.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2a993fb076d84f4331e8ccc937561ac1ccab9c51747f7ad44525b8ab511fa78
|
|
| MD5 |
7a04f8dc2a541404811c36de317ed242
|
|
| BLAKE2b-256 |
c379160dba3e70b7335aec5ac6b7fcdfd4445feb7ec3535c217a3eea42ba9798
|
Provenance
The following attestation bundles were made for fridom-0.0.5.tar.gz:
Publisher:
publish-to-test-pypi.yml on Gordi42/fridom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fridom-0.0.5.tar.gz -
Subject digest:
c2a993fb076d84f4331e8ccc937561ac1ccab9c51747f7ad44525b8ab511fa78 - Sigstore transparency entry: 167503268
- Sigstore integration time:
-
Permalink:
Gordi42/fridom@36c704940671764436fa2550a46efd197c66d808 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/Gordi42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@36c704940671764436fa2550a46efd197c66d808 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fridom-0.0.5-py3-none-any.whl.
File metadata
- Download URL: fridom-0.0.5-py3-none-any.whl
- Upload date:
- Size: 208.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04a1ea990eb905e04924b44a0510854bdcf9cb7058b41a5a711b07e219598ea5
|
|
| MD5 |
dec044a7f4945e91ca98b58aa0b00533
|
|
| BLAKE2b-256 |
cac6db2ca7d277ae59ed718d0371ca2629f4d186e17990b8d9f912d2b4e3e41e
|
Provenance
The following attestation bundles were made for fridom-0.0.5-py3-none-any.whl:
Publisher:
publish-to-test-pypi.yml on Gordi42/fridom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fridom-0.0.5-py3-none-any.whl -
Subject digest:
04a1ea990eb905e04924b44a0510854bdcf9cb7058b41a5a711b07e219598ea5 - Sigstore transparency entry: 167503270
- Sigstore integration time:
-
Permalink:
Gordi42/fridom@36c704940671764436fa2550a46efd197c66d808 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/Gordi42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@36c704940671764436fa2550a46efd197c66d808 -
Trigger Event:
push
-
Statement type: