def test_quad_180_01(self): r""" Identify a 180+ degree quad EID = 100 (max_theta > 180) y ^ 4 | / | | / | | / | | / | / | 1------2 |----> x \ | \| 3 """ msg = ( 'CEND\n' 'BEGIN BULK\n' 'GRID,1,,0., 0.,0.\n' 'GRID,2,,1., 0.,0.\n' 'GRID,3,,2., -1.,0.\n' 'GRID,4,,2., 1.,0.\n' 'CQUAD4,100,1, 1,2,3,4\n' 'PSHELL,1,1,0.1\n' 'MAT1,1,3.0,, 0.3\n' 'ENDDATA' ) log = SimpleLogger(level='error') bdf_filename = 'cquad4.bdf' with open(bdf_filename, 'w') as bdf_file: bdf_file.write(msg) model = read_bdf(bdf_filename, log=log, xref=True) xyz_cid0 = model.get_xyz_in_coord(cid=0, fdtype='float32') nid_map = {} for i, nid in enumerate(sorted(model.nodes.keys())): nid_map[nid] = i max_theta_active = 180. min_theta = 0.1 max_skew = 1000. max_aspect_ratio = 1000. max_taper_ratio = 1000. # max theta eids_to_delete = get_bad_shells( model, xyz_cid0, nid_map, min_theta=min_theta, max_theta=max_theta_active, max_skew=max_skew, max_aspect_ratio=max_aspect_ratio, max_taper_ratio=max_taper_ratio) assert eids_to_delete == [100], eids_to_delete delete_bad_shells( model, min_theta=min_theta, max_theta=max_theta_active, max_skew=max_skew, max_aspect_ratio=max_aspect_ratio, max_taper_ratio=max_taper_ratio) assert len(model.elements) == 0, model.elements os.remove(bdf_filename)
def test_tri_quality_01(self): r""" Identify a 180+ degree quad EID = 100 (perfect) y ^ 3 | / \ | / \ | / \ | / \ |/ \ 1-----------2----> x EID = 101 (???) y ^ 6 | / \ | / \ | / \ | / \ |/ \ 4----------------------5----> x """ msg = ( 'CEND\n' 'BEGIN BULK\n' 'GRID,1,,0., 0.,0.\n' 'GRID,2,,1., 0.,0.\n' 'GRID,3,,0.5, 1.,0.\n' 'CTRIA3,100,1, 1,2,3\n' 'GRID,4,, 0., 0.,5.\n' 'GRID,5,,300., 0.,5.\n' 'GRID,6,, 0.5, 1.,5.\n' 'CTRIA3,101,1, 4,5,6\n' 'PSHELL,1,1,0.1\n' 'MAT1,1,3.0,, 0.3\n' 'ENDDATA' ) log = SimpleLogger(level='error') bdf_filename = 'cquad4.bdf' with open(bdf_filename, 'w') as bdf_file: bdf_file.write(msg) model = read_bdf(bdf_filename, log=log, xref=True) xyz_cid0 = model.get_xyz_in_coord(cid=0, fdtype='float32') nid_map = {} for i, nid in enumerate(sorted(model.nodes.keys())): nid_map[nid] = i max_skew_active = 70. max_theta_active = 115. max_aspect_ratio_active = 15. min_theta = 0.1 max_theta = 1000. max_skew = 1000. max_aspect_ratio = 1000. # max theta eids_to_delete = get_bad_shells( model, xyz_cid0, nid_map, min_theta=min_theta, max_theta=max_theta_active, max_skew=max_skew, max_aspect_ratio=max_aspect_ratio, ) assert eids_to_delete == [101], eids_to_delete # max skew eids_to_delete = get_bad_shells( model, xyz_cid0, nid_map, min_theta=min_theta, max_theta=max_theta, max_skew=max_skew_active, max_aspect_ratio=max_aspect_ratio, ) assert eids_to_delete == [101], eids_to_delete # aspect ratio eids_to_delete = get_bad_shells( model, xyz_cid0, nid_map, min_theta=min_theta, max_theta=max_theta, max_skew=max_skew, max_aspect_ratio=max_aspect_ratio_active, ) assert eids_to_delete == [101], eids_to_delete delete_bad_shells( model, min_theta=min_theta, max_theta=max_theta_active, max_skew=max_skew, max_aspect_ratio=max_aspect_ratio, ) assert eids_to_delete == [101], eids_to_delete