The Mesh class#
What it does#
The HydroflowMesh class is the mother of all Mesh classes. Other mesh classes build on this one.
We can distinguish two purposes for the mesh class:
First: it can be used to interact with the selected mesh file. Basic informations can be retrieved concerning the mesh from the different properties of the class. Concerning these properties, there is no possibility to modify the values, which can be considered as a blackbox.
Secondly: the HydroflowMesh class is used by the constructor of the HydroflowModel class to initialize the geometry of the physical problem.
Documentation#
- class watlab.watlab.Mesh(msh_mesh)#
Mesh class is used to build the geometry of the simulation.
The class gives access to the informations of the mesh as
nodes, cells, edges organization and regions.
Normally, the function are not needed for the user. Except if there is a need for specific simulation topography imported from a tiff file.
- Parameters:
msh_mesh (string) – The path to the .msh file representing the mesh. The file must comply with GMSH 4.10 file format
nNodes (int) – Number of nodes in the mesh
nCells (int) – Number of cells in the mesh
nEdges (int) – Number of edges in the mesh
- property boundaries#
The dictionnary of boundaries
- Getter:
__boundaries
- Return type:
dict{tags : names}
- property boundary_edges#
The edges associated to physical groups as a dictionnary
- Getter:
boundary_edges
- Type:
dict{physical group : edges}
- property cells#
The __cell_tags and the associated cells represented by their node_tags
- Getter:
__cell_tags = list of the cells’ tags __cells = list of the nodes describing each cell
- Type:
nDArray
- property edges#
The edges’ tags, nodes, and cells
- Getter:
edge_tags = the tags of the edges edge_nodes = the nodes n_0 and n_1 composing the edge, with n_0 < n_1 edge_cells: the left cell and the right cell, with respect to the edge where n_0 is bottom and n_1 is top.
- Type:
nDArray
- property edges_length#
Returns the length of each edge composing the mesh
- Returns:
length of each mesh’s edge
- Return type:
ndArray
- get_boundary_by_name(name)#
Returns a list of boundary edges corresponding to the tag [name]
- Parameters:
name (string) – name of the tag to look for
- Raises:
Exception – There is no physical boundary named after [name]
- Returns:
list of the boundary edges
- Return type:
list
- get_boundary_length(boundary_name) float #
Returns the length of a boundary by name
- Parameters:
boundary_name (str) – the name of the desired boundary
- Raises:
Exception – this boundary name does not exist
- Returns:
The length in [m] of the boundary
- Return type:
float
- get_cells_barycenters()#
Returns cells barycenters coordinates
- Returns:
cells_barycenters
- Return type:
nDArray
- get_region_by_name(name)#
Returns the tag of the region of name [name] :
- Parameters:
name (string) – name of the tag to look for
- Raises:
Exception – There is no physical region named after [name]
- Returns:
returns the tag of the region corresponding to [name]
- Return type:
list
- property meshchecking#
Indicates if a meshchecking is asked by the user before the use of the solver
:return True or False :rtype Boolean
- property nodes#
The nodes’ tags and coordinates
- Getter:
_nodes_tags = list of the nodes’ tags _nodes = list of the nodes’ coordinates
- Type:
nDArray
- property region_cells#
The cells associated to physical group
- Getter:
region_cells
- Type:
dict{Physical Group : cells }
- property regions#
The dictionnary of physical groups
- Getter:
regions = the physical groups
- Type:
dict{tags : names}
- set_nodes_elevation_from_tif(tif_file)#
- Sets the elevation of the nodes of the mesh from a tif file.
The z value is interpolated from the tif file and set to the corresponding nodes
- Parameters:
tif_file (string) – path of the tif file
- property tag_to_indexes#
Indicates the mapping from cells’ tags to cells’ indexes
- Getter:
__tag_to_indexes
- Type:
dict{key = tag : value = index}