Meshpresso module

The following section contains a documentation of the Meshpresso module implementation.

class meshpresso.Mesh(model_name, dict_of_parts, asbly_element_sets=None, asbly_node_sets=None, asbly_surfaces=None)[source]

Mesh is the most general class used to import, store and export mesh data. the idea is to initialise the constructor, then import mesh from db file. finally, the mesh can be exported to an external format. for example

>>> mesh = Mesh()
>>> mesh.import_from_db_file(path_to_db_file='mesh.db')
>>> mesh.export_to_calculix(exported_filename='calculix.inp')
>>> mesh.export_to_unv_format(exported_filename='salome.unv')
model_name

name of imported model

Type

string

parts

list of imported parts

Type

list

assembly_mesh

the dictionary contains parts, but those have renumbered node and element labels, so that the labels are not repeating

Type

dictionary

export_to_calculix(exported_filename)[source]

function to export mesh to calculix format

Parameters

exported_filename (str) – name of the file to export mesh (eg ‘calculix.inp’)

export_to_unv_format(exported_filename)[source]

function to export to unv format

Parameters

exported_filename (str) – name of the file to export mesh (eg ‘salome.unv’)

get_calculix_surf_definition()[source]

function converts surfaces into format appropriate for calculix.

Returns

dictionary with surface name as keys and dictionary surface definition as value

Return type

dict

classmethod import_from_abaqus_cae(abq_model_name, abq_root_assembly)[source]

function to initiate the mesh object

Parameters
  • abq_model_name (str) – name of the abaqus model

  • abq_part_list (list) – list of abaqus parts to export mesh from

Returns

object containing model mesh definition

Return type

Mesh

classmethod import_from_db_file(path_to_db_file)[source]

function to initiate the mesh object

Parameters

path_to_db_file (str) – path to the db file

Returns

object containing model mesh definition

Return type

mesh

renumber_mesh()[source]

function computes mesh at assembly level from list of part objects. the returned dictionary contains parts with renumbered nodes and elements

Returns

dictionary of parts

Return type

defaultdict(list)

save_to_db_file(name_of_db_file)[source]

function to save model data to db file

Parameters

name_of_db_file (str) – name of the file that will be used to store data

set_salome_surf_definition()[source]

function converts surfaces into format appropriate for salome.

Returns

dictionary with surface name as keys and dictionary surface definition as value

Return type

dict

class meshpresso.PartMesh(part_name, part_nodes, part_elements, element_sets=None, node_sets=None, surfaces=None)[source]

PartMesh is an object used to store mesh properties for a given part.

name

name of the part

Type

str

nodes

list of the node objects

Type

list of node objects

elements

list of the element objects

Type

list

elements_by_type

dictionary of elements grouped by element type

Type

defaultdict(list)

el_set

dictionary of element sets grouped by element set name

Type

defaultdict(list)

n_set

dictionary of node sets grouped by node set name

Type

defaultdict(list)

surfaces

dictionary of surfaces {surf_name: {‘nodes’: n_set, ‘elements’: el_set, ‘sides’: string}, by default None

Type

defaultdict(list), optional

classmethod from_abaqus_cae(abq_part)[source]

function to initiate object from abaqus part.

Parameters

abq_part (abq_part) – abaqus part object

Returns

object containing part mesh definition

Return type

part_mesh

get_elements_by_type()[source]

function used to create a dictionary of elements with element types used as keys

Returns

dictionary of elements with elementtypes used as keys

Return type

defaultdict(list)

get_elements_from_label_list(label_list)[source]

function to retrieve the elements from list of elements labels.

Parameters

label_list (list) – list of integers referring to element labels

Returns

list of element objects

Return type

list

get_nodes_from_label_list(label_list)[source]

function to retrieve the nodes from list of node labels

Parameters

label_list (list) – list of integers describing node labes

Returns

list of node objects

Return type

list

reorder_nodes_in_el_definition(mesh_format)[source]

function used to reorder nodes. by default the node order is the same as in abaqus.

Parameters

mesh_format (str) – format of mesh to be converted to

set_element_type_format(new_format)[source]

function to change element types in dictionary elements_by_type (for example from c3_d20_r to 116)

Parameters

new_format (str) – new format (eg ‘UNV’)

class meshpresso.Element(el_type, el_label, el_connect, part_all_nodes)[source]

class used to store information about elements, theirs type, label and connection to nodes

type

element type (eg C3D4)

Type

str

label

element number

Type

int

connectivity

list of nodes that element is based on

Type

list

change_label(new_label)[source]

a function to change element label

Parameters

new_label (int) – new element number

get_node_labels()[source]

function returns labels of nodes which building the element

Returns

list of integers describing node labels

Return type

list

class meshpresso.Node(n_label, n_coords)[source]

used to create node objects from external data

label

node number

Type

int

coordinates

node coordinates

Type

tuple

change_label(new_label)[source]

a function to change node label

Parameters

new_label (int) – new node number