Coefficients of Function

Asked by Melanie Jahny

I approximate a Function velocity with a Raviart - Thomas vector space:

mesh = Rectangle(0,0,1, 1, 10, 10)
U = VectorFunctionSpace(mesh, "Raviart-Thomas", 1)
velocity = Function(U)

I think the velocity function is now approximated in the following way:
velocity(x,y) = \sum_{i=1}^{Ndof} a_i \phi_i(x,y)

with a_i coefficients and \phi_i Raviart-Thomas basis functions (2D).

Now I need to access the coefficients a_i of this approximation.
Is there any function or possibility to get them?
(I'm using the python version of fenics)

Thanks for any help or advice!

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Marie Rognes
Solved:
Last query:
Last reply:
Revision history for this message
Best Marie Rognes (meg-simula) said :
#1

On 07/19/11 11:11, Melanie Jahny wrote:
> New question #165291 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/165291
>
> I approximate a Function velocity with a Raviart - Thomas vector space:
>
> mesh = Rectangle(0,0,1, 1, 10, 10)
> U = VectorFunctionSpace(mesh, "Raviart-Thomas", 1)
> velocity = Function(U)
>

First, just a comment: the Raviart-Thomas elements are vector elements by
construction. So, U above consists of vectors of vectors (or tensor
fields).
Perhaps you simply want:

 U = FunctionSpace(mesh, "Raviart-Thomas", 1)

?

> I think the velocity function is now approximated in the following way:
> velocity(x,y) = \sum_{i=1}^{Ndof} a_i \phi_i(x,y)
>
> with a_i coefficients and \phi_i Raviart-Thomas basis functions (2D).
>

Yes.

> Now I need to access the coefficients a_i of this approximation.
> Is there any function or possibility to get them?
> (I'm using the python version of fenics)
>

Absolutely: the coefficients are available from

     velocity.vector()

--
Marie
> Thanks for any help or advice!
>

Revision history for this message
Kristian B. Ølgaard (k.b.oelgaard) said :
#2

From a Python session simply do:

>>> help(Function)

Revision history for this message
Melanie Jahny (melanie-jahny) said :
#3

Thank you, I think my fault was really to define a Vector-Function Space.
I thought velocity contains the product of coefficients and basis function.
Now it's perfect, thanks!