delete_bad_elements Module

defines:
  • model = delete_bad_shells(model, max_theta=175., max_skew=70., max_aspect_ratio=100.,
    max_taper_ratio=4.0)
  • eids_to_delete = get_bad_shells(model, xyz_cid0, nid_map, max_theta=175., max_skew=70.,
    max_aspect_ratio=100., max_taper_ratio=4.0)
pyNastran.bdf.mesh_utils.delete_bad_elements.delete_bad_shells(model, min_theta=0.1, max_theta=175.0, max_skew=70.0, max_aspect_ratio=100.0, max_taper_ratio=4.0)[source]

Removes bad CQUAD4/CTRIA3 elements

Parameters:
model : BDF ()

this should be equivalenced

min_theta : float; default=0.1

the maximum interior angle (degrees)

max_theta : float; default=175.

the maximum interior angle (degrees)

max_skew : float; default=70.

the maximum skew angle (degrees)

max_aspect_ratio : float; default=100.

the max aspect ratio

taper_ratio : float; default=4.0

the taper ratio; applies to CQUAD4s only

pyNastran.bdf.mesh_utils.delete_bad_elements.element_quality(model, nids=None, xyz_cid0=None, nid_map=None)[source]

Gets various measures of element quality

Parameters:
model : BDF()

a cross-referenced model

nids : (nnodes, ) int ndarray; default=None

the nodes of the model in sorted order includes GRID, SPOINT, & EPOINTs

xyz_cid0 : (nnodes, 3) float ndarray; default=None

the associated global xyz locations

nid_map : Dict[nid]->index; default=None

a mapper dictionary

Returns:
quality : Dict[name]

Various quality metrics names : min_interior_angle, max_interior_angle, dideal_theta,

max_skew_angle, max_aspect_ratio, area_ratio, taper_ratio, min_edge_length

values : The result is np.nan if element type does not define

the parameter. For example, CELAS1 doesn’t have an aspect ratio.

Notes

  • pulled from nastran_io.py
pyNastran.bdf.mesh_utils.delete_bad_elements.get_bad_shells(model, xyz_cid0, nid_map, min_theta=0.1, max_theta=175.0, max_skew=70.0, max_aspect_ratio=100.0, max_taper_ratio=4.0)[source]

Get the bad shell elements

Parameters:
model : BDF()

the model object

xyz_cid0 : (N, 3) float ndarray

the xyz coordinates in cid=0

nid_map : dict[nid]
nid : int

the node id

index : int

the index of the node id in xyz_cid0

min_theta : float; default=0.1

the maximum interior angle (degrees)

max_theta : float; default=175.

the maximum interior angle (degrees)

max_skew : float; default=70.

the maximum skew angle (degrees)

max_aspect_ratio : float; default=100.

the max aspect ratio

taper_ratio : float; default=4.0

the taper ratio; applies to CQUAD4s only

Returns:
eids_failed : List[int]

element ids that fail the criteria

shells with a edge length=0.0 are automatically added
pyNastran.bdf.mesh_utils.delete_bad_elements.get_min_max_theta(faces, all_node_ids, nid_map, xyz_cid0)[source]

get the min/max thetas for CTETRA, CPENTA, CHEXA, CPYRAM

pyNastran.bdf.mesh_utils.delete_bad_elements.get_node_map(model)[source]

gets an nid->inid mapper

pyNastran.bdf.mesh_utils.delete_bad_elements.quad_quality(element, p1, p2, p3, p4)[source]

gets the quality metrics for a quad

pyNastran.bdf.mesh_utils.delete_bad_elements.tri_quality(p1, p2, p3)[source]

gets the quality metrics for a tri