Importing shell mesh to FEniCS. I have nodes and element connectivity. I tried it importing using gmsh (converted .cgns file to .msh ). On converting to .xml using dolfin-convert, I am getting error " Unable to find cells of supported types".
Can you provide a convenient way of importing shell mesh?
I want to use my own basis functions. How can I add it to UFL library so that installed FEniCS supports it? Can I define a UFL function in the code itself for new basis functions.
(My requirement was to use curvilinear coordinates (xi,eta) to interpolate the geometry as used by commercial software? Is there any existing basis function satisfying this requirement? The basis functions are for 8 noded shell element).
I would try to switch to meshio. Can you recommend the specific examples for meshio? Does it treat shell element as a quad element or any other specific element?
For FEniCSx, is there any reference guide other than available demos to follow changed basic UFL, Dolfin syntax like in legacy FENiCS (there was an entire available book) for getting better clarity. Any suggestion is helpful.
In your tutorial, you define that for using meshio, we need to remove the z coordinate. But, my mesh is defined in 3D space using quad elements shown in above figure. I am not able to figure out with meshio.
Using the above .msh file I tried meshio for the above quad shell element in 3D space. It is reading the shell mesh but, I need to ask how to proceed to get subdomains and mesh used by PBC and functionspace respectively.
import meshio
import numpy as np
# Read in mesh
msh = meshio.read("a.msh")
# Helper function to extract the cells and physical data
def create_mesh(mesh, cell_type, prune_z=False):
cells = mesh.get_cells_type(cell_type)
cell_data = mesh.get_cell_data("gmsh:physical", cell_type)
points = mesh.points[:,:2] if prune_z else mesh.points
out_mesh = meshio.Mesh(points=points, cells={cell_type: cells}, cell_data={"name_to_read":[cell_data]})
return out_mesh
print(np.unique(msh.cell_data_dict['gmsh:physical']['quad']))
#print(np.unique(msh.cell_data_dict['gmsh:physical']['hexahedron']))
# Convert mesh to XDMF
quad_mesh = create_mesh(msh, "quad", prune_z=False)
#meshio.write("3Dmesh/3Dblock_facet_mesh.xdmf", quad_mesh)
#hexahedron_mesh = create_mesh(msh, "hexahedron", prune_z=False)
#meshio.write("3Dmesh/3Dblock_mesh.xdmf", hexahedron_mesh)
quad_mesh
<meshio mesh object>
Number of points: 40
Number of cells:
quad: 8
Cell data: name_to_read
My query is: what is the meshio alternative to get mesh and physical space.
Legacy dolfin does not support quadrilateral elements read from file. You would have to use DOLFINx for this.
I do not understand the last bit of your question. Reading in cell markers or facet markers has to be done by adding cell data to the corresponding meshes, as done in the tutorials.
(there is no example of FEniCSx where you used external imported mesh and solved the variational problem). Can you give MWE for imported mesh to create FE formulation?
2.
WARNING:py.warnings:/home/bagla0/.local/lib/python3.10/site-packages/h5py/__init__.py:36: UserWarning: h5py is running against HDF5 1.10.7 when it was built against 1.14.2, this may cause problems
_warn(("h5py is running against HDF5 {0} when it was built against {1}, "
And with this the kernel dies everytime.
In legacy-fenics, we use the below code (MeshFunction) to get different subdomain using MeshFunction. What is MeshFunction alternative in fenicsx to define different subdomains?