← Back to team overview

dolfin team mailing list archive

[Question #143185]: Write solution to xml file

 

New question #143185 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/143185

I solve the Navier-Stokes-Brinkman equation with fenics and get the velocity u and the pressure p as result:

(u,p) = problem.solve().split() 

At the end of the program, I'd like to write u to a xml-file, but using the code:

velocity_file = File( "velocity.xml" )
velocity_file << u.vector()

causes the following error:

velocity_file << u.vector()
RuntimeError: *** Error: You are attempting to access a non-const vector from a sub-Function.

Using the code:

solution = problem.solve()
velocity_file = File( "velocity.xml" )
velocity_file << solution.vector()

works, but I'd like to know if I can store only the velocity u in a xml-file.
Thanks for any help!!!



-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



Follow ups