Skip to content
New issue

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

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

Already on GitHub? # to your account

Add MOM5 kernel #8

Closed
rabernat opened this issue Jan 12, 2021 · 9 comments
Closed

Add MOM5 kernel #8

rabernat opened this issue Jan 12, 2021 · 9 comments
Labels
kernels Related to low-level kernels

Comments

@rabernat
Copy link
Contributor

cc @LaureZanna, as discussed on Slack

@rabernat rabernat added the kernels Related to low-level kernels label Jan 12, 2021
@rabernat
Copy link
Contributor Author

rabernat commented Jan 21, 2021

The package is ready to have laplacians added to it. They should be added to this file:

https://github.com/ocean-eddy-cpt/gcm-filters/blob/master/gcm_filters/kernels.py

There are three things that need to be added in that file:

  1. A new class (e.g. MOM5Laplacian), which inherits from BaseLaplacian. Any auxiliary grid variables (e.g. tarea, dx, dy, etc.) should be attributes of the class. The actual laplacian should be coded in the __call__ method and have only a single argument.
  2. Define a new GridType here:
    GridType = enum.Enum("GridType", ["CARTESIAN", "CARTESIAN_WITH_LAND"])

    Maybe something like MOM_GRID
  3. Then add the laplacian to the ALL_KERNELS dictionary, like this
    ALL_KERNELS[GridType.CARTESIAN_WITH_LAND] = CartesianLaplacianWithLandMask

Then the kernel will automatically get tested in the test_kernels.py module.
However, it probably won't work unless you define special options for the grid_vars, as here

if grid_type == GridType.CARTESIAN_WITH_LAND:
mask_data = np.ones_like(data)
mask_data[: (ny // 2), : (nx // 2)] = 0
extra_kwargs["wet_mask"] = mask_data

For the tests, we will need to decide about #5. I have some ideas about that I'll share in that issue.

cc @LaureZanna, @ElizabethYankovsky

@rabernat
Copy link
Contributor Author

@jbusecke maybe you could give a quick overview of the development process

  • running tests locally
  • pre-commit
  • docstrings

@ElizabethYankovsky
Copy link
Contributor

@rabernat - Thanks for cc-ing! Laure, her postdoc Arthur, and I have been discussing the formulation of the Laplacian in MOM5 and will contribute to this

@jbusecke
Copy link
Collaborator

Sure thing. Where should that go? As a docs page?

@rabernat
Copy link
Contributor Author

Sure thing. Where should that go? As a docs page?

I was thinking just a comment on github, but a contributor guide on the docs is probably more robust. Could probably just be copy-pasted from one of our other projects.

@jbusecke
Copy link
Collaborator

How detailed should this be with regard to git? Full step by step with add/commit/...?

@jbusecke
Copy link
Collaborator

Take a look at my PR #16

@LaureZanna
Copy link

Thanks a lot @rabernat and @jbusecke !

@iangrooms
Copy link
Member

I think our scalar Laplacians work for MOM5, and #106 is developing a vector Laplacian that should work for MOM5. Can we close this issue?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
kernels Related to low-level kernels
Projects
None yet
Development

No branches or pull requests

6 participants