Skip to content

Reorganize mesh creation#314

Merged
xylar merged 11 commits intoMPAS-Dev:masterfrom
xylar:reorg_mesh_creation
Sep 4, 2020
Merged

Reorganize mesh creation#314
xylar merged 11 commits intoMPAS-Dev:masterfrom
xylar:reorg_mesh_creation

Conversation

@xylar
Copy link
Collaborator

@xylar xylar commented May 28, 2020

This PR builds on #311 by performing some reorganization of mpas_tools.mesh.creation.

It includes:

  • Moving coastal_tools, inject_bathymetry, inject_meshDensity and inject_preserve_floodplain to mpas_tools.ocean, since these are ocean-specific tools.
  • inject_meshDensity had been broken into 3 functions, one for reading from a file and one each for taking numpy arrays that define spherical or planar meshes.
  • Splits out tools for computing signed-distance tools from coastal_tools, since the former are general to any component. These tools are now in mpas_tools.mesh.creation.signed_distance
  • Add earth_radius parameter to jigsaw_driver and a few other places so the Earth radius isn't hard coded with different values in different places
  • Break build_mesh into polar and spherical functions and move ocean-specific steps to a new module mpas_tools.ocean.build_mesh.

@xylar xylar self-assigned this May 28, 2020
@xylar
Copy link
Collaborator Author

xylar commented May 28, 2020

@pwolfram, @sbrus89, @dengwirda, @mark-petersen, and @proteanplanet, this is just a heads-up that I'm working on reorganizing the mesh creation tools to separate out ocean-specific pieces from generic ones that might be useful for other components. @dengwirda, you may want to take a look at this and, again, make sure it doesn't conflict with changes you'd like to make.

When things have progressed a big further and if there aren't major protests, I'll make a corresponding PR in MPAS-Model/ocean/develop to make the corresponding changes in existing COMPASS test cases.

@xylar xylar force-pushed the reorg_mesh_creation branch from 87b414f to b5f4905 Compare May 29, 2020 13:30
@xylar xylar force-pushed the reorg_mesh_creation branch from b5f4905 to 74776de Compare July 6, 2020 13:35
@xylar xylar force-pushed the reorg_mesh_creation branch 2 times, most recently from 7ca961f to df20f3f Compare August 27, 2020 09:43
@xylar xylar removed the don't merge label Aug 27, 2020
@xylar xylar marked this pull request as ready for review August 27, 2020 09:45
xylar added 11 commits August 31, 2020 13:10
Move several tools that are specifically for the ocean to
`mpas_tools.ocean`.

Tools related to defining signed distance functions have been
pulled out of `coastal_tools` and remain in
`mpas_tools.mesh.creation`, since they should be generally useful.

In the function lonlat2xyz, the radius has been added as an
optional parameter, and the Earth radius is now a required
parameter for signed distance functions.
Each function now takes as parameters the results of the function
in define_base_mesh, rather than calling that function.  This is
a much cleaner way to pass in the fields and gives users a lot
more flexibility.

Since bathymetry and floodplain are ocean-specific concepts, the
code for adding them has been moved to mpas_tools.ocean and isn't
appropriate to include in build_spherical_mesh anymore.  So
calling code will need to add these steps after calling
build_shperical_mesh.
Add a warning that build_mesh docs are now completely useless.
This particular meaning of meshDensity is a legacy of the
pre-JIGSAW method for mesh generation and is only used in the
ocean core.
This saves us from having to know the name of the output file
in cases where we don't need to write out and read back the
mesh density.
These add meshDensity and optionally add bathymetry and preserve
floodplain
mark-petersen added a commit to mark-petersen/MPAS-Model that referenced this pull request Sep 3, 2020
…velop

This merge updates COMPASS ocean test cases to make them compatible with
MPAS-Dev/MPAS-Tools#314.  This includes:
* Changing `define_base_mesh.py` to `build_base_mesh.py`, which calls
* `build_spherical_mesh()` explicitly (whereas the old `build_mesh`
* called the `cellWidthVsLatLon()` from `define_base_mesh`, which
* created a problematic import of a local module within `build_mesh`).
* Update imports to handle move of `coastal_tools` (other than
* `signed_distance` functions), `inject_bathymetry`,
* `inject_meshDensity` and `inject_preserve_floodplain` to
* `mpas_tools.ocean`

Affected test cases are (check mark indicates they have been updated):
- [x] `Gaussian_hump/USDEQU120cr10rr2/build_mesh/`
- [x] `coastal/Maine/init`
- [x] `coastal/USDEQU120cr10rr2/build_mesh`
- [x] `global_ocean/ARM60to10/init`
- [x] `global_ocean/CA120to3/build_mesh`
- [x] `global_ocean/EC60to30/init`
- [x] `global_ocean/EC60to30wISC/init`
- [x] `global_ocean/HI120to12/build_mesh`
- [x] `global_ocean/QU240/init`
- [x] `global_ocean/QU240wISC/init`
- [x] `global_ocean/SO60to10wISC/init`
- [x] `global_ocean/WC12/init`
- [x] `global_ocean/WC14/init`
- [x] `hurricane/USDEQU120at30cr10rr2/build_mesh`
- [x] `hurricane/USDEQU120at30cr10rr2WD/build_mesh`
- [x] `hurricane/USDEQU120at30cr10rr2WD_veg/build_mesh`
- [x] `hurricane/USDEQU240at60cr20rr4/build_mesh`
- [x] `hurricane/USDEQU240at60cr20rr4WD/build_mesh`
- [x] `hurricane/USDEQU240at60cr20rr4WD_veg/build_mesh`
- [x] `hurricane/USDEQU60at15cr5rr1/build_mesh`
- [x] `hurricane/USDEQU60at15cr5rr100WD/build_mesh`
- [x] `hurricane/USDEQU60at15cr5rr1WD/build_mesh`
- [x] `hurricane/USDEQU60at15cr5rr1WD_veg/build_mesh`
- [x] `hurricane/USDEQU60at15cr5rr250WD/build_mesh`
- [x] `hurricane/USDEQU60at15cr5rr500WD/build_mesh`
- [x] `tides/USDEQU120at30cr10/build_mesh`
@xylar xylar removed the request for review from dengwirda September 4, 2020 05:46
@xylar
Copy link
Collaborator Author

xylar commented Sep 4, 2020

@mark-petersen and @sbrus89, please always approve the associated MPAS-Tools changes like this PR along with the MPAS-Model PR. Again, I am reluctantly merging without your review because it was tacitly given in MPAS-Dev/MPAS-Model#577

@xylar xylar merged commit 1bb9625 into MPAS-Dev:master Sep 4, 2020
@xylar xylar deleted the reorg_mesh_creation branch September 4, 2020 05:47
mark-petersen added a commit to MPAS-Dev/MPAS-Model that referenced this pull request Sep 9, 2020
Update to version 0.1.11 of the compass environment #688

This brings in several changes from MPAS-Tools:

* Changes to make sure the Earth radius is consistent throughout COMPASS
  and `mpas_tools.ocean` by using the CIME value
  (MPAS-Dev/MPAS-Tools#347 and
  MPAS-Dev/MPAS-Tools#341)

* Improved performance for interpolation of meshDensity and bathymetry
  (MPAS-Dev/MPAS-Tools#344)

* Reorganization of `mpas_tools.mesh.creation`
  (MPAS-Dev/MPAS-Tools#314)
xylar pushed a commit to xylar/old_compass2 that referenced this pull request Oct 12, 2020
Update to version 0.1.11 of the compass environment #688

This brings in several changes from MPAS-Tools:

* Changes to make sure the Earth radius is consistent throughout COMPASS
  and `mpas_tools.ocean` by using the CIME value
  (MPAS-Dev/MPAS-Tools#347 and
  MPAS-Dev/MPAS-Tools#341)

* Improved performance for interpolation of meshDensity and bathymetry
  (MPAS-Dev/MPAS-Tools#344)

* Reorganization of `mpas_tools.mesh.creation`
  (MPAS-Dev/MPAS-Tools#314)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant