mpas_tools.mesh.creation.build_mesh.build_mesh¶
-
mpas_tools.mesh.creation.build_mesh.
build_mesh
(preserve_floodplain=False, floodplain_elevation=20.0, do_inject_bathymetry=False, geometry='sphere', plot_cellWidth=True)[source]¶ Build an MPAS mesh using JIGSAW with the given cell sizes as a function of latitude and longitude (on a sphere) or x and y (on a plane).
The user must define a local python module
define_base_mesh
that provides a function that returns a 2D arraycellWidth
of cell sizes in kilometers.If
geometry = 'sphere'
, this function is calledcellWidthVsLatLon()
and also returns 1Dlon
andlat
arrays.If
geometry = 'plane'
(or any value other than ‘sphere’`), the function is calledcellWidthVsXY()
and returns 4 arrays in addition tocellWidth
: 1Dx
andy
arrays defining planar coordinates in meters; as well asgeom_points
, list of point coordinates for bounding polygon for the planar mesh; andgeom_edges
, list of edges between points ingeom_points
that define the bounding polygon.The result is
base_mesh.nc
as well as several intermediate files:mesh.log
,mesh-HFUN.msh
,mesh.jig
,mesh-MESH.msh
,mesh.msh
, andmesh_triangles.nc
.The
extract_vtk()
function is used to produce a VTK file in thebase_mesh_vtk
directory that can be viewed in ParaVeiw.- Parameters
preserve_floodplain (bool, optional) – Whether a flood plain (bathymetry above z = 0) should be preserved in the mesh. If so, a field
cellSeedMask
is added to the MPAS mesh indicating positive elevations that should be preserved.floodplain_elevation (float, optional) – The elevation in meters to which the flood plain is preserved.
do_inject_bathymetry (bool, optional) – Whether one of the default bathymetry datasets,
earth_relief_15s.nc
ortopo.msh
, should be added to the MPAS mesh in the fieldbottomDepthObserved
. If so, a local link to one of these file names must exist.geometry ({'sphere', 'plane'}, optional) – Whether the mesh is spherical or planar
plot_cellWidth (bool, optional) – If
geometry = 'sphere'
, whether to produce a plot ofcellWidth
. If so, it will be written tocellWidthGlobal.png
.