Welcome to OceanMesh2D’s documentation!¶
Indices and tables¶
msh class¶
This is the msh class definition.
- class @msh.msh(varargin)¶
MSH: The mesh class Contains, handles, and builds properties of a mesh such as vertices, an element table, bathymetry and ADCIRC style boundary types Copyright (C) 2018 Keith Roberts & William Pringle
Class constructor/read a mesh into a msh class.
Options are specified as name/value pairs for this class. NB: The file type is determined by suffix extension (e.g., ‘fname.14’)
Usage:
obj = msh(varargin)
fname: The filename of the msh file.
points: a num_points x 2 array of points
elements: a num_elements x 3 array of triangles indexing into points array.
aux: a cell-array with filenames of additional files that pair with the mesh
nob: 0/1 enable/disable the reading of boundary conditions (nodestrings). Default = 0 [i.e., will read in boundary conditions]
Examples:
m = msh(); % returns a blank mesh object.
m = msh(‘fname.14’); % reads in from a fort.14 file
m = msh(‘fname’,’fname.14’,’aux’,{‘blah.13’,’otherfile.15’}); % reads in a fort.14 along with a fort.13 and fort.15
m = msh(‘points’, point_array, ‘elements’, triangle_table); % reads in from points and elements format.
LICENSE
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- msh.write(fname, type)¶
Write a mesh to disk in a couple of formats.
Usage:
write(obj,fname,type)
- fname: The name of the file to write to disk. Defaults
to ‘fort_1.xx’
- type: The format to write the file to disk in
ADCIRC file format 11, 13, 15, 19, 20, 24 SCHISM ‘.gr3’, WaveWatch3 ‘ww3’
Examples:
write(obj); % writes all available data to fort_1.xx (ADCIRC) files
write(obj,fname); % writes all available data to fname.xx (ADCIRC) files
write(obj,fname,’14’); % writes mesh data to fname.14 (ADCIRC) file
write(obj,fname,’gr3’); % writes mesh data to fname.gr3 (SCHISM) file
write(obj,fname,’ww3’); % writes mesh data to fname.ww3 (WaveWatchIII) file
write(obj,fname,{‘13’,’14’}); % writes mesh data and f13 attribute data to fname.14 and fname.13 (ADCIRC) files
- msh.plot(varargin)¶
Plot a msh object and associated nodal attribute values.
Usage:
h = plot(obj,varargin)
obj: msh object
varargin kwargs:
‘type’: plot type, choose from…
‘tri’ - (default) plots the triangulation
‘bd’ - same as tri but with nodestrings/boundary conditions plotted
‘ob’ - outer boundary of the mesh
‘b’ - plots the bathymetry
‘slp’ - plots the bathymetric gradients
‘reso’ - plots the element circumradius (resolution) based on the projection
‘resodx’ - plots the gradient in ‘reso’
‘qual’ - plots the element quality
‘sponge’ - plots the sponge zone/strength coefficients
‘transect’ - plot a bathy transect through GUI
‘xx’ - plots an arbitrary f13 attribute ‘xx’ by contains search
ADDITIONALS for ‘type’
Add the following words inside the type character string to implement desired behaviors:
a1) ‘notri’ plot without the triangulation (used with ‘bd’ option)
b2) ‘earth’ use with ‘reso’ option to plot resolution using element edgelengths on the Earth
c3) ‘log’ use with options that use a colormap to plot the caxis in log space
d4) ‘mesh’ use with options that use a colormap to plot colors on the element
e5) ‘edges’ (a mesh look) instead of on the element faces (a surface look)
‘proj’: Available m_map projection to plot in e.g.,: ‘equi’, ‘lamb’, ‘stereo’. Select ‘none’ to plot without the m_map projection. Default is the projection of the msh object.
‘subdomain’: Plot a subdomain of the mesh bounded by the corner coordinates (a bounding box: [west east; south north])
More options to refine the look of the plot:
‘colormap’: number of colormap intervals and (optional) range: [num_intervals] or [num_intervals caxis_lower caxis_upper]
‘fontsize’: figure fontsize
‘backcolor’: figure background RGB color (where mesh doesn’t exist), default is [1 1 1] => white
‘holdon’ : =1 to plot on existing figure (otherwise will use new figure)
‘pivot’ : value in meters for which to assume is datum when plotting topo-bathymetry (default 0.0 m)
‘axis_limits’: Force the axes limits to be bounded by what is passed in bbox.
‘cmap’: The name of the cmocean colormap (each option has different default) type ‘help cmocean’ to see all the colormaps available
- msh.renum()¶
Renumber the node numbers by minimizing the bandwidth using a RCM technique.
Usage:
renumb(obj)