This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

XDMF time data

0 votes

Dear all,

I have the following variable that I write into an XDMF file:

t = 0.0
ufile1 = XDMFFile("phi.xdmf")

phi = ... # initialize phi

phi.rename("Phi","Scalar flux")
ufile1 << phi

while t < Tmax:
     dt = ... # compute the new time step (i.e. potentially different at each time step)
     t += dt
     phi = ... # solve for the newest phi

     phi.rename("Phi","Scalar flux")
     ufile1 << phi

My problem is that when I visualize with VisIt, all the results appear with the parameter "Time: 0" at every time step which can be a pain, especially to compare with results that have been generated by other codes.

So I tried the following:

t = 0.0
ufile1 = XDMFFile("phi.xdmf")

phi = ... # initialize phi

phi.rename("Phi","Scalar flux")
phi_prm = phi.parameters
phi_prm.add("Time", t)

ufile1 << phi

while t < Tmax:
     dt = ... # compute the new time step (i.e. potentially different at each time step)
     t += dt
     phi = ... # solve for the newest phi

     phi.rename("Phi","Scalar flux")
     phi_prm["Time"] = t
     ufile1 << phi

But this doesn't change anything... I also tried changing directly the parameters of the xdmf file:

prm = ufile1.parameters
prm.add("Time", t)
...
prm["Time"] = t

but once again, VisIt keeps showing "Time: 0" at every time step...

Would anyone know how to force VisIt to show the time at each time step?

Thanks a lot!

PS:

ufile1 << (phi,t)

doesn't work for me either...

asked Mar 5, 2015 by V_L FEniCS User (4,440 points)

1 Answer

+1 vote
 
Best answer

It should work, if you do ufile << (phi, t). You can always look at the .xdmf file which is produced (it is just XML). Maybe you can try viewing in ParaView instead of Visit?

If you have a valid xdmf file which does work with Visit, maybe you can post it and we can try to comply with their standard.

answered Mar 6, 2015 by chris_richardson FEniCS Expert (31,740 points)
selected Mar 9, 2015 by V_L

If I do ufile << (phi, t), it indeed works with Paraview: with Visit however, the results are the same but Visit seems unable to understand where to find the value for the time...

Unfortunately, the Visit file I'm comparing with that has the time data is not an xdmf file

In any case, thanks for your answer, it helps a lot!

...