Ocean Model Domain-Specific Language

Concept

At the Bornö 2015 CFD workshop, the eScience group with Brian Vinter presented a concept for a ocean/climate modelling domain-specific language.

image

Input

With an ocean model DSL, writing and developing an ocean model requires only these steps:

  1. Define a system of equations for the ocean model (shallow water, ..., primitive equations, ...?) in some high-level conceptual language (to start with, we will use Python instead)
  2. Specify a domain in terms of geometry and boundaries (global/regional ocean or idealized basins with/without topography)
  3. Specify a discretization (unstructured grids, regular grids, ...)
  4. Specify the target: What should be included in the output? Data postprocessing (online/offline)?

Automatized model generation

The system will then automatically

  1. Select the optimal numerical method to solve the equations (although user input can be respected, too)
  2. Generate code for fast execution, using the Bohrium backend, on any infrastructure.

Example Model

Example set of governing equations and boundary conditions for an ocean model (primitive equations)

Prognostic variables

\[u, v, w, \rho, T, S, p\]

Forcings / knowns

\[\rho_0, \alpha, \beta, \kappa, f, g, H, \mathrm{precip}\]

Time derivatives

\[u_t + u u_x - fv = \frac1\rho_0 p_x + \kappa u_{xx}\]

\[v_t + u v_x + fu = \frac1\rho_0 p_y + \kappa v_{yy}\]

\[T_t + \vec{u} \nabla \vec{T} = Q\]

\[S_t + \vec{u} \nabla \vec{S} = \mathrm{precip}\]

Diagnostic relations

\[p = \int_z^\eta \, \rho \, g \, dz\]

\[\rho = \rho_0 (1 + \beta S - \alpha T)\]

\[K = f(\rho, h, \dots)\]

This could be formulated in various ways, e.g. computed from high-res non-hydrostatic slices (super-parameterization), a coarser run, or another model run

Conservation laws

\[u_x + v_y + w_z = 0\]

Boundary conditions

Initial conditions

Interfaces

Implementation in the DSL

To do