Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add convenience constructors for grids #1567

Closed
wants to merge 6 commits into from
Closed

Conversation

simonbyrne
Copy link
Member

cc @Sbozzolo

  • Code follows the style guidelines OR N/A.
  • Unit tests are included OR N/A.
  • Code is exercised in an integration test OR N/A.
  • Documentation has been added/updated OR N/A.

@simonbyrne
Copy link
Member Author

The first question is: what should we name the aliases? Currently I've gone with the simplest possible names I could come up with:

  • ColumnGrid for a single column in the z direction
    • requires renaming an existing object, but that wasn't exported
  • PlaneGrid for a XZ plane
  • BoxGrid for a XYZ box
  • ExtrudedCubedSphereGrid for a cubed sphere
    • any thoughts on a simpler name?

One question is whether we should be a bit more specific on the names:

  • should we include the coordinate in the names (say XZPlaneGrid instead of PlaneGrid?)
  • should we include the discretization type (FDColumnGrid, FDSEPlaneGrid?)

@simonbyrne
Copy link
Member Author

  • PlaneGrid for a XZ plane

@OsKnoth suggested calling a SliceGrid

@simonbyrne
Copy link
Member Author

simonbyrne commented Dec 4, 2023

The other interface questions:

  • how to handle stretching: currently I have a z_stretch argument (not dz_X args like in ClimaAtmos). Default is Uniform()
  • topography is not yet handled, but will probably be a single argument (topography=Flat() default)

@simonbyrne
Copy link
Member Author

I am a bit reluctant to simply call it a CubedSphereGrid, as a sphere is defined as a 2D manifold, not a 3D object. The domain we're operating in is usually called a spherical shell.

Some options:

  • CubedSphere3DGrid
  • CubedSphereShellGrid

@Sbozzolo
Copy link
Member

Sbozzolo commented Dec 4, 2023

I am a bit reluctant to simply call it a CubedSphereGrid, as a sphere is defined as a 2D manifold, not a 3D object. The domain we're operating in is usually called a spherical shell.

Some options:

  • CubedSphere3DGrid
  • CubedSphereShellGrid

CubedSphere3DGrid would be different from all the other ones and invites the question of "what about CubedSphere2DGrid. CubedSphereShellGrid is good enough (better than ExtrudedCubedSphereGrid in my opinion).
I'd dare to say that maybe it could be just SphereShellGrid. While technically incorrect, the word Cubed conveys no extra meaning once it is established that all the spherical shells in ClimaCore/ClimaAtmos are always cubed.

@OsKnoth
Copy link

OsKnoth commented Dec 4, 2023

Cubed Sphere Grid is used in the community, it is a discrete manifold, which approximates the sphere, also extruded grid is used normally, in all cases we start with two-dimensional manifolds and than go to the third dimension, furthermore this construction is connected to the function spaces (spectral versus piecewise constant in the third dimension, or piecewise linear for w), it makes no sense to look for new namings outside the community.

@simonbyrne
Copy link
Member Author

@Sbozzolo any more thoughts on this?

@Sbozzolo
Copy link
Member

@Sbozzolo any more thoughts on this?

Can you please provide a short description on how I would go about identifying the Grid that is being used (e.g., for dispatch in ClimaAtmos)?

@simonbyrne
Copy link
Member Author

f(grid::Grids.PlaneGrid) = ...
f(grid::Grids.BoxGrid) = ...
f(grid::Grids.ExtrudedCubedSphereGrid) = ...

@Sbozzolo
Copy link
Member

f(grid::Grids.PlaneGrid) = ...
f(grid::Grids.BoxGrid) = ...
f(grid::Grids.ExtrudedCubedSphereGrid) = ...

Are we going with Plane or Slice?

I still think that ExtrudedCubedSphereGrid, while descriptive, is unnecessarily complex for an important user-facing type. (But I am fine keeping it).

As a next step, we should implement accessors: it should be trivial to get the radius from a sphere, the heigth of a column, and so on.

@simonbyrne
Copy link
Member Author

I still think that ExtrudedCubedSphereGrid, while descriptive, is unnecessarily complex for an important user-facing type. (But I am fine keeping it).

How about CubedSphereShellGrid?

@simonbyrne
Copy link
Member Author

Okay, I've renamed them.

@@ -66,6 +70,50 @@ end
IntervalDomain(coords::ClosedInterval; kwargs...) =
IntervalDomain(coords.left, coords.right; kwargs...)


function XIntervalDomain(;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sbozzolo what do you think about adding doc strings to all of these convenience constructors, so that users know what the kwargs are? I think just copying the code itself into the doc string should be pretty self explanatory, and it'll be easy to keep up-to-date.

@szy21
Copy link
Member

szy21 commented Apr 1, 2024

@charleskawczynski What is the status of this PR?

@charleskawczynski
Copy link
Member

I need to rebase this, and make a few changes

@charleskawczynski
Copy link
Member

Superseded by #1848.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants