← Back to team overview

dolfin team mailing list archive

Problem with Lowest order Nedelec

 

Hello,

I upgraded my fenics-installation on ubuntu jaunty to the latest version 
and observed some problems with lowest order Nedelec elements in 3D. Since
I was not sure, is I'm using the new Expression-Class properly I wrote 
some simple 2D test cases and it seems that already the L^2-projection for
lowest order elements is wrong. In the attached sample code the value of
the projection does not converge to the value of the function. If I use in 
contrast in Projection.ufl higher order Nedelec-spaces it converges.

Regards,
Holger 

Projection.ufl:
W1F = FiniteElement("Nedelec 1st kind H(curl)", "triangle",0)
vL = VectorElement("Lagrange", "triangle", 3)

v = TestFunction(W1F)
u = TrialFunction(W1F)
f = Function(vL)

a = inner(v, u)*dx  
L = inner(v,f)*dx

and 

main.cpp:
#include <dolfin.h>
#include "Projection.h"

using namespace dolfin;
int main()
{
  class Solution : public Expression
  {
  public:
  Solution() : Expression(2,2) {}
    void eval(double* values, const double* x) const
    {
      values[0] = 1;
      values[1] = 0; //sin(DOLFIN_PI*x[0]);
    }
  };
  UnitSquare mesh(2,2);
  Solution solution;
  for (unsigned int i=0; i<6; i++)
  {
	  mesh.refine();
	  Projection::FunctionSpace VP(mesh);
	  Projection::BilinearForm m(VP,VP);
	  Projection::LinearForm LP(VP);
	  LP.f = solution;
	  VariationalProblem problemP(m,LP);
          Function T(VP);   
	  problemP.solve(T);
	  double x[2] = {0.123, 0.23441};
	  // Evaluate user-defined function f
	  double value[2] = {0.1,0.1}; 
	  solution.eval(&(value[0]), x);
	  info("exact value f(x) = (%g,%g)", value[0],value[1]);
	  // Evaluate discrete function g (projection of f)
	  double value2[2] = {0.1,0.1}; 
	  T.eval(&(value2[0]), x);
	  info("value of projection g(x) = (%g,%g)", value2[0],value2[1]);
  } 
  return 0;}



Follow ups