Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

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.).

License

NotificationsYou must be signed in to change notification settings

CHLNDDEV/OceanMesh2D

Repository files navigation

OceanMesh2D

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

Note

This is the default and recommendedPROJECTION 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 clickhere (wait for compilation and then click download PDF)

Besides postingissues with the code on Github, you can also ask questions via our Slack channelhere.

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 (wpringle@anl.gov) or Dr. Keith Roberts (keithrbt0@gmail.com) 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 aPull 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 workingexamples 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 currentrepository.

  2. Run thesetup.sh bash script orsetup.bat batch script to download the requiredm_map package and the base datasets:

    • GSHHG global shoreline
    • SRTM15_PLUS global topobathy DEM
  3. Create or modifystartup.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 fromZenodo. 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 YorkFeatured in         ┌── Examples/Example_4_PRVI.m -- Builds a mesh for the western North Atlantic                    |                                with three high-resolution nests aroundGeoscientific Model |                                Puerto Rico and US Virgin Islands                    ├── Examples/Example_5_JBAY.m -- An extremely high-fidelity (15-m) mesh fromDevelopment 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.

SeeTesting 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 ofOceanMesh2D please include a reference to [1], and to any of [2]-[5] if pertinent (latex .bib file). We would also appreciate using ourlogo in a presentation featuringOceanMesh2D.

[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 followingZenodo repository doilink.

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 frommesh2d included in OceanMesh2D that have been developed by @dengwirda. Please also seeJIGSAW-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 theexamples

                                               

  • The following images are provided from happy users. Please send us your meshes.

Jiangchao Qiu from hispublication.

       

Changelog

The format is based onKeep 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

  • Check inRead_shapefile.m to handle, warn, and correct cases where there are empty objects in a shapefile.#315
  • nws8 namelist for switching to CLE15 vortex model and option vortex model options implemented into a developement branch (adcirc/adcirc#393) of ADCIRC.#317

Changed

  • Combinelimit andvelwd namelists intowetdry namelist to match ADCIRC release code.#317
  • Defunct Google drive link to Zenodo one in the README.

[6.0.0] - 2024-02-28

Added

  • Added ability to generate constrainsts for shorelines automatically using the new high-fidelity method.#264
  • auxiliary file reader function that can be used standalone e.g., m = m.read({'fort.13','fort.15'})), as well as called from within msh() function.#287
  • swanoutput namelist for SWAN model outputs.#287
  • Added new function inmsh calledremesh_patch to remesh within specified polygonal domains and insert back into parent mesh.#301
  • Read and write to 2dm format.#300
  • namelist andRSTIMNC input arguments forMake_f15.m fort.15 generator. updated the help message for all input argumebts toMake_f15.#283
  • New stability namelist options toMake_f15.m fort.15 generator.#283
  • Optionality for mesh2dgen to choose the method of mesh generationkind, and the maximum iteration countiter.#272
  • Optionimprove_with_reduced_quality tomeshgen for allowing for mesh improvements even when quality is decreasing or large number of nodes eliminated, which sometimes is necessary to force the advancement in mesh quality.
  • Optiondelaunay_elim_on_exit tomeshgen to skip the last call todelaunay_elim to potentially avoid deleting boundary elements.
  • Geoid offset nodal attribute inCalc_f13 subroutine.#251
  • Support for writing Self Attraction and Loading (SAL) files in NetCDF for the ADCIRC model.#231
  • Added 'high-fidelity' option for automatically forming and constraining edges into the mesh.#264

Changed

  • treating logicals in namelists as a logicals type within MATLAB but ouput as a string.#287
  • Calc_Sponge.m to allow for sponge in polygon region and coefficents based on spatially varying depth.#287
  • removed namelists from default setup inMake_f15.m fort.15 generator to be invoked by user as an input argument instead.#283
  • Use implicit smoother (ds=1) inmsh.clean when fix points are present.#283
  • Default filename for the dynamicWaterLevelCorrection is nownull so that it is not evoked by default.#272
  • Default mesh improvement strategy isds 2.
  • Retrieve boundary indices inmsh.get_boundary_of_mesh method.#259
  • msh.offset63 struct and associated write/make routines for dynamicwaterlevel offset functionality.#259
  • dynamicWaterLevelCorrection to fort.15 namelist, and PRBCKGRND option to met fort.15 namelist.#261
  • Improved code readability by auto-indenting core functions and reworking 'setup' and 'Examples' functions, including adding necessary files for separation from core functions.#308
  • Renamed functions for clarity and fixed multiple small bugs; changes are compatible with OpenEarthTools but distinct.#308

Fixed

  • catch for offset_nodes of int type in writeoffset63.m.#287
  • writing out the wave coupling timestepRSTIMNC on theWTIMNC line of fort.15 whenNWS > 300.#283
  • make_bc call with empty varargin, e.g., when calling inner.#283
  • Make_offset63 call with constant offset (length 1time_vector).#283
  • ourKNNsearch call innanfill option ofGriddata (msh.interp).#283
  • m_map link insetup.sh Issue #277.#283
  • UpdatedCalc_f13.m to avoid an "Unrecognized variable" error by ensuring "broken" is always defined.#282
  • Fixed test for likely geographic coordinates inMake_f15.m.#282
  • updatedGridded_to_Mesh_SeaBed_DepthAveraged.m to fix the infinite loop in usingCal_IT_Fric.m by filling in the NaNs at greater depths with values from above.#280
  • Recursive cleaning issues: infinite loop and preservation of fixed points.
  • msh.interp method forK argument of length 1, and for the test to determine whether the bathymetry grid is irregular.#259
  • Printing of namelist character strings or numbers.#261
  • Make_offset63.m time interval computation.#261 and#272
  • Removed dependency on statistics toolbox when using the 'nanfill' option inmsh.interp.#269
  • Missing routines for reading in elvstaname and velstaname in readfort15.m by adding readlinevecname() method.#281
  • Incorrect reference toibtype was changed toibtypee inmap_mesh_properties function.#298

[5.0.0] - 2021-07-29

Added

  • meshgen.build() now will rewind the iteration set in the case mesh improvement cannot improve the qualities.#234
  • msh.plot() now has acmap in which the user can specify their anycmocean colormap
  • radius_separated_points function that trims the points in the mesh to have a specified resolution that can be used beforem_quiver so that vectors are evenly plotted.#225
  • Deleting boundary conditions by specifyng their indices inmsh.object.bd field. See#205
  • Ability for user to set their own axis limits when plotting withmsh.plot().#224

Fixed

  • Minor fix tomsh.make_bc using theauto method.#237
  • correction in setting stereographic projection bounds insetProj to make sure points are not pushed outside and become NaNs (was limited to radius of 178 deg but made sure can go up to full 180 deg).#225
  • Correctly deleting weirs from boundary object throughmake_bc delete method. See#205
  • Array format fix for reading in ibtype and nvell from fort.14 file and when executing carry_over_weirs. See#206
  • Fix for irregular grid spacings in DEMs. See#204
  • tidal constituents forMake_f15 can now contain "major8" in addition to other constituents in the string/cell array#221
  • Correctly collect NDBC and NOS stations in mesh when creatingfort15 file usingMake_f15 for meteorological, velocity and elevation records#242

Changed

  • msh.plot() using typebd option now creates a legend for the different boundary condition types.#247
  • forcing facecolor to white inm_trimesh so that it does not intefere with background color option.#245
  • made topographic elevation bound option for max_ele, wl, slp, and gedgefx kwargs consistent and added explanation of this option is included inedgefx help.#230
  • m_plot() function callsm_grid() with background color input kwarg (ifbackcolor option used) instead of manual application.#225
  • tidal_data_to_ob function called fromMake_f15 populates boundary condition tidal constituents that do not exist in the tidal database with zero values so that user can add user-defined values later (previously did not populate).#225
  • Improvedcmocean for pivot handling with discrete colormap.#225
  • RenamedCalc_NLCD_Mannings toCalc_Mannings_Landcover and making option for 'ccap' landcover type in addition to 'nlcd' (default) and added the ability to using user specified inteprolation (e.g., nearest, linear, cell-averaging, etc.) of the landcover data to the mesh vertices.#221

[4.0.0] - 2021-03-14

Added

  • mesh2d interface improvements to filter small polygons.
  • Support for creation offort.20 files for forcing rivers by @Jiangchao3
  • Mesh "cleaning" modes moderate and aggressive transfer nodal attributes via improvements tomsh.map_mesh_properties
  • msh.remove_attribute() method to remove f13 attribute(s)
  • newmsh.interp()slope_calc kwarg option to set the method of computing the topographic gradients (slopes), eitherrms [default] orabs
  • newextract_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() optionsubset option is now calledsubdomain
  • msh.plot() arbitary f13 option now utilizescolormap kwarg
  • utilities/extract_subdomain now is called with kwargs.
  • Cleaning upmsh.bound_courant_number() to usemsh.get_boundary_of_mesh() for Delaunay-triangulation and allowingmsh.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, andmsh.write() can write out arbitrary vertex indices (instead of just 1 to NP).

Fixed

  • Boundary labeling fix
  • Prompt when labeling bcs usingouter kwarg inmake_bc
  • fix for boundary condition mapping inmsh.map_mesh_properties() especially for weirs/barriers
  • fix for barrier mapping inmsh.plus() routine
  • fix formsh.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 forpoly2ccw mapping toolbox function inkml2struct
  • fix formsh.plot() on log colormap when plotting f13 attributes

Deleted

  • Deprecatingmsh.CheckTimestep() formsh.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 thatmade them required to have a 3d shapefiles.
  • plottinggdat 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

About

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.).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp