fridom

A numerical framework to create and run ocean models

https://github.com/gordi42/fridom

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.5%) to scientific vocabulary
Last synced: 7 months ago · JSON representation ·

Repository

A numerical framework to create and run ocean models

Basic Info
Statistics
  • Stars: 7
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Created over 2 years ago · Last pushed 12 months ago
Metadata Files
Readme License Citation

README.md

License: MIT Docs codecov DOI

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:

bash 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.

``` python import fridom.shallowwater as sw

Create the grid and model settings

grid = sw.grid.cartesian.Grid(N=(256,256), L=(1,1), periodicbounds=(True, True)) mset = sw.ModelSettings(grid=grid, f0=1, csqr=1) mset.timestepper.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="RdBur") ``` <img src="media/ShallowWater/shallowwater_example.png" />

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 pyOM2 that 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
  • [x] make mpi4py dependency optional
  • [x] adapt shallowwater to new model structure
  • [x] adapt optimal balance to new model structure
  • [x] 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

MIT

Owner

  • Login: Gordi42
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: "Rosenau"
    given-names: "Silvano Gordian"
    orcid: "https://orcid.org/0000-0002-8157-2574"
title: "Fridom: A framework for idealized ocean models."
version: 0.0.1
identifiers:
doi: 10.5281/zenodo.14536979
date-released: 2024-12-20
url: "https://github.com/Gordi42/fridom"

GitHub Events

Total
  • Release event: 2
  • Watch event: 5
  • Delete event: 2
  • Push event: 57
  • Fork event: 1
  • Create event: 5
Last Year
  • Release event: 2
  • Watch event: 5
  • Delete event: 2
  • Push event: 57
  • Fork event: 1
  • Create event: 5

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 13 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
pypi.org: fridom

Framework for Idealized Ocean Models

  • Documentation: https://fridom.readthedocs.io/
  • License: MIT License Copyright (c) 2023 Silvano Rosenau Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.0.5
    published about 1 year ago
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 13 Last month
Rankings
Dependent packages count: 9.7%
Stargazers count: 27.5%
Average: 30.9%
Forks count: 31.9%
Dependent repos count: 54.5%
Maintainers (1)
Last synced: 7 months ago