![]() From the FEniCS (dolfin-version 2019.2.0. I hope I gave enough informations and my question is understandable otherwise please don’t hesitate to correct me or ask further questions. I want to solve the Poisson equation with a zero Dirichlet BC on a square and a disk. How can i change the last script so that i not only apply the DirichletBCs for 11 but also a periodicBC between 44? range of finite elements using any user-defined or built-in linear algebra. INLET = DirichletBC(V, Constant(1), loadedBoundaryList, 1111) Additional Key Words and Phrases: DOLFIN, FEniCS Project, Code Generation. Num_steps_initial = 10 # Number of initial time stepsĭt_initial = dt / 10 # Initial time step sizeĭir_name = 'SimTest' # Folder for the results LoadedBoundaryList = (mesh, mvc)ĭs_custom = Measure("ds", domain=mesh, subdomain_data=loadedBoundaryList, subdomain_id=12) With XDMFFile("boundaries.xdmf") as infile: Mvc = MeshValueCollection("size_t", mesh, mesh.topology().dim() - 1) Mvc = MeshValueCollection("size_t", mesh, mesh.topology().dim())Ĭf = (mesh, mvc) Meshio.write("boundaries.xdmf", boundaries) # Write the extracted mesh and boundaries to xdmf files (the h5 files are created automatically) Next to defining the geometry directly in a gmsh script, it is also possible. Mesh_2d = create_mesh(msh, "triangle", True)īoundaries = create_mesh(msh, "line", True) FEniCS, Adaptive mesh refinement, Atmospheric boundary layer, Direct finite. # Extract the mesh and the boundaries from the msh file Return meshio.Mesh(points=outpoints, cells=) # The relevant points and cells are combined to a meshio mesh and returned Outpoints = np.delete(arr=mesh.points, obj=2, axis=1) # In this case the z axis is deleted from the mesh (gmsh and salome always create 3d meshes) DirichletBC takes three arguments, the first one is our function space V, the next is the boundary condition value and the third is the subdomain indicator which is information stored in the mesh. # Read all relevant cells and get their physical dataĬell_data = mesh.get_cell_data("gmsh:physical", cell_type) In the Fenics documentation, it is mentionned that. MeshFile = Meshdirectory + 'rect_periodic.msh'ĭef create_mesh(mesh, cell_type, prune_z=False): Again, we choose u 1 + x 2 + 2 y 2 as the exact solution and adjust f, g, and u D. The complete boundary-value problem can be written as. # Directory and name of the mesh which will be transformed Let D and N denote parts of the boundary where the Dirichlet and Neumann conditions apply, respectively. Curve Loop and Surface of the rectangle But I can’t figure out how to apply periodic BCs with the Line Tags created with GMSH. Furthermore I was able to use the boundarys specified in GMSH to define DirechletBC in FEniCS. I was already able to create meshes with GMSH and import them into FEniCS using the msh to xdmf conversion method. I am still relative new to FEniCS and this is my first forum post.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |