![]() ![]() I hope I gave enough informations and my question is understandable otherwise please don’t hesitate to correct me or ask further questions. ![]() How can i change the last script so that i not only apply the DirichletBCs for 11 but also a periodicBC between 44? Python code def boundary conditions(self, V, Q): Create no-slip boundary condition for. OUTLET = DirichletBC(V, Constant(0), loadedBoundaryList, 9999)į_BE = (C - C_0) * v * dx + dt_initial * D * dot(grad(C), grad(v)) * dxį_C = (C - C_0) * v * dx + 0.5 * dt * D * dot(grad(C), grad(v)) * dx + 0.5 * dt * D * dot(grad(C_0), grad(v)) * dx The FEniCS Book Anders Logg, Kent-Andre Mardal, Garth Wells. INLET = DirichletBC(V, Constant(1), loadedBoundaryList, 1111) 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: From the FEniCS (dolfin-version 2019.2.0.dev0) tutorial site, I imported the code for the square, modified the EBC (essential boundary condition) on the square and executed the script. However, it is not native to FEniCS, and so we need to convert the mesh to. Hi I am having a trouble with a code and here is the problem: I want to solve the Poisson equation with a zero Dirichlet BC on a square and a disk. Mvc = MeshValueCollection("size_t", mesh, mesh.topology().dim() - 1) show how to define a finite element discretization of the diffusion equation. 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) Mesh_2d = create_mesh(msh, "triangle", True)īoundaries = create_mesh(msh, "line", True) # 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) # Read all relevant cells and get their physical dataĬell_data = mesh.get_cell_data("gmsh:physical", cell_type) MeshFile = Meshdirectory + 'rect_periodic.msh'ĭef create_mesh(mesh, cell_type, prune_z=False): # Directory and name of the mesh which will be transformed simulator uses the following open-source software: Gmsh10 to define the geometry. Curve Loop and Surface of the rectangle 3.6 Numerical solution with Python and FEniCS. But I can’t figure out how to apply periodic BCs with the Line Tags created with GMSH. From the FEniCS (dolfin-version 2019.2.0. Furthermore I was able to use the boundarys specified in GMSH to define DirechletBC in FEniCS. I want to solve the Poisson equation with a zero Dirichlet BC on a square and a disk. 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. |