What does CellSize return exactly?

Asked by Elmar Zander on 2013-01-29

I am writing some testing code for stabilisation methods (SU and the like) and need the size of the cells therefore. I thought in 1D the CellSize would be the size of the elements, i.e. 1/N if I have N equally sized elements; the same as the CellVolume. However, there is a factor of 2 between those and I don't know why. The documentation is unfortunately rather "sparse" on this issue. Can you please explain to me what CellSize exactly returns? Also in higher dimensions? Thanks a lot.

Here is some sample code, showing the issue:

In [10]: mesh=UnitInterval(10)
*** -------------------------------------------------------------------------
*** Warning: UnitInterval has been deprecated in DOLFIN version 1.1.0.
*** The class UnitInterval has been replaced by UnitIntervalMesh.
*** -------------------------------------------------------------------------

In [11]: assemble(CellVolume(mesh)*dx, mesh=mesh)
Out[11]: 0.1

In [12]: assemble(CellSize(mesh)*dx, mesh=mesh)
Out[12]: 0.2

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Garth Wells
Solved:
2013-01-30
Last query:
2013-01-30
Last reply:
2013-01-29
Garth Wells (garth-wells) said : #1

The code

    from dolfin import *
    mesh = UnitIntervalMesh(10)
    print assemble(CellVolume(mesh)*dx, mesh=mesh)
    print assemble(CellSize(mesh)*dx, mesh=mesh)

seems to be broken in development version. Martin: have your changes broken the above case?

Best Garth Wells (garth-wells) said : #2

Thanks for the report. I just pushed a fix to FFC.

Problem was that FFC computed the cell length in 1D, whereas is should have been the circumradius which is half the cell length. CellSize multiples the circumradius by two, hence the factor 2.

Elmar Zander (elmar-zandere) said : #3

Thanks Garth Wells, that solved my question.