mesh-generator v3.2.3

Mercurial revision 5803:7164e00e8f3d | 2026-08-18


Description

mesh-generator is a tool that generates a 2D mesh based on a given criteria file (.crt). It is designed to create high-quality meshes for oceanographic, coastal, or other geospatial applications.


Usage

mesh-generator [OPTIONS] criteria.crt

Options

General Options

Option

Description

-h, --help

Display help and exit.

--limits-only

Generate density and limits but not the mesh.

--rootname <name>

Root name for intermediate output files (default: anonymous).

--debug

Generate extra output files for debugging purposes.

--check-limits

Check the sanity of mesh limits polygons.

--no-reshape

Skip the mesh reshaping step.

--show-map

Save mesh densities to <rootname>-criteria*.nc.


Input/Output Options

Option

Description

-b <file>

Path to the bathymetry file. Can also be specified in the criteria file via TOPOGRAPHY_FILE.

-f <file>

Path to the mesh boundaries file (trigrid format). Disables -d and -p.

-d <file>

Path to the genesis boundary descriptor. Disables -p.

-p <file>

Path to raw polygons for boundaries.

-m <file>

Path to a mesh file to merge with the generated mesh.

-o <file>

Path to the output mesh file (default: <rootname>-mesh.nei).

-s <file>

Path to the mesh density file.

-z <file>

Path to a local mesh density prescription file.

-n <file>

Path to a node file (used for triangulation).


Mesh Generation Options

Option

Description

-r <resolution>

Resolution in kilometers. Used only when a node file is provided and no criteria file is given.

--line-mode <mode>

Line definition mode between polygon vertices. <mode> can be: ORTHODROMIC, LOXODROMIC, or CARTESIAN (default: LOXODROMIC).

--smoothing-rate <rate>

Smoothing rate for mesh optimization.

--polar

Enable polar grid mode.


Examples

Basic Mesh Generation

Generate a mesh using a criteria file:

mesh-generator criteria.crt

Generate Mesh with Custom Output Name

Generate a mesh and specify a root name for output files:

mesh-generator --rootname my_mesh criteria.crt

Generate Mesh with Bathymetry

Generate a mesh using a custom bathymetry file:

mesh-generator -b bathymetry.nc criteria.crt

Generate Mesh with Boundaries

Generate a mesh using a boundaries file:

mesh-generator -f boundaries.trg criteria.crt

Generate Mesh with Raw Polygons

Generate a mesh using raw polygons for boundaries:

mesh-generator -p polygons.plg criteria.crt

Generate Mesh with Node File

Generate a mesh using a node file and a resolution:

mesh-generator -n nodes.txt -r 1000 criteria.crt

Generate Density and Limits Only

Generate density and limits without creating the mesh:

mesh-generator --limits-only criteria.crt

Merge with Existing Mesh

Generate a mesh and merge it with an existing mesh:

mesh-generator -m existing_mesh.nei criteria.crt

Debug Mode

Generate a mesh with extra debugging output:

mesh-generator --debug criteria.crt

Custom Line Mode

Generate a mesh with a specific line mode (e.g., ORTHODROMIC):

mesh-generator --line-mode ORTHODROMIC criteria.crt

Local Mesh Density Prescription

Generate a mesh with a local mesh density prescription:

mesh-generator -z local_density.txt criteria.crt

Check Mesh Limits

Check the sanity of mesh limits polygons:

mesh-generator --check-limits criteria.crt

Skip Mesh Reshaping

Generate a mesh without reshaping:

mesh-generator --no-reshape criteria.crt

Save Mesh Densities

Save mesh densities to a NetCDF file:

mesh-generator --show-map criteria.crt

Environment Variables

mesh-generator uses OpenMP for parallelization. Key environment variables:

Variable

Description

OMP_NUM_THREADS

Number of threads to use.

OMP_SCHEDULE

Runtime schedule type and chunk size.

OMP_DYNAMIC

Enable/disable dynamic thread adjustment.

OMP_NESTED

Enable/disable nested parallelism.

Example:

OMP_NUM_THREADS=4 mesh-generator criteria.crt

Notes

  1. Criteria File:

  • The criteria file (.crt) defines the mesh resolution, bathymetry, and other parameters.

  • If no criteria file is provided, a node file and resolution (-r) must be specified.

  1. Boundary Files:

  • Use -f for mesh boundaries files (trigrid format).

  • Use -d for genesis boundary descriptors.

  • Use -p for raw polygons.

  • Priority: -f > -d > -p.

  1. Bathymetry:

  • Can be specified via -b or in the criteria file using TOPOGRAPHY_FILE.

  1. Output:

  • The default output mesh file is <rootname>-mesh.nei.

  • Use -o to specify a custom output path.

  1. Mesh Merging:

  • Use -m to merge the generated mesh with an existing mesh.

  1. Debugging:

  • Use --debug to generate additional output files for troubleshooting.

  1. Line Modes:

  • ORTHODROMIC: Great-circle lines (default).

  • LOXODROMIC: Rhumb lines.

  • CARTESIAN: Straight lines in a projected coordinate system.

  1. Polar Grids:

  • Use --polar for polar grid generation.


See Also