Subject: [FEniCS-users] using functionals

From: phil marinier <[email-masked]>
Date: Wed, 12 Aug 2009 15:32:17 -0400

I want to use functionals for both calculating an error norm and for finding gradients. I wrote and compiled this ENorm.ufl file:

element = FiniteElement("Lagrange", triangle, 1)

uh = Function(element)
u   = Function(element)
e   = uh - u

M = dot(e, e)*dx

My test program includes:

    Rectangle rectangle(0.0, 0.0, height, length, numH, numL, type);
    Laplace::FunctionSpace V(rectangle);
    ENorm::CoefficientSpace_V VCoef(rectangle);
    Function Phi0(V);
    Function Phi1(V);
    
    Laplace::BilinearForm a(V, V);
    Laplace::LinearForm L(V);
    ENorm::Functional M;
    Source f(V);
    L.f = f;
    
    problem0.solve(Phi0);
    problem1.solve(Phi1);
    
    M.u = Phi0;
    M.uh = Phi1;

The error I am getting is:

testENorm.cc: In function ‘int main()’:
testENorm.cc:50: error: ‘CoefficientSpace_V’ is not a member of ‘ENorm’
testENorm.cc:50: error: expected `;' before ‘VCoef’

however, I copied that part of the code from one of the demos.
Any help would be appreciated

Phil

---

From: Bartosz Sawicki <[email-masked]>
Date: Wed, 12 Aug 2009 13:46:00 -0600

Look into ENorm.h file, generated by ffc. There is CoefficientSpace_u 
and CoefficientSpace_uh, but nothing like CoefficientSpace_V.
Fix this typo :)

cheers,

phil marinier wrote:
> I want to use functionals for both calculating an error norm and for 
> finding gradients. I wrote and compiled this ENorm.ufl file:
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> FEniCS-users mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/fenics-users

---

From: Kristian Oelgaard <[email-masked]>
Date: Thu, 13 Aug 2009 09:41:14 +0200

> and CoefficientSpace_uh, but nothing like CoefficientSpace_V.

And the reason is that you declared the functions:

uh = Function(element)
u  = Function(element)

in the *.ufl file. If you had used

V = Function(element)

then CoefficientSpace_V would be generated as FFC uses the function names when
creating the function spaces.

Kristian