I'm a beginner user of FEniCS and still struggling with some of the basics. Specifically,
I have some issues doing the tutorials in the Langtangen-Logg book Solving PDEs in Python - The FEniCS Tutorial Volume I. I think some of the problems are due to the different versions of the book and my installation (2019.1.0).
One of the issues is the use of the
The example (4.3.2 on page 90) says:
materials = CellFunction(’size_t’, mesh)
which doesn't work for me. After some research I found out that
CellFunction is deprecated since 2017.2.0:
Deprecate VertexFunction, EdgeFunction, FaceFunction, FacetFunction, CellFunction; use MeshFunction instead
I got the example to work with some trial and error (at least it looks like it's working):
materials = MeshFunction('size_t', mesh, 2)
But I do not really understand how and why. Especially after trying the next example that uses
The 2017.2.0 doc doesn't say much about how to use
MeshFunction. The descripton for the
dim (unsigned int) argument says:
The topological dimension of the MeshFunction. Optional.
The description for
CellFunction is just:
Create MeshFunction of topological codimension 0 on given mesh.
Create MeshFunction of topological codimension 1 on given mesh.
It doesn't work with
materials = MeshFunction('size_t', mesh, 0). I figured that the codimension 0 might mean to use
0 for the
dim argument in the case of "CellFunction".
Therefore, my questions are:
- Is the "codimension" referring to the
- What does "topological dimension" and "topological codimension" mean in this context?
- If I should use
MeshFunctioninstead of all those other functions mentioned above, how does using MeshFunction for cells differ from using it for facets, etc.
PS: I am aware of the question Fenics: Meshfunction usage, but it doesn't really answer my question