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: 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.nanif element type does not define the parameter. For example, CELAS1 doesn’t have an aspect ratio.
- valuesThe result is
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.quad_quality(element, p1, p2, p3, p4)[source]
gets the quality metrics for a quad
- pyNastran.bdf.mesh_utils.delete_bad_elements.quad_quality_nastran(p1: ndarray, p2: ndarray, p3: ndarray, p4: ndarray) tuple[float, float, float][source]
Compute CQUAD4 quality metrics using NX Nastran GEOMCHECK definitions.
- Parameters:
- p1, p2, p3, p4(3,) float ndarray
Corner node coordinates in order.
- Returns:
- skewfloat
Skew angle in radians (NX: angle between midpoint-joining vectors). Ideal = pi/2. Nastran fails if skew < 30 deg.
- taperfloat
Taper ratio (NX: (A_max - Q) / Q). Ideal = 0.0. Nastran fails if taper > 0.5.
- warpfloat
Surface warping factor (NX: HH / (D_AC + D_BD)). Ideal = 0.0. Nastran fails if warp > 0.05.
Notes
These formulas match NX Nastran User’s Guide Ch. 15 “User Controlled Element Checks” (Simcenter Nastran 2506).
The existing
quad_qualityfunction uses Altair/HyperMesh definitions which differ for taper (average deviation) and warp (angle-based).