Hello everyone,
I am very much new to this community. I have a mesh with quadrilateral elements but I wanted in that mesh to have only a particular region to get fine meshed. Is that even possible in Fenicsx. Because I went through some previous discussions like Mesh.refine errror: Refinement only defined for simplices, but I found that there is no refinement in quad element meshes.
Could anyone tell me a way in handling this which is very thankful. Thanks all in advance. My code that I initially tried was,
import numpy as np
from dolfinx.mesh import create_rectangle, locate_entities, refine
from mpi4py import MPI
from dolfinx.io import XDMFFile
from mpi4py import MPI
from dolfinx import mesh
#Creating mesh
msh = mesh.create_rectangle (comm=MPI.COMM_WORLD, points=((0.0, 0.0), (6.0,1.0)), n=(12,2), cell_type=mesh.CellType.quadrilateral)
def top_data(x):
return np.logical_and(np.isclose(x[1], 1), np.logical_and(x[0] >= 2.5, x[0] <= 3))
dim = msh.topology.dim
edges = locate_entities(msh, dim-1, top_data)
msh.topology.create_entities(1)
msh = refine(msh, edges, redistribute=True)
# Output file
file = XDMFFile(MPI.COMM_WORLD, "new_mesh.xdmf", "w")
file.write_mesh(msh)
This code I tried to imitate from existing example but went in vain. So could anyone help in doing this small fine refinement in the particular region. Thanks in advance once again. Any hints on handling the code is very much helpful.