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._is_bad_quad(eid: int, p1, p2, p3, p4, log: SimpleLogger, max_aspect_ratio: float, min_theta_quad: float, max_theta: float, max_skew: float, max_taper_ratio: float, max_warping: float) bool[source]

identifies if a CQUAD4 has poor quality

pyNastran.bdf.mesh_utils.delete_bad_elements._is_bad_tri(eid: int, p1, p2, p3, log: SimpleLogger, max_aspect_ratio: float, min_theta_tri: float, max_theta: float, max_skew: float) bool[source]

identifies if a CTRIA3 has poor quality

pyNastran.bdf.mesh_utils.delete_bad_elements.delete_bad_shells(model: BDF, min_theta: float = 0.1, max_theta: float = 175.0, max_skew: float = 70.0, max_aspect_ratio: float = 100.0, max_taper_ratio: float = 4.0, max_warping: float = 90.0) BDF[source]

Removes bad CQUAD4/CTRIA3 elements

Parameters:
modelBDF ()

this should be equivalenced

min_thetafloat; default=0.1

the maximum interior angle (degrees)

max_thetafloat; default=175.

the maximum interior angle (degrees)

max_skewfloat; default=70.

the maximum skew angle (degrees)

max_aspect_ratiofloat; default=100.

the max aspect ratio

taper_ratiofloat; default=4.0

the taper ratio; applies to CQUAD4s only

max_warping: float: default=20.0

the maximum warp angle (degrees)

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:
modelBDF()

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_mapdict[nid]->index; default=None

a mapper dictionary

Returns:
qualitydict[name](nelements, ) float ndarray

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

valuesThe 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: BDF, xyz_cid0, nid_map, min_theta: float = 0.1, max_theta: float = 175.0, max_skew: float = 70.0, max_aspect_ratio: float = 100.0, max_taper_ratio: float = 4.0, max_warping: float = 60.0) list[int][source]

Get the bad shell elements

Parameters:
modelBDF()

the model object

xyz_cid0(N, 3) float ndarray

the xyz coordinates in cid=0

nid_mapdict[nid]index
nidint

the node id

indexint

the index of the node id in xyz_cid0

min_thetafloat; default=0.1

the maximum interior angle (degrees)

max_thetafloat; default=175.

the maximum interior angle (degrees)

max_skewfloat; default=70.

the maximum skew angle (degrees)

max_aspect_ratiofloat; default=100.

the max aspect ratio

taper_ratiofloat; default=4.0

the taper ratio; applies to CQUAD4s only

max_warping: float: default=60.0

the maximum warp angle (degrees)

Returns:
eids_failedlist[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

area, max_skew, aspect_ratio, min_theta, max_theta, dideal_theta, min_edge_length