def test_export_to_abaqus(self): """Test Phons reader for neper inp files.""" export_to_abaqus("test_file.inp", self.mesh, write_2d_elements=True) read_from_abaqus_inp("test_file.inp") export_to_abaqus("test_file_2.inp", self.mesh, write_2d_elements=True) assert (filecmp.cmp("test_file.inp", "test_file_2.inp"))
def test_export_to_abaqus(self): """Test Phons reader for neper inp files.""" export_to_abaqus("test_file.inp", self.mesh, write_2d_elements=True) read_from_abaqus_inp("test_file.inp") export_to_abaqus("test_file_2.inp", self.mesh, write_2d_elements=True) assert (filecmp.cmp("test_file.inp", "test_file_2.inp"))
def test_create_fence_elements(self): thickness = 0.01 # Test finite thickness cohesive with order 1 create_matrix(self.mesh, thickness, mesh_dimension=3) create_matrix(self.mesh_2d, thickness, mesh_dimension=2) export_to_abaqus("n10-id1_fence.inp", self.mesh, write_2d_elements=False) export_to_abaqus("n10-id1_2d_fence.inp", self.mesh_2d, write_2d_elements=True)
def test_create_cohesive_elements(self): create_cohesive_elements(self.mesh, mesh_dimension=3) export_to_abaqus("n10-id1_coh.inp", self.mesh, write_2d_elements=False) self.assertEqual(len(self.mesh.element_sets["cohes9_2"].ids), 6) #self.assertTrue(filecmp.cmp("n10-id1_coh.inp", # os.path.join(__location__, "mesh_test_files/n10-id1_coh_ref.inp"))) create_cohesive_elements(self.mesh_2d, mesh_dimension=2) export_to_abaqus("n10-id1_2d_coh.inp", self.mesh_2d, write_2d_elements=True)
def test_create_fence_elements(self): thickness = 0.01 # Test finite thickness cohesive with order 1 create_matrix(self.mesh, thickness, mesh_dimension=3) create_matrix(self.mesh_2d, thickness, mesh_dimension=2) export_to_abaqus("n10-id1_fence.inp", self.mesh, write_2d_elements=False) export_to_abaqus("n10-id1_2d_fence.inp", self.mesh_2d, write_2d_elements=True)
from phon.io_tools.read.read_from_abaqus_inp import read_from_abaqus_inp from phon.io_tools.write.export_to_abaqus import export_to_abaqus from phon.mesh_tools.create_cohesive_elements import create_cohesive_elements inputfile = "../test/mesh_test_files/n10-id1.inp" mesh = read_from_abaqus_inp(inputfile, verbose=0) create_cohesive_elements(mesh, 3) export_to_abaqus("n10-id1_coh.inp", mesh, write_2d_elements=False)
help="Scale to scale all the nodes with.", type=float) parser.add_argument( '-v', '--verbose', action='count', help="Level of verbosity, -v for level 1, -vv for level 2 etc.", default=0) args = parser.parse_args() mesh = read_from_gmsh(args.basefilename, args.n_grains, args.verbose) create_cohesive_elements(mesh, mesh_dimension=3) # Rescale the RVE: if args.scale: for node_id, node in mesh.nodes.items(): node.c *= args.scale print("Exporting to " + args.output + "...") if args.output == "abaqus": export_to_abaqus(ntpath.basename(args.basefilename) + "_coh.inp", mesh, write_2d_elements=False) if args.output == "oofem": export_to_oofem(ntpath.basename(args.basefilename) + "_coh.in", mesh, write_2d_elements=False) print("Done!")
requiredNamed.add_argument("-b", "--basefilename", help="The basename of the files, that is everything before the " "grain id and the file extension.", required=True) requiredNamed.add_argument("-n", "--n_grains", help="The number of total grains, you should have " "one .msh file for each grain.", required=True, type=int) requiredNamed.add_argument('-o', '--output', choices=["abaqus", "oofem"], help='Software to export the mesh to.', required=True) parser.add_argument("-s", '--scale', help="Scale to scale all the nodes with.", type=float) parser.add_argument('-v', '--verbose', action='count', help="Level of verbosity, -v for level 1, -vv for level 2 etc.", default=0) args = parser.parse_args() mesh = read_from_gmsh(args.basefilename, args.n_grains, args.verbose) create_cohesive_elements(mesh, mesh_dimension=3) # Rescale the RVE: if args.scale: for node_id, node in mesh.nodes.items(): node.c *= args.scale print("Exporting to " + args.output + "...") if args.output == "abaqus": export_to_abaqus(ntpath.basename(args.basefilename) + "_coh.inp", mesh, write_2d_elements=False) if args.output == "oofem": export_to_oofem(ntpath.basename(args.basefilename) + "_coh.in", mesh, write_2d_elements=False) print("Done!")