Skip to content

Instantly share code, notes, and snippets.

@cmaurini
Last active September 26, 2018 16:10
Show Gist options
  • Save cmaurini/1cc7a02ecba2bf346acdc66deb9a9158 to your computer and use it in GitHub Desktop.
Save cmaurini/1cc7a02ecba2bf346acdc66deb9a9158 to your computer and use it in GitHub Desktop.
# Write in XDFM format for paraview
with df.XDMFFile(mesh.mpi_comm(), "output/u.xdmf") as file:
file.write(us, 0)
# Write in XDFM format for checkpointing
with df.XDMFFile(mesh.mpi_comm(), "output/u-cp.xdmf") as file:
file.write_checkpoint(us, "us-cp", 0, append=False)
# And then to read back
with df.XDMFFile(mesh.mpi_comm(), "output/u-cp.xdmf") as file:
file.read(us, "us-cp", 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment