← Back to team overview

dolfin team mailing list archive

Re: [Question #158315]: Taking the "stiffness matrix" on C++

 

On 20 May 2011 16:15, James Avery <question158315@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Question #158315 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/158315
>
>    Status: Open => Answered
>
> James Avery proposed the following answer:
> In stiffness.ufl:
>
> element = FiniteElement("Lagrange", triangle, 1)
>
> v = TestFunction(element)
> u = TrialFunction(element)
>
> a = inner(v, u)*dx

That's the mass matrix, it should be:

a = inner(grad(v), grad(u))*dx

Martin

> where "element" should be changed to fit the FE-type that you want.
> Compile with "ffc -O -l dolfin stiffness.ufl".
>
> In C++:
>
>  stiffness::BilinearForm stiffness(V, V);
>  Matrix M;
>
>  assemble(M,stiffness);
>
> M now contains the stiffness matrix (i.e. the overlap matrix of FE basis
> functions).
>
> Hope this helps!
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp
>


Follow ups

References