CliMA / Oceananigans.jl

🌊 Julia software for fast, friendly, flexible, ocean-flavored fluid dynamics on CPUs and GPUs
https://clima.github.io/OceananigansDocumentation/stable
MIT License
963 stars 190 forks source link

Abstraction for vector fields #1585

Open ali-ramadhan opened 3 years ago

ali-ramadhan commented 3 years ago

Right now it's not trivial to set initial velocities or impose velocity boundary conditions (or forcing functions) since the i index does not point in the zonal direction (and j does not point in the meridional direction).

I think users will usually want to impose things on the "zonal" and "meridional" velocities, so an abstraction that allows the user to describe zonal and meridional velocities would be quite nice (and Oceananigans should be able to do the right thing on the backend).

This might come naturally with the idea of a VectorField that @glwagner has been mentioning.

This doesn't just apply to cubed sphere grids, but to curvilinear grids in general although right now we just have the cubed sphere as the lat-lon grid is aligned with the zonal and meridional directions.

glwagner commented 3 years ago

Can we generalize this issue to indicate a general abstraction for vectors?

We'll need this abstraction for a few purposes:

  1. Specifying boundary conditions on vector fields
  2. Specifying forcing functions on vector fields
  3. Specifying diagnostics / calculations on vector fields (?)
  4. Plotting / interpolating vector fields?

I think we only need an abstraction for two-dimensional vector fields. However, we already tuple together the velocity components. So it may make sense to design a three-dimensional abstraction, and limit it to two-dimensions if we need to.

glwagner commented 3 years ago

cc @simonbyrne

ali-ramadhan commented 3 years ago

Agreed. Changed the issue title to be more general.