← Back to team overview

dolfin team mailing list archive

Re: access to solution vectors as python objects

 

pedro skrev den 08/04-2008 følgende:
> 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()
> 

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

Should do the trick.

Ola

 
> 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?
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev


References