# mesh-reshape v3.2.3 **Mercurial revision 5803:7164e00e8f3d | 2026-08-18** --- ## Description Reshape and adjust finite element (FE) mesh boundaries to fit given polygons. This tool uses **elasticity-based methods** to smoothly deform the mesh while preserving its quality and ensuring alignment with the specified boundaries. It is particularly useful for ocean modeling or computational fluid dynamics (CFD) applications where mesh boundaries must accurately follow geographical or physical constraints. --- ## Usage ```bash mesh-reshape [OPTIONS] -m -s ``` --- ## Options | Option | Description | |--------|-------------| | `-h, --help` | Show this help message and exit. | | `-m ` | **Required.** Input mesh file (e.g., `mesh.nei`). | | `-s ` | **Required.** Polygon file to align mesh boundaries (e.g., `coastline.plg`). | | `-d ` | Polygon file for mesh destruction (optional). | | `-p ` | Polygon file for edge selection (optional). | | `-o ` | Output mesh file. Default: `mesh-reshape.nei`. | | `--smooth` | Enable mesh smoothing after reshaping. | | `--debug` | Enable debug verbose mode. | --- ## Examples ### Basic Usage Align a mesh to a coastline polygon: ```bash mesh-reshape -m input_mesh.nei -s coastline.plg -o output_mesh.nei ``` ### With Mesh Smoothing Apply smoothing to improve mesh quality after reshaping: ```bash mesh-reshape -m input_mesh.nei -s coastline.plg --smooth -o smoothed_mesh.nei ``` ### With Debug Mode Enable debug output for troubleshooting: ```bash mesh-reshape -m input_mesh.nei -s coastline.plg --debug -o debug_mesh.nei ``` ### With Mesh Destruction Remove parts of the mesh using a destruction polygon: ```bash mesh-reshape -m input_mesh.nei -s coastline.plg -d destruction_area.plg -o final_mesh.nei ``` --- ## Environment Variables None. --- ## Notes - The input mesh file (`-m`) and boundary polygon file (`-s`) are **mandatory**. - The tool assumes the input mesh is in **TRIGRID format** (`.nei`). - For large meshes, consider using `--debug` to monitor progress and identify issues. - Mesh smoothing (`--smooth`) may increase computation time but improves element quality. --- ## See Also - [TRIGRID Mesh Format](https://example.com/trigrid-format) - [Polygon File Format (PLG)](https://example.com/plg-format) - [Elasticity-Based Mesh Deformation](https://example.com/elasticity-methods) ``` ---