← Back to team overview

dolfin team mailing list archive

access to solution vectors as python objects

 

picking the stokes flow example (taylor-hoods elements), i try to get the solution to P, in:

scalar = FiniteElement("Lagrange", "triangle", 1)
vector = VectorElement("Lagrange", "triangle", 2)
system = vector + scalar
[....]

(v, q) = TestFunctions(system)
(u, p) = TrialFunctions(system)
f = Function(vector, mesh, 0.0)

a = (dot(grad(v), grad(u)) - div(v)*p + q*div(u))*dx
L = dot(v, f)*dx

pde = LinearPDE(a, L, mesh, bcs)

(U, P) = pde.solve().split()


as a numpy vector, following your suggestion:

  xx = zeros((P.size(),))
  P.get(xx)


but i get an attribute error in P.size (P has no attribute size). am i getting it wrong? P isn't a vector with scalar values for pressure nodal values?


Follow ups