![]() write ( save_path ) # Save and close gmsh. ![]() write ( filename + ".geo_unrolled" ) replace ( filename + ".geo_unrolled", filename + file_extension ) else : gmsh. synchronize () filename, file_extension = splitext ( save_path ) if file_extension = ".geo" : gmsh. setPhysicalName ( 3, 1, "rotor" ) # Generate the 3D mesh factory. setPhysicalName ( 3, 1, "stator" ) else : model. addPhysicalGroup ( 3, list ( range ( 1, Zs + 1 )), 1 ) if lamination. extrude (, 0, 0, L, numElements =, recombine = False ) model. extrude (, 0, 0, L, numElements =, recombine = True ) else : ov = factory. setPhysicalName ( 2, 2, "Lamination" ) # Extrude the lamination for surf in surf_list : if is_rect = True : ov = factory. addPhysicalGroup ( 2, surf_list, 2 ) gmsh. setTransfiniteCurve ( ii + 1, mesh_dict + 1, "Progression" ) # Copy/Rotate all the tooth to get the 2D lamination surf_list = for ii in range ( Zs ): ov = factory. update ( user_mesh_dict ) # Apply the number of element on each line of the surface for ii, line in enumerate ( tooth_surf. comp_mesh_dict ( element_size = mesh_size ) # Overwrite basic mesh dict with user one mesh_dict. setRecombine ( 2, 1 ) # Change the mesh size for each line if user_mesh_dict is not None : # Compute basic mesh_dict mesh_dict = tooth_surf. setPhysicalName ( 2, 1, "Tooth" ) # convert triangle mesh to rectangle mesh if is_rect : factory. addCurveLoop ( list ( range ( 1, NLine + 1 )), 1 ) gmsh. Adding the line (2) to this script with transfiniteFalse (tetra mesh. I demonstrate this problem at the official Gmsh demo-model terrainstl.py. addLine ( NLine, NLine + 1, NLine ) # Create the Tooth surface gmsh. Quite moderately shaped terrains, given as stl -file, lead to unusable meshes ( jac.<0) when meshed with higher order elements (required for geomechanical simulations). addCircleArc ( NLine, NPoint, NLine + 1, NLine ) else : factory. ![]() imag, - L / 2, mesh_size, NPoint ) factory. addLine ( NLine, 1, NLine ) else : if isinstance ( line, Arc ): Zc = line. addCircleArc ( NLine, NPoint - 1, 1, NLine ) else : factory. All the meshes produced by Gmsh are considered as unstructured, even if they were generated in a structured way (e.g., by extrusion). get_lines ()): if isinstance ( line, Arc ): Zc = line. get_lines (): NLine += 1 if NLine = len ( tooth_surf. imag, - L / 2, mesh_size, NPoint ) # Draw all the lines of the tooth NLine = 0 # Number of line created for line in tooth_surf. add ( "Pyleecan" ) # Create all the points of the tooth NPoint = 0 # Number of point created for line in tooth_surf. setNumber ( "Geometry.CopyMeshingMethod", 1 ) model. setNumber ( "General.Terminal", int ( display )) gmsh. L1 # Lamination length # Start a new model gmsh. build_geometry ( sym = sym ) Zs = sym # For readibility model = gmsh. get_Zs () else : tooth_surf = lamination. The gmsh input is shown below and this is the first text to put into the structured_ex.geo file.Def gen_3D_mesh ( lamination, save_path = "Lamination.msh", sym =- 1, mesh_size = 5e-3, user_mesh_dict = None, is_rect = False, Nlayer = 20, display = True, ): """Draw 3D mesh of the lamination Parameters - lamination: LamSlot Lamintation with slot to draw save_path: str Path to save the msh result file sym : int Number of symmetry to apply mesh_size : float Size of the mesh user_mesh_dict : dict To enforce the number of elements on the lines is_rect : bool To use rectangular elements Nlayer : int Number of mesh layer on Z axis display : bool To display gmsh logs Returns - None """ # The defaut symmetry is Zs => We draw only one tooth if sym = - 1 : tooth_surf = lamination. To create the square, four points are speficied and these are connected by four lines. For this tutorial, a square shape is first created. ![]() further mesh and geometry construction (i.e. The shape to be meshed will be created by specifying points and then connecting these points with lines. This paper reports progress on implementing a new capability of adaptive mesh. The first step in creating a mesh is to create some shape that will be meshed. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |