Lets assume we run the Cahn-Hilliard example and we write the solution at each timestep into a “.bp”(seems to be the best supported format of “adios4dolfinx”) file like this:
from dolfinx.io import VTXWriter
import adios4dolfinx as ad
import pathlib
# Step in time
t = 0.0
T = 30 * dt
counter = 0
# Get the sub-space for c and the corresponding dofs in the mixed space
# vector
V0, dofs = ME.sub(0).collapse()
c = u.sub(0)
u0.x.array[:] = u.x.array
with VTXWriter(MPI.COMM_WORLD, f"cahn_hilliard-{element_dof}.bp", [c], engine="BP4") as vtx:
vtx.write(t)
while (t < T): # (t < T)
counter += 1
t += dt
r = solver.solve(u)
print(f"Step {int(t/dt)}: num iterations: {r[0]}")
u0.x.array[:] = u.x.array
vtx.write(t)
Now assume I want to reuse one of the solutions at a certain timestep.
Posts from this forum like I/O from XDMF/HDF5 files in dolfin-x
suggests to use adios4dolfinx
.
Since v0.2.0
it seemingly can read mesh and function from the same file.
But it is still not able to extract it a certain time?
Do I have to change the way I save the timeseries?