jorgensd / mesh_converter

A mesh converter from EXODUS 2 to XDMF
MIT License
4 stars 0 forks source link

MPI comm error #3

Closed drtloudon closed 5 months ago

drtloudon commented 5 months ago

Following your example, when I try to write an exodus mesh to xdmf format using the write_mesh function, I get the following error:

TypeError Traceback (most recent call last)

in ----> 1 write_mesh(mesh_in, 'quarter_shell_tet.xdmf') ~/.local/lib/python3.10/site-packages/mesh_converter/writer.py in write_mesh(mesh, filename) 146 # Create ADIOS2 reader 147 assert MPI.COMM_WORLD.size == 1, "Mesh convert only works in serial for now" --> 148 adios = adios2.ADIOS(MPI.COMM_WORLD) 149 io = adios.DeclareIO("Mesh writer") 150 io.SetEngine("HDF5") TypeError: __init__(): incompatible constructor arguments. The following argument types are supported: 1. adios2.bindings.adios2_bindings.ADIOS() 2. adios2.bindings.adios2_bindings.ADIOS(configFile: str) Invoked with: I created a conda environment and downloaded the dependencies as you suggest.
jorgensd commented 5 months ago

This indicates that adios2 has not been installed with MPI support, as shown with the command:

conda install -c conda-forge adios2=*=mpi_* mpich mpi4py netcdf4

Please list the exact commands you ran, and the full traceback/output of this command.

drtloudon commented 5 months ago

The conda environment I created was loading an external adios2 package. Once I fixed that, I'm able to use the write_mesh function without error. However, when I go to load the created xdmf mesh inside dolfinx using:

from dolfinx import io from mpi4py import MPI with io.XDMFFile(MPI.COMM_WORLD, 'quarter_shell_tet.xdmf', 'r') as file: mesh = file.read_mesh(name='Grid')

I get the error:

Traceback (most recent call last): File "/home/tloudon/Research/Elasticity/ShearLocking/test.py", line 3, in with io.XDMFFile(MPI.COMM_WORLD, 'quarter_shell_tet.xdmf', 'r') as file: RuntimeError: Empty root node.

Any help is appreciated. Thanks.

jorgensd commented 5 months ago

Please add the contents of the xdmf file here

drtloudon commented 5 months ago

The contents of quarter_shell_tet.xdmf are

<?xml version="1.0"?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<XDMF Version="3.0" xmlns:xi="http://www.w3.org/2001/XInclude"><Domain><Grid GridType="Uniform" Name="Mesh"><Topology NumberOfElements="4399" TopologyType="Tetrahedron" NodesPerElement="4"><DataItem Dimensions="4399 4" Format="HDF">quarter_shell_tet.h5:/Step0/Connectivity_tetra</DataItem></Topology><Geometry GeometryType="XYZ"><DataItem Dimensions="1615 3" Format="HDF">quarter_shell_tet.h5:/Step0/Points</DataItem></Geometry><Attribute Name="Cell markers" AttributeType="Scalar" Center="Cell"><DataItem Dimensions="4399" Format="HDF" DataType="Int">quarter_shell_tet.h5:/Step0/Cell_Markers</DataItem></Attribute></Grid><Grid GridType="Uniform" Name="Facet_Mesh"><Topology NumberOfElements="3220" TopologyType="Triangle" NodesPerElement="3"><DataItem Dimensions="3220 3" Format="HDF">quarter_shell_tet.h5:/Step0/Connectivity_triangle</DataItem></Topology><Geometry GeometryType="XYZ"><DataItem Dimensions="1615 3" Format="HDF">quarter_shell_tet.h5:/Step0/Points</DataItem></Geometry><Attribute Name="Facet markers" AttributeType="Scalar" Center="Cell"><DataItem Dimensions="3220" Format="HDF" DataType="Int">quarter_shell_tet.h5:/Step0/Facet_Markers</DataItem></Attribute></Grid></Domain></XDMF>
jorgensd commented 5 months ago

That looks ok to me. Could you try to open it in paraview and see if it looks ok?

could you Also try: read_mesh(name="Mesh") or is it opening the file that fails?

drtloudon commented 5 months ago

It's opening the file that throws the error. I can modify the code to:

from dolfinx import io
from mpi4py import MPI
file = io.XDMFFile(MPI.COMM_WORLD, 'quarter_shell_tet.xdmf', 'r')

and get the error. I put name='Grid' because previously I've used meshio where 'Grid' was the default name. Everything looks normal in Paraview. Even if I remove the facet blocks from the exodus file before converting to xdmf, I still get the same empty root node error.

jorgensd commented 5 months ago

That’s weird. Could you provide the xdmf and h5 file somewhere? Then I can run it tomorrow.

drtloudon commented 5 months ago

I emailed them to you. Not sure what the "accepted" method for sharing files is. Thanks again for your help.

jorgensd commented 5 months ago

Got the email. Will have a look tomorrow or sometime this weekend.

jorgensd commented 5 months ago

@drtloudon I've pushed a fix for the issue. Turns out DOLFINx has specific caps dependencies on the root note "Xdmf", which I initally wrote as "XDMF", as it works with Paraview.

drtloudon commented 5 months ago

Thanks for your help.