Hello,
I am learning this wonderful package and have a question.
I am trying to solve a time-dependent problem. The time-stepping part of my program looks like this:
Time-stepping
t = 0
for n in range(num_steps):
Update current time
t += dt
Solve variational problem for time step
solve(F == 0, f)
Save solution to file (VTK)
_f1, _f2, _f3, _f4 = f.split()
W = FunctionSpace(mesh,‘P’,1)
_fm = project(_f1** 2 + _f2** 2,W)
vtkfile_fm << (_fm, t)
Update previous solution
f_n.assign(f)
As you can see, f is the solution to my variational problem and fm = f1** 2 + f2** 2 is a derived quantity which I want to export and animate with ParaView.
The program ran and exported the .vtu and pvd files.
However, the pvd file didn’t animate: the first frame displayed but subsequent frames just show grey screen.
I traced the issue back to the fact that each .vtu file has a different name. For example:
<DataArray type="Float64" Name="f_58"for the first .vtu file, and
<DataArray type="Float64" Name="f_107"for the second file, and so on.
If I manually change the Scalars and Name fields to the same values for all files then the animation work.
How could I enforce the same name for the files automatically, please?
Thank you very much.