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_meshthat provides a function that returns a 2D arraycellWidthof cell sizes in kilometers.If
geometry = 'sphere', this function is calledcellWidthVsLatLon()and also returns 1Dlonandlatarrays.If
geometry = 'plane'(or any value other than ‘sphere’`), the function is calledcellWidthVsXY()and returns 4 arrays in addition tocellWidth: 1Dxandyarrays 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_pointsthat define the bounding polygon.The result is
base_mesh.ncas 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_vtkdirectory 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
cellSeedMaskis 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.ncortopo.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.