A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

OceanMesh2D

Precise distance-based two-dimensional automated mesh generation toolbox intended for coastal ocean/shallow water flow models.
https://github.com/chlnddev/oceanmesh2d

Category: Hydrosphere
Sub Category: Coastal and Reefs

Keywords

coastal-modelling geophysics meshes multiscale-simulation open-source shallow-water-equations

Keywords from Contributors

adcirc noaa

Last synced: about 12 hours ago
JSON representation

Repository metadata

A two-dimensional triangular mesh generator with pre- and post-processing utilities written in pure MATLAB (no toolboxes required) designed specifically to build models that solve shallow-water equations or wave equations in a coastal environment (ADCIRC, FVCOM, WaveWatch3, SWAN, SCHISM, Telemac, etc.).

README.md

Precise distance-based two-dimensional automated mesh generation toolbox intended for coastal ocean/shallow water flow models

[!NOTE]
This is the default and recommended PROJECTION branch. Please use it unless you otherwise require legacy (MASTER branch) or the absolute newest features (DEV branch).

[!WARNING]
The boundary of the meshing domain must be a polygon (first point equals the last and non-self intersecting) but it does not need to be simplified. Read the user guide for more information about the inputs.

Table of contents

OceanMesh2D is a set of user-friendly MATLAB functions to generate two-dimensional (2D) unstructured meshes for coastal ocean circulation problems. These meshes are based on a variety of feature driven geometric and bathymetric mesh size functions, which are generated according to user-defined parameters. Mesh generation is achieved through a force-balance algorithm combined with a number of topological improvement strategies aimed at improving the worst case triangle quality. The software embeds the mesh generation process into an object-orientated framework that contains pre- and post-processing workflows, which makes mesh generation flexible, reproducible, and script-able.

Getting help

[!TIP]
PLEASE READ THE USER GUIDE! A recent pdf of the user guide is located in this branch. For a continually updated version click here (wait for compilation and then click download PDF)

Besides posting issues with the code on Github, you can also ask questions via our Slack channel here.

Note: If the slack link invite isn't working, please send either one of us and an email and we'll fix it. By default, the invite link expires every 30 days.

Otherwise please reach out to either Dr. William Pringle ([email protected]) or Dr. Keith Roberts ([email protected]) with questions or concerns or feel free to start an Issue in the issues tab above.

Contributing

All contributions are welcome!

To contribute to the software:

  1. Fork the repository.
  2. Clone the forked repository, add your contributions and push the changes to your fork.
  3. Create a Pull request

Before creating the pull request, make sure that the examples pass...

Some things that will increase the chance that your pull request is accepted:

  • Write minimal working examples that demonstrate the functionality.
  • Write good commit and pull request messages.

Code framework

OceanMesh2D consists of four standalone classes that are called in sequence. It requires no paid toolboxes to build meshes and has been tested to work with a trial version of MATLAB.

OceanMesh2D::
├── geodata -- process geospatial data.
├── edgefx  -- build mesh size functions.
├── meshgen -- generate mesh based on mesh size functions and boundaries.
└── msh     -- store, write, read, inspect, and visualize meshes and their
               axuillary components for numerical simulation.

Starting Out

  1. Clone or download and unzip the current repository.

  2. Run the setup.sh bash script or setup.bat batch script to download the required m_map package and the base datasets:

    • GSHHG global shoreline
    • SRTM15_PLUS global topobathy DEM
  3. Create or modify startup.m file located under your home folder by executing command in MATLAB:

    edit(fullfile(userpath,'startup.m'))
    

    And add the line:

    run(<PATH_TO_OCEANMESH2D>/setup_oceanmesh2d.m)
    

    Replace <PATH_TO_OCEANMESH2D> with the folder name where you cloned/unzipped the repository.

  4. Restart MATLAB to get paths added.

Additional data required for some of the following examples must be downloaded manually from Zenodo. Specifically, Examples 2, 3, 4, 5 and 5b require additional datasets from the google drive folder while base datasets are sufficient for the other examples.

Featured in  ┌── Examples/Example_1_NZ.m   -- A simple mesh around South Island
             |                                New Zealand that uses GSHHS shoreline.
user guide   ├── Examples/Example_2_NY.m   -- A high-resolution mesh around
             |                                the New York/Manhattan area that uses a DEM
             |                                created from LiDAR data.
             └── Examples/Example_3_ECGC.m -- Builds a mesh for the western North Atlantic
                                              with a local high-resolution nest around New York

Featured in         ┌── Examples/Example_4_PRVI.m -- Builds a mesh for the western North Atlantic
                    |                                with three high-resolution nests around
Geoscientific Model |                                Puerto Rico and US Virgin Islands
                    ├── Examples/Example_5_JBAY.m -- An extremely high-fidelity (15-m) mesh from
Development paper[1]|                                LiDAR data around Jamaica Bay with CFL-limiting.
                    └── Examples/Example_6_GBAY.m -- An example of the polyline/thalweg mesh size
                                                     function along the Houston Ship Channel.

See Testing to test OceanMesh2D on your system.

Testing

To ensure the software is fully functional on your system before building some crazy meshes it is strongly recommended to run the tests (RunTests.m) in the Tests/ directory.

We test all pull requests using this test suite on a local host before accepting. For substantial pull requests we will also test the Examples from the Examples/ directory.

References!

If you make use of OceanMesh2D please include a reference to [1], and to any of [2]-[5] if pertinent (latex .bib file). We would also appreciate using our logo in a presentation featuring OceanMesh2D.


[1] - Roberts, K. J., Pringle, W. J., and Westerink, J. J., 2019.
      OceanMesh2D 1.0: MATLAB-based software for two-dimensional unstructured mesh generation in coastal ocean modeling,
      Geosci. Model Dev. (GMD), https://doi.org/10.5194/gmd-12-1847-2019.
[2] - Roberts, K. J., Pringle, W. J, 2018.
      OceanMesh2D: User guide - Precise distance-based two-dimensional automated mesh generation toolbox intended for coastal
      ocean/shallow water. https://doi.org/10.13140/RG.2.2.21840.61446/2.
[3] - Roberts, Keith J. Unstructured Mesh Generation and Dynamic Load Balancing for Coastal Ocean Hydrodynamic Simulation, 2019.
      PhD Thesis, University of Notre Dame. https://curate.nd.edu/show/4q77fr0022c.
[4] - Roberts, Keith J., Pringle W.J., Westerink J. J. Contreras, M.T., Wirasaet, D., 2019.
      On the automatic and a priori design of unstructured mesh resolution for coastal ocean circulation models,
      Ocean Modelling, 144, 101509. https://doi.org/10.1016/j.ocemod.2019.101509.
[5] - Pringle, W. J., Wirasaet, D., Roberts, K. J., and Westerink, J. J., 2021.
      Global Storm Tide Modeling with ADCIRC v55: Unstructured Mesh Design and Performance,
      Geoscientific Model Development, 14(2), 1125-1145. https://doi.org/10.5194/gmd-14-1125-2021.

In addition, best practice when using software in a scientific publication is to cite the permanent doi corresponding to the version used (e.g., for reproducibility). All our releases are archived at the following Zenodo repository doi link.

Authors (202X). CHLNDDEV/OceanMesh2D: OceanMesh2D VX.X. Zenodo. https://doi.org/10.5281/zenodo.1341384

Please fill in the version (VX.X), author list and year corresponding to the version used.

We would also like to acknowledge various scripts and algorithms from mesh2d included in OceanMesh2D that have been developed by @dengwirda. Please also see JIGSAW-GEO:

[i] - Engwirda, D., 2017.
      JIGSAW-GEO (1.0): Locally orthogonal staggered unstructured grid generation for general circulation modelling on the sphere.
      Geoscientific Model Development, 10(6), 2117–2140. https://doi.org/10.5194/gmd-10-2117-2017.

GALLERY:

  • These images can be made by running the examples
  • The following images are provided from happy users. Please send us your meshes.

Jiangchao Qiu from his publication.

Changelog

The format is based on Keep a Changelog

Unreleased (on current HEAD of the Projection branch)

Fixed

  • User inputted edge constraints are now saved when no weirs are being constrained during mesh generation.

Added

Changed

[6.0.0] - 2024-02-28

Added

Changed

Fixed

[5.0.0] - 2021-07-29

Added

Fixed

Changed

[4.0.0] - 2021-03-14

Added

  • mesh2d interface improvements to filter small polygons.
  • Support for creation of fort.20 files for forcing rivers by @Jiangchao3
  • Mesh "cleaning" modes moderate and aggressive transfer nodal attributes via improvements to msh.map_mesh_properties
  • msh.remove_attribute() method to remove f13 attribute(s)
  • new msh.interp() slope_calc kwarg option to set the method of computing the topographic gradients (slopes), either rms [default] or abs
  • new extract_subdomain() keep_numbering kwarg option to keep the full mesh triangulation numbering on the subdomain [off by default].

Changed

  • msh.plot() overhaul. All options specified via kwarg.
  • msh.plot() option subset option is now called subdomain
  • msh.plot() arbitary f13 option now utilizes colormap kwarg
  • utilities/extract_subdomain now is called with kwargs.
  • Cleaning up msh.bound_courant_number() to use msh.get_boundary_of_mesh() for Delaunay-triangulation and allowing msh.clean() to do the transfer of attributes automatically.
  • msh.plus(obj1,obj2) can now carry over obj2 f13 attributes if also exist in obj1
  • msh() more efficient storing of boundary conditions read in from fort.xx files, and msh.write() can write out arbitrary vertex indices (instead of just 1 to NP).

Fixed

  • Boundary labeling fix
  • Prompt when labeling bcs using outer kwarg in make_bc
  • fix for boundary condition mapping in msh.map_mesh_properties() especially for weirs/barriers
  • fix for barrier mapping in msh.plus() routine
  • fix for msh.make_bc(m,auto,gdat) where gdat is empty. In this case it uses the depths on the mesh to determine the open boundaries.
  • check for poly2ccw mapping toolbox function in kml2struct
  • fix for msh.plot() on log colormap when plotting f13 attributes

Deleted

  • Deprecating msh.CheckTimestep() for msh.bound_courant_number. Added error message and instruction in the CheckTimestep help

[3.3.0] - 2020-12-21

Fixed

  • Users without mapping toolbox could not read in shapefiles because of a bug that
    made them required to have a 3d shapefiles.
  • plotting gdat with no shoreline.
  • plotting a mesh's bathymetry with a non-zero datum using cmocean.
  • cell-averaging interpolation method in msh.interp fixed for unequal lon-lat DEM grid spacings

Added

  • Mesh patch smoother
  • Ability to remesh abritary patches of elements within the domain while respecting user-defined mesh sizes and the patches boundaries.
  • Ability to use the TPXO9 Atlas for the tidal bcs and sponge (inside tidal_data_to_ob.m and Calc_Sponge.m) by using '**' wildcards in place of the constituent name within the tidal atlas filename (the atlas has an individual file for each constituent).
  • Introducing 'auto_outer' option for the make_bc msh method which populates the bc for the outermost mesh boundary polygon (ignores islands)
  • Changelog to README
  • "mapMeshProperties" msh method ports over mesh properties for a mesh subset
  • 'invert' option in the msh.interp method to turn off the DEM value inversion typically performed

Changed

  • for the make_bc msh method 'auto'/'auto_outer' options, allowing for the 'depth' method of classification to use the interpolated depths on the mesh if gdat is empty.
  • improving help for make_bc msh method, Make_f15.m and Calc_Sponge.m
  • renamed "ExtractSubDomain.m" to "extract_subdomain.m"
  • improving "extract_subdomain.m" help and facilitating NaN-delimited polygons
  • ability to return boundary as a cell in "get_boundary_of_mesh" msh method
  • "Example_1_NZ.m" includes example of plotting bcs of a msh subset
  • using "mapMeshproperties" method in "fixmeshandcarry"
  • using "fixmeshandcarry" in the "cat" msh method
  • improving warning and error messages for the "interp" msh method
  • adding geofactor into "writefort15" for the GAHM vortex model

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 7 days ago

Total Commits: 638
Total Committers: 18
Avg Commits per committer: 35.444
Development Distribution Score (DDS): 0.456

Commits in past year: 7
Committers in past year: 4
Avg Commits per committer in past year: 1.75
Development Distribution Score (DDS) in past year: 0.714

Name Email Commits
William Pringle w****e@n****u 347
Keith Roberts k****0@n****u 171
Keith Roberts k****r@u****r 60
Keith Roberts k****r@u****u 16
CHLNDDEV 4****V 16
Jiangchao Qiu q****3@m****n 4
Keith Roberts k****s@b****m 4
krober10 k****0@g****m 4
Oleg Mouraenko 4****o 3
Zach Cobell z****l@g****m 2
T t****r 2
kentonwho w****n@g****m 2
cblakely97 4****7 2
William Pringle w****e@b****v 1
Alexander Rey m****l@a****a 1
David Honegger d****r@g****m 1
Felix Santiago-Collazo f****o@u****u 1
Shintaro Bunya s****a@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 75
Total pull requests: 57
Average time to close issues: 5 months
Average time to close pull requests: 2 months
Total issue authors: 30
Total pull request authors: 11
Average comments per issue: 3.83
Average comments per pull request: 2.3
Merged pull request: 47
Bot issues: 0
Bot pull requests: 0

Past year issues: 12
Past year pull requests: 7
Past year average time to close issues: 20 days
Past year average time to close pull requests: 2 months
Past year issue authors: 7
Past year pull request authors: 3
Past year average comments per issue: 4.0
Past year average comments per pull request: 2.14
Past year merged pull request: 5
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/chlnddev/oceanmesh2d

Top Issue Authors

  • krober10nd (19)
  • Jiangchao3 (11)
  • jalal-90 (6)
  • WPringle (4)
  • aribal2018 (3)
  • tc-ecoast (3)
  • soloyant (3)
  • q1165600785 (3)
  • 123jk26 (2)
  • Liu-Jincan (1)
  • SuRu-1310 (1)
  • almirnunes (1)
  • ablairification (1)
  • oceanywalker (1)
  • shahab271069 (1)

Top Pull Request Authors

  • krober10nd (25)
  • WPringle (20)
  • omouraenko (3)
  • Jiangchao3 (2)
  • kentonwho (1)
  • IshidaKota (1)
  • shinbunya (1)
  • tgasher (1)
  • alexander0042 (1)
  • dahonegger (1)
  • fsanti1 (1)

Top Issue Labels

  • enhancement (12)
  • bug (4)
  • help wanted (4)
  • question (3)
  • wontfix (1)
  • invalid (1)

Top Pull Request Labels

  • enhancement (2)

Score: 8.337109129562474