Recently I got a question about output result files, the original output file format which I choose is vtu, but I found that xdmf is more faster than vtu, so I changed the format to xdmf. Then these days I encountered an error when I open xdmf file by using paraview, the situation is paraview would be crashed when I open a xdmf file with much more mesh elements, like 10500 or more. I have never encountered such situation when I using vtu format to output result files.
So how should I choose, change it back to vtu, or you guys have some nice methods to solve crashing of xdmf?
Xdmf is a more scalable format than VTK, and is preferred for large simulations (in legacy dolfin).
For outputting in DOLFINx we currently recommend VTXWriter, as it is scalable and support arbitrary order (discontinuous) Lagrange functions.
As to you error, without a minimal reproducible example, its hard to give you any further guidance.
My fenics version is 2019.**, so it is dolfin.
# Output file
xdmf_file = XDMFFile(Output_directory + "/solution.xdmf")
# file = File(os.path.join(results_directory, "solution.pvd"))
cwr = u_new.split()[0]
cwr.rename('C', 'C')
vwr = v_p_combined.split()[0]
vwr.rename('v', 'v')
# Variables for writing physical stress
stress = Function(SpaceTensor)
stress.rename('stress', 'stress')
print('----- writing the data of initial time step to file -----')
xdmf_file.write(cwr, timeCurrent)
xdmf_file.write(vwr, timeCurrent)
solve(stress_L == stress_R, stress, solver_parameters={'linear_solver': 'mumps'})
xdmf_file.write(stress, timeCurrent)
Above is the code of output part, I don’t know if the problem is caused by this part.
You should call xdmf_file.close()
once you are done writing data to file.
Please note that without a reproducible example it’s hard to say whats gone wrong.
You mean that when I finished all of the output processes, I shoud call xdmf_file.close()
, so it maybe solve the problem. Thank you, I will try it later.