How to write a XDMF file which has mesh static over time?

I found my answer. I should not manipulate the global parameters dictionary but the parameter dictionary associated with the XDMFFile object as shown below:

import dolfin
file = dolfin.XDMFFile('Test.xdmf')
file.parameters['rewrite_function_mesh'] = False

I found the answer by reading the source code https://bitbucket.org/fenics-project/dolfin/src/2018.1.0/dolfin/io/XDMFFile.h.

2 Likes