Assigning PETSc Vector to the given function space
4 months ago by
// I am trying to solve a P2P1 mixed formulation of the Stokes flow. V_velocity = dolfin.VectorFunctionSpace(mesh, "CG", 2) V_pressure = dolfin. FunctionSpace(mesh, "CG", 1) V = V_velocity * V_pressure u_out = dolfin.Function(V) // I have my Petsc compiled outside of fenics. I run MPI version of the PETSc solve // outside fenics and now want to import the solution of the linear solve for post // processing. petsc_viewer = PETSc.Viewer() petsc_viewer.createBinary(name='/tmp/solution.dat', mode=0) solution_vec = PETSc.Vec().create() solution_vec.load(viewer=petsc_viewer) // How do I now assign the solution_vec to the internal Generic vector of the u_out u_out.vector() = solution_vec // this is not working.
Community: FEniCS Project
Please login to add an answer/comment or follow this question.