Part¶
Class for handling Part data.
-
class
qd.cae.dyna.QD_Part¶ Methods
get_element_ids([element_filter])Get the ids of the elements belonging to the part.
get_element_node_ids(element_type, nNodes)Get the node ids of all the elements belonging to the part.
get_element_node_indexes(element_type, nNodes)Get the node indexes of all respective elements.
get_elements([element_filter])Get the elements of the part.
get_id()Get the id of the part.
Get the number of elements in the part.
Get the number of nodes in the part.
get_name()Get the name of the part.
Get the unique node ids of the part.
Get the unique node indexes of the part.
Get the nodes of the part.
plot(self[, iTimestep, element_result, …])Plot the Part, currently shells only!
-
get_element_ids(element_filter = Element.none)¶ Get the ids of the elements belonging to the part.
- Parameters
- element_filterElement.type
optional filter for elements
- Returns
- element_idsnp.ndarray
ids of the elements
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> part.get_element_ids().shape (9631,) >>> # get only beams >>> part.get_element_ids(Element.beam).shape (0,) >>> # oops no beams :P
-
get_element_node_ids(element_type, nNodes)¶ Get the node ids of all the elements belonging to the part.
- Parameters
- element_typeElement.type
Element type. May be beam, shell or solid.
- nNodesint
number of nodes (e.g. 3 for tria with Element.shell)
- Returns
- element_node_idsnp.ndarray
every row contains the node ids for every element
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> tria_node_ids = part.get_element_node_ids(Element.shell, nNodes=3) >>> tria_node_ids[0] array([ 102, 109, 98, 99])
-
get_element_node_indexes(element_type, nNodes)¶ Get the node indexes of all respective elements.
- Parameters
- element_typeElement.type
Element type. May be beam, shell or solid.
- nNodesint
number of nodes (e.g. 3 for tria with Element.shell)
- Returns
- element_node_indexesnp.ndarray
every row contains the node indexes for every element
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> tria_node_indexes = part.get_element_node_ids(Element.shell, nNodes=3) >>> tria_node_indexes[0] array([ 347, 354, 343, 344])
-
get_elements(element_filter=Element.none)¶ Get the elements of the part.
- Parameters
- element_filterElement.type
Optional element type filter. May be beam, shell or solid.
- Returns
- elementslist(Element)
list of Elements
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> len( part.get_elements() ) 49123 >>> len( part.get_elements(Element.shell) ) 45123
-
get_id()¶ Get the id of the part.
- Returns
- idint
id of the part
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> part.get_id() 1
-
get_nElements()¶ Get the number of elements in the part.
- Returns
- nElementsint
number of elements
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> part.get_nElements() 8945
-
get_nNodes()¶ Get the number of nodes in the part.
- Returns
- nNodesint
number of nodes
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> part.get_nNodes() 9115
-
get_name()¶ Get the name of the part. It’s the same name as in the input deck.
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> part.get_name() 'PLATE_C'
-
get_node_ids()¶ Get the unique node ids of the part.
- Returns
- node_idsnp.ndarray
unique node ids
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> part.get_node_ids().shape (6489,)
-
get_node_indexes()¶ Get the unique node indexes of the part.
- Returns
- node_indexesnp.ndarray
unique node indexes
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> part.get_node_indexes().shape (6489,)
-
get_nodes()¶ Get the nodes of the part. Note that a node may belong to two parts, since only the elements are uniquely assignable.
- Returns
- nodeslist(Node)
nodes belonging to the elements of the part
Examples
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> len( part.get_nodes() ) 52341
-
plot(self, iTimestep=0, element_result=None, fringe_bounds=[None, None], export_filepath=None)¶ Plot the Part, currently shells only!
- Parameters
- iTimestepint
timestep at which to plot the D3plot
- element_resultstr or function
which type of results to use as fringe None means no fringe is used Function shall take elem as input and return a float value (for fringe)
- fringe_boundslist(float,float) or tuple(float,float)
bounds for the fringe, default will use min and max value
- export_filepathstr
optional filepath for saving. If none, the model is exported to a temporary file and shown in the browser.
Examples
Load a d3plot and plot a part
>>> d3plot = D3plot("path/to/d3plot") >>> part = d3plot.get_partByID(1) >>> part.plot() # just geometry
Read the state data and plot in deformed state
>>> # read state data >>> d3plot.read_states(["disp","stress_mises max"]) >>> part.plot(iTimestep=-1) # last state
Use a user-defined element evaluation function for fringe colors.
>>> # User defined evaluation function >>> def eval_fun(element): >>> res = element.get_stress_mises() >>> if len(res): # some elements may miss stresses >>> return res[-1] # last timestep >>> part.plot(iTimestep=-1, element_result=eval_fun)
-