Subject: [FFC-dev] Nedelec elements

From: Bartosz Sawicki <[email-masked]>
Date: Tue, 30 Oct 2007 15:01:57 +0100

Hello everybody,

I'm trying to use Nedelec element for curl-curl equation. I can't find
any example of using Nedelec edge elements in ffc and dolfin, so I'm not
sure how to use it.

My first, the simplest try was:

element = VectorElement("Nedelec", "tetrahedron", 1, 3)
v = TestFunction(element)
t = TrialFunction(element)
c = VectorConstant("tetrahedron")
a = dot(curl(v),curl(t))*dx
L = c*dx

but compilation fails:

$ ffc -d1 Nedelec.form
This is FFC, the FEniCS Form Compiler, version 0.4.3.
For further information, go to http://www/fenics.org/ffc/.
Preprocessing form file: Nedelec.form --> Nedelec.py
Traceback (most recent call last):
  File "/usr/bin/ffc", line 180, in ?
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ffc", line 107, in main
    execfile(outname, ns)
  File "Nedelec.py", line 15, in ?
    a = dot(curl(v),curl(t))*dx
  File
"/usr/lib/python2.4/site-packages/ffc/compiler/language/operators.py",
line 181, in curl
    return rot(v)
  File
"/usr/lib/python2.4/site-packages/ffc/compiler/language/operators.py",
line 175, in rot
    raise FormError, (v, "Rotation only defined for v : R^3 --> R^3")

I really don't understand what I'm doing wrong. Could you give me any
example of proper use of Nedelec elements in ffc?
It would be great if such example will be in dolfin/src/demo directory :)

I'm using the newest FIAT and FFC just from hg repository.

Regards,
BArtosz Sawicki

---

From: Marie Rognes <[email-masked]>
Date: Tue, 30 Oct 2007 15:02:33 +0100

> any example of using Nedelec edge elements in ffc and dolfin, so I'm not

The reason for why are there are no examples using the Nedelec elements 
is probably that we have not finished implementing and testing them yet. 
In other words, they are not working properly yet.

> element = VectorElement("Nedelec", "tetrahedron", 1, 3)

Further, the Nedelec elements are vector-elements by  default, so you want

    element = FiniteElement("Nedelec", "tetrahedron", 1)

here. (With the notation you used above, you get a vector of 3 Nedelec 
vector elements.)

> a = dot(curl(v),curl(t))*dx

In addition L should be a linear functional. Thus c*dx where c is a 
vector does not make sense in the ffc-regime. Maybe you want something like

    L = dot(curl(v), c)*dx

instead?

-- 
Marie E. Rognes
Ph.D Fellow, 
Centre of Mathematics for Applications, 
University of Oslo
http://folk.uio.no/meg

---

From: Bartosz Sawicki <[email-masked]>
Date: Tue, 30 Oct 2007 21:55:42 +0100

> In other words, they are not working properly yet.

Ok, but there are probably some particular examples where it works. 
Maybe I can help to improve the functionality.

> here. (With the notation you used above, you get a vector of 3 Nedelec 

Yeeeap :), it was the problem. Now fcc compiles correctly.
Thank you very much.

> vector does not make sense in the ffc-regime. Maybe you want something like

Yes, of course.
On the right side of PDE equation I have only source vector funtion (c), 
so as far as I understand weak formulation there should be:
L = dot(v, c)*dx

regards,
Bartosz Sawicki

---

From: Anders Logg <[email-masked]>
Date: Tue, 30 Oct 2007 22:20:34 +0100

> Yeeeap :), it was the problem. Now fcc compiles correctly.

It might compile, but I wouldn't count on getting anything sensible
(but you might be lucky). As Marie points out, the Nedelec elements
need some more work.

/Anders

> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> http://www.fenics.org/mailman/listinfo/ffc-dev

---

From: Bartosz Sawicki <[email-masked]>
Date: Fri, 02 Nov 2007 23:53:33 +0100

> (but you might be lucky). As Marie points out, the Nedelec elements

Usually I am lucky, but not this time.
ffc compiles, gcc compiles, but during the runtime:

   | Assembling over cells                                           |
   |-----------------------------------------------------------------| 0.0%
terminate called after throwing an instance of 'std::runtime_error'
   what():  evaluate_dof not implemented for this type of element
Aborted (core dumped)

... ups.
I'll be waiting for any news about Nedelec elements development and I'll 
be happy, if I can help in testing.

regards,
BArtosz

---

From: Anders Logg <[email-masked]>
Date: Sat, 3 Nov 2007 00:39:31 +0100

>    | Assembling over cells                                           |

The first thing to try would be to *not* use a Nedelec element for the
right-hand side (the source term). Pick a standard Lagrange element,
say DG(1) for the right-hand. That should fix this problem, but I
still think something else will break (or simply give the wrong
values).

/Anders

---

From: Marie Rognes <[email-masked]>
Date: Sun, 04 Nov 2007 12:51:21 +0100

> still think something else will break (or simply give the wrong

An error of this form would probably also occur, if you try to apply 
strong/essential boundary conditions for the Nedelec element space. 
Figuring out how to do this might take some time.

The "rest" should be working soon.

---

From: Bartosz Sawicki <[email-masked]>
Date: Sun, 04 Nov 2007 23:19:08 +0100

> strong/essential boundary conditions for the Nedelec element space. 

Thank you for advices.
Both of them are important. I set Lagrange elements on the right-side 
and switch off Dirichlet Boundary Condition.
Now everything compiles, application works, but solver can't find 
solution - what is expected if I switched off DBC.

I'll think about another formulation for my problem, to avoid DBC.
Does Neumann condition works correctly? Can I use 'ds' in form defition?

> The "rest" should be working soon.

That's great. I'll be waiting.

regards,
BArtosz