Mesh module of amfe. It handles the mesh from import, defining the dofs for the boundary conditions and the export.
amfe.mesh.
Mesh
[source]¶Bases: object
Class for handling the mesh operations.
nodes
¶ndarray – Array of x-y-z coordinates of the nodes. Dimension is (no_of_nodes, no_of_dofs_per_node). If no_of_dofs_per_node: z-direction is dropped!
connectivity
¶list – List of nodes indices belonging to one element.
constraint_list
¶ndarray – Experimental: contains constraints imported from nastran-files via import_bdf()
el_df
¶pandas.DataFrame – Pandas Dataframe containing Element-Definitions of the Original file (e.g. *.msh or *.bdf-File)
ele_obj
¶list – List of element objects. The list contains actually only the pointers pointing to the element object. For each combination of element-type and material only one Element object is instanciated. ele_obj contains for each element a pointer to one of these Element objects.
neumann_connectivity
¶list – list of nodes indices belonging to one element for neumann BCs.
neumann_obj
¶list – List of element objects for the neumann boundary conditions.
nodes_dirichlet
¶ndarray – Array containing the nodes involved in Dirichlet Boundary Conditions.
dofs_dirichlet
¶ndarray – Array containing the dofs which are to be blocked by Dirichlet Boundary Conditions.
no_of_dofs_per_node
¶int – Number of dofs per node. Is 3 for 3D-problems, 2 for 2D-problems. If rotations are considered, this nubmer can be >3.
no_of_elements
¶int – Number of elements in the whole mesh associated with an element object.
no_of_nodes
¶int – Number of nodes of the whole system.
no_of_dofs
¶int – Number of dofs of the whole system (including constrained dofs).
element_class_dict
¶dict – Dictionary containing objects of elements.
element_boundary_class_dict
¶dict – Dictionary containing objects of skin elements.
node_idx
¶int – index describing, at which position in the Pandas Dataframe el_df the nodes of the element start.
deflate_mesh
()[source]¶Deflate the mesh, i.e. delete nodes which are not connected to an element.
Parameters: | None – |
---|---|
Returns: | |
Return type: | None |
import_bdf
(filename, scale_factor=1.0)[source]¶Import a NASTRAN mesh.
Parameters: |
|
---|---|
Returns: | |
Return type: | None |
Notes
This function is heavily experimental. It is just working for a subset of NASTRAN input files and the goal is to capture the mesh and the constraints of the model. The constraints are captured in the constraint_list-object of the class.
The internal representation of the elements is done via a Pandas Dataframe object.
import_csv
(filename_nodes, filename_elements, explicit_node_numbering=False, ele_type=False)[source]¶Imports the nodes list and elements list from 2 different csv files.
Parameters: |
|
---|---|
Returns: | |
Return type: | None |
Examples
TODO
import_inp
(filename, scale_factor=1.0)[source]¶Import Abaqus input file.
Parameters: |
|
---|---|
Returns: | |
Return type: | None |
Notes
This function is heavily experimental. It is just working for a subset of Abaqus input files and the goal is to capture the mesh of the model.
The internal representation of the elements is done via a Pandas Dataframe object.
import_msh
(filename, scale_factor=1.0)[source]¶Import a gmsh-mesh.
Parameters: |
|
---|---|
Returns: | |
Return type: | None |
Notes
The internal representation of the elements is done via a Pandas Dataframe object. This gives the possibility to dynamically choose a part of the mesh for boundary conditons etc.
load_group_to_mesh
(key, material, mesh_prop='phys_group')[source]¶Add a physical group to the main mesh with given material.
It generates the connectivity list (mesh-class-property connectivity) which contains the element configuration as array and provides a map with pointers to Element-Objects (Tet, Hex etc.) which already contain information about material that is passed. Each element gets a pointer to such an element object.
Parameters: |
|
---|---|
Returns: | |
Return type: | None |
mesh_information
(mesh_prop='phys_group')[source]¶Print some information about the mesh that is being imported Attention: This information is not about the mesh that is already loaded for further calculation. Instead it is about the mesh that is found in an import-file!
Parameters: | mesh_prop (str, optional) – mesh property of the loaded mesh. This mesh property is the basis for selection of parts of the mesh for materials and boundary conditions. The default value is ‘phys_group’ which is the physical group, if the mesh comes from gmsh. |
---|---|
Returns: | |
Return type: | None |
save_mesh_xdmf
(filename, field_list=None, bmat=None, u=None, timesteps=None)[source]¶Save the mesh in hdf5 and xdmf file format.
Parameters: |
|
---|---|
Returns: | |
Return type: | None |
Notes
Only one homogeneous mesh is exported. Thus only the mesh made of the elements which occur most often is exported. The other meshes are discarded.
set_dirichlet_bc
(key, coord, mesh_prop='phys_group', output='internal')[source]¶Add a group of the mesh to the dirichlet nodes to be fixed. It sets the mesh-properties ‘nodes_dirichlet’ and ‘dofs_dirichlet’
Parameters: |
|
---|---|
Returns: |
|
set_neumann_bc
(key, val, direct, time_func=None, shadow_area=False, mesh_prop='phys_group')[source]¶Add group of mesh to neumann boundary conditions.
Parameters: |
|
---|---|
Returns: | |
Return type: | None |
tie_mesh
(master_key, slave_key, master_prop='phys_group', slave_prop='phys_group', tying_type='fixed', robustness=4, verbose=False, conform_slave_mesh=True, fix_mesh_dist=0.001)[source]¶Tie nonconforming meshes for a given master and slave side.
Parameters: |
|
---|---|
Returns: |
|
Notes
The master mesh has to embrace the full slave mesh. If this is not the case, the routine will fail, a slave point outside the master mesh cannot be addressed to a specific element.