![]() empty () marked_facets, facet_values = np. bcast ( None, root = 0 ) cells, x = np. bcast ( None, root = 0 ) num_nodes = MPI. getElementType ( "triangle", 2 ) marked_facets = topologies facet_values = topologies else : gmsh_cell_id = MPI. shape, root = 0 ) gmsh_facet_id = model. getCurrent ()) cells = topologies cell_data = topologies num_nodes = MPI. getElementType ( "tetrahedron", 2 ), root = 0 ) # Get mesh data for dim (0, tdim) for all physical entities topologies = extract_gmsh_topology_and_markers ( model, model. getCurrent ()) # Broadcast cell type data and geometric dimension gmsh_cell_id = MPI. setNumber ( "General.Terminal", 0 ) # Sort mesh nodes according to their index in gmsh x = extract_gmsh_geometry ( model, model. setNumber ( "General.Terminal", 1 ) model. setCurrent ( "Sphere minus box" ) # Generate second order mesh and output gmsh messages to terminal model. rank = 0 : # Using tCurrent(model_name) lets you change between models model. Generate mesh on rank 0, then build a distributed mesh. write_meshtags ( mt, geometry_xpath = )Ĭreate a distributed (parallel) mesh with quadratic geometry. COMM_WORLD, "mesh.xdmf", "w" ) as file : file. name = "ball_d1_surface" with XDMFFile ( MPI. AdjacencyList_int32 ( local_entities ), np. create_connectivity ( 2, 0 ) mt = create_meshtags ( mesh, 2, cpp. name = "ball_d1" local_entities, local_values = extract_local_entities ( mesh, 2, marked_facets, facet_values ) mesh. COMM_WORLD, cells, x, ufl_mesh_from_gmsh ( gmsh_cell_id, 3 )) mesh. getElementType ( "triangle", 1 ) marked_facets = topologies facet_values = topologies else : gmsh_cell_id = MPI. getElementType ( "tetrahedron", 1 ), root = 0 ) # Get mesh data for dim (0, tdim) for all physical entities topologies = extract_gmsh_topology_and_markers ( model, "Sphere minus box" ) cells = topologies cell_data = topologies num_nodes = MPI. generate ( 3 ) # Sort mesh nodes according to their index in gmsh x = extract_gmsh_geometry ( model, model_name = "Sphere minus box" ) # Broadcast cell type data and geometric dimension gmsh_cell_id = MPI. setPhysicalName ( 3, 2, "Sphere volume" ) model. addPhysicalGroup ( 3, volume_entities, tag = 2 ) model. setPhysicalName ( 2, 1, "Sphere surface" ) # Add physical tag 2 for the volume volume_entities = for model in model. addPhysicalGroup ( 2, boundary_ids, tag = 1 ) model. getBoundary (( 3, model_dim_tags )) boundary_ids = for b in boundary ] model. synchronize () # Add physical tag 1 for exterior surfaces boundary = model. addSphere ( 0, 0, 0, 1 ) box_dim_tags = model. setCurrent ( "Sphere minus box" ) sphere_dim_tags = model. Generate mesh on rank 0, then build a distributed mesh write_mesh ( mesh )Ĭreate a distributed (parallel) mesh with affine geometry. COMM_SELF, cells, x, ufl_mesh_from_gmsh ( element_types, x. reshape ( - 1, num_nodes ) - 1 mesh = create_mesh ( MPI. getElementProperties ( element_types ) cells = node_tags. getElements ( dim = 3 ) assert len ( element_types ) = 1 name, dim, order, num_nodes, local_coords, num_first_order_nodes = model. generate ( 3 ) # Sort mesh nodes according to their index in gmsh (Starts at 1) x = extract_gmsh_geometry ( model, model_name = "Sphere" ) # Extract cells from gmsh (Only interested in tetrahedrons) element_types, element_tags, node_tags = model. addSphere ( 0, 0, 0, 1, tag = 1 ) # Generate mesh model. setNumber ( "General.Terminal", 0 ) model = gmsh.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |