I have a system of four coupled nonlinear partial differential equations. My solution function is defined as:
fullspace = dolf.MixedFunctionSpace([space1, space2, space3, space4])
fullsol = dolf.Function(fullspace)
where space1,2,3,4 are created as:
space1 = dolf.FunctionSpace(mesh,"Lagrange",1)
I solve the equations and want to store the solution to a file. I try:
fil = dolf.File("data/testdata.pvd")
fil << fullsol
but I get an error:
*** Error: Unable to write data to VTK file.
*** Reason: Don't know how to handle vector function with dimension other than 2 or 3.
*** Where: This error was encountered inside VTKFile.cpp.
It seems that VTK file format doesn't support solution functions with four components. I also tried using pickle, but that gives me:
TypeError: can't pickle SwigPyObject objects
What other option do I have for storing my solutions in such a way that Fenics can understand them later?
EDIT: I also tried .raw file format. For that, saving into file seems to work, but reading doesn't. I get an error:
*** Error: Unable to read object from file.
*** Reason: Cannot read objects of type Function from RAW files.
*** Where: This error was encountered inside GenericFile.cpp.