Writing some complex function to file

Project the “function» to a suitable function space, and then use XDMFFile.write_checkpoint to write it to file. See for instance: Loading xdmf data back in - #4 by dokken
Note that differentiating a Finite element function changes the space it belongs to, see: How to choose projection space for stress tensor (post-processing)? - #2 by nate

1 Like