def test_read_write_code_aster_to_xdmf(self): a = Assembly("meshio_from_ca", "temp") a.read_fem(example_files / "fem_files/meshes/med/box.med", fem_converter="meshio") a.to_fem("box_analysis_xdmf", fem_format="xdmf", fem_converter="meshio")
def test_bm_eigenfrequency_shell(self): bm = test_bm() p = Part("MyPart") a = Assembly("MyAssembly") / [p / bm] create_beam_mesh(bm, p.fem, "shell") fix_set = p.fem.add_set(FemSet("bc_nodes", get_beam_end_nodes(bm), "nset")) a.fem.add_bc(Bc("Fixed", fix_set, [1, 2, 3, 4, 5, 6])) a.fem.add_step(Step("Eigen", "eigenfrequency")) a.to_fem("Cantilever_CA_EIG_sh", "abaqus", overwrite=True) a.to_fem("Cantilever_CA_EIG_sh", "sesam", overwrite=True) res = a.to_fem("Cantilever_CA_EIG_sh", "code_aster", overwrite=True, execute=True) f = h5py.File(res.results_file_path) modes = f.get("CHA/modes___DEPL") for mname, m in modes.items(): mode = m.attrs["NDT"] freq = m.attrs["PDT"] print(mode, freq)
def test_write_simple_stru(self): from ada.param_models.basic_module import SimpleStru a = Assembly('MyTest') p = SimpleStru('SimpleStru') a.add_part(p) p.gmsh.mesh() a.to_fem('MyTest', fem_format='sesam', overwrite=True)
def test_write_simple_stru(self): from ada.param_models.basic_module import SimpleStru a = Assembly("MyTest") p = a.add_part(SimpleStru("SimpleStru")) p.gmsh.mesh() a.to_fem("MyTest", fem_format="sesam", overwrite=True)
def test_read_write_code_aster_to_abaqus(self): a = Assembly('meshio_from_ca', 'temp') a.read_fem(os.path.join(this_dir, example_files / 'fem_files/meshes/med/box.med'), fem_converter='meshio') a.to_fem('box_analysis_abaqus', fem_format='abaqus', fem_converter='meshio')
def test_read_write_portal_frame(self): name = "portal" a = Assembly() a.read_fem(example_files / "fem_files/code_aster/portal_01.med", "code_aster", name=name) a.to_fem(name, "code_aster", overwrite=True) b = Assembly() b.read_fem((Settings.scratch_dir / name / name).with_suffix(".med"), fem_format="code_aster") p_a = a.parts[name] p_b = b.parts[name] compare_fem_objects(p_a.fem, p_b.fem)
def test_read_write_box(self): name = "box" a = Assembly() a.read_fem(example_files / "fem_files/meshes/med/box.med", "code_aster", name="box") a.to_fem(name, "code_aster", overwrite=True) b = Assembly() b.read_fem((Settings.scratch_dir / name / name).with_suffix(".med"), fem_format="code_aster") p_a = a.parts["box"] p_b = b.parts["box"] compare_fem_objects(p_a.fem, p_b.fem)
def test_plate_mesh(self): import gmsh try: gmsh.finalize() except BaseException as e: logging.error(e) pass gmsh.initialize() gmsh.option.setNumber("General.Terminal", 1) gmsh.option.setNumber("Mesh.SecondOrderIncomplete", 1) gmsh.option.setNumber("Mesh.Algorithm", 8) gmsh.option.setNumber("Mesh.ElementOrder", 1) pl1 = Plate("MyPl", [(0, 0, 0.2), (5, 0, 0.2), (5, 5), (0, 5)], 20e-3, **atts) pl2 = Plate("MyPl2", [(0, 0, 0.2), (5, 0, 0.2), (5, 5), (0, 5)], 20e-3, **atts2) points = [(1, 1, 0.2), (2, 1, 0.2), (2, 2, 0.2), (1, 2, 0.2)] pl1.add_penetration( PrimExtrude("poly_extrude", points, **align_to_plate(pl1))) pl1.add_penetration( PrimExtrude("poly_extrude2", points, **align_to_plate(pl2))) gmsh.model.add("Test") p = Part("MyFem") / [pl1, pl2] create_plate_mesh(pl1, "shell", fem=p.fem, interactive=False, gmsh_session=gmsh) create_plate_mesh(pl2, "shell", fem=p.fem, interactive=False, gmsh_session=gmsh) a = Assembly("Test") / p a.to_ifc(test_folder / "ADA_pl_mesh_ifc") step = a.fem.add_step(Step("gravity", "static", nl_geom=True)) step.add_load(Load("grav", "gravity", -9.81)) a.to_fem("ADA_pl_mesh", "abaqus", scratch_dir=test_folder, overwrite=True)
def test_to_fem(self): param_model = SimpleStru("ParametricModel") param_model.gmsh.mesh(order=1, size=0.1, max_dim=2, interactive=False) param_model.add_bcs() assert len(param_model.fem.bcs) == 4 assert len(param_model.fem.elements) == 10420 assert len(param_model.fem.nodes) == 5318 a = Assembly("ParametricSite") a.add_part(param_model) my_step = Step("static", "static", total_time=1, max_incr=1, init_incr=1, nl_geom=True) my_step.add_load(Load("Gravity", "gravity", -9.81)) a.fem.add_step(my_step) a.to_fem("SimpleStru", fem_format="abaqus", overwrite=True)
def to_fem( self, mesh_size, geom_repr, name: str, fem_format: str, options: GmshOptions = None, silent=True, use_quads=False, use_hex=False, return_assembly=False, **kwargs, ): from ada import Assembly, Part p = Part(name) p.fem = self.to_fem_obj(mesh_size, geom_repr, options, silent, use_quads, use_hex, name) a = Assembly() / (p / self) if return_assembly: return a a.to_fem(name, fem_format, **kwargs)
def test_beam_mesh(self): import gmsh try: gmsh.finalize() except: pass bm = Beam(f"bm1", n1=[0, 0, 0], n2=[1, 0, 0], sec="IPE220") bm.add_penetration( PrimCyl("Cylinder", (0.5, -0.5, 0), (0.5, 0.5, 0), 0.05)) p = Part('MyFem') p.add_beam(bm) create_beam_mesh(bm, p.fem, "solid", interactive=False) a = Assembly('Test') / p a.to_fem('my_test', 'xdmf', scratch_dir=test_folder, fem_converter='meshio', overwrite=True)
def test_beam_mesh(self): import gmsh try: gmsh.finalize() except BaseException as e: logging.error(e) pass bm = Beam("bm1", n1=[0, 0, 0], n2=[1, 0, 0], sec="IPE220") bm.add_penetration( PrimCyl("Cylinder", (0.5, -0.5, 0), (0.5, 0.5, 0), 0.05)) p = Part("MyFem") p.add_beam(bm) create_beam_mesh(bm, p.fem, "solid", interactive=False) a = Assembly("Test") / p a.to_fem("my_test", "xdmf", scratch_dir=test_folder, fem_converter="meshio", overwrite=True)