Hi.
I want to perform calculation with complex-shaped domain.
To apply Dirichlet bcs to the domain, I have to locate entities but I cannot use “dolfinx.fem.locate_entities” due to complexity of mesh shape.
I mean, I have to define the function “locateEntitiesOnPoint” s.t.
import dolfinx.fem
import dolfinx.mesh
import numpy as np
import pyvista
from mpi4py import MPI
import ufl
import basix.ufl
mesh = pyvista.read(mesh.vtu)
points = np.array(mesh.points)
cells = mesh.cells_dict[pyvista.CellType.TETRA]
elm = ufl.Mesh(basix.ufl.element("Lagrange", "tetrahedron", 1, shape=(3,)))
mesh = dolfinx.mesh.create_mesh(MPI.COMM_WORLD, cells, points, elm)
def locateEntitiesOnPoint(mesh, x, X, Y, Z):
~some computation~
X, Y, Z = 0, 0, 0
facets = locateEntitiesOnPoint(mesh, x, X, Y, Z):
Is there any examples or tutorials?
Version of dolfinx is 0.8.0.
Thanks.
Hi, @dokken. Thank you for your reply.
I constructed “mesh.vtu” from a medical image so it doesn’t have the boundary markers.
Could you tell me if there are any methods to mark the boundaries of VTK files for dolfinx?
Then I am a bit confused. If your VTK file doesn’t have markers, and you can’t write an expression based of spatial coordinates to define them, you would need a GUI to manually mark the appropriate boundaries?
You could use for instance gmsh (first convert your vtu to msh) and manually mark it there.
However, if the mesh is based of a medical image, surely your meshing tool must have some marking capability?
Hi @dokken. Thank you for your information. Finally I’ve generated the mesh successfully.
But I have another question now.
How do I set different value of material constants to each physical volumes?
Is there any dolfinx function to locate dofs using physical volume tag?