dokken
February 23, 2024, 3:55pm
4
This is expected, as the default format of XDMF is hdf5 (a binary format suitable for parallel computing).
If you want to store just a single file, you can change the encoding to dolfinx.io.XDMFFile.Encoding.ASCII
(it is a keyword arg to the init function of XDMFFile).
You are using the wrong extension for the file format VTKFile
as it should be PVD.
charithjeewantha:
My main goal
Is to upload what I have saved externally, that is:
u_n = Coefficient(FunctionSpace(Mesh(blocked element (Basix element (P, triangle, 1, gll_warped, unset, False), (2,)), 1), VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)), 5)
and the
mesh =<dolfinx.mesh.Mesh at 0x7f39cef63ac0>
And the closest I could get is this:
with io.XDMFFile(MPI.COMM_WORLD, "u_n_test1_from_vtk.xdmf", "r") as xdmf_file_read:
read_mesh = xdmf_file_read.read_mesh(mesh)
read_u_h = xdmf_file_read.read_function(u_n)
And this gave me an error: Unable to open HDF5 file. File u_n_test1_from_vtk.h5 does not exist.
When I looked through the discourse for this error, I went down on a rabbit hole of about meshio
but I don’t think that supports the mesh data we have in the Navier Stokes solver given in the tutorial: Implementation — FEniCSx tutorial (jsdokken.com)
Could you please give me a help if you have time. This problem really causing me a lot of issues…
You need to use my code adios4dolfinx
(GitHub - jorgensd/adios4dolfinx: Interface of ADIOS2 for DOLFINx ) which is installable through pypi for function checkpointing.
See for instance: Parallel function saving and reading it back using PETSc or adios4dolfinx - #15 by dokken
for a description of how to use it.
1 Like