Hello,
I am trying to create a diffusion function on the mesh. I’ve been following the “Tensor-weighted Poisson” tutorial.
https://fenicsproject.org/docs/dolfin/1.3.0/python/demo/documented/tensor-weighted-poisson/python/documentation.html
I have the following questions:
(1) Why does the array of a mesh function have more values than elements/cells on the mesh?
(2) How do you assign values to a Mesh Function?
Here is my problem in more detail:
To initialize the mesh function, I do this:
c00 = MeshFunction(“double”, mesh, 1)
Now I want to set the values of ‘c00’ on each mesh element. As I understand, the values of the function ‘c00’ are stored in c00.array().
However, I find that:
the number of cells on the mesh is not equal to length of c00.array()
That is:
count = 0
for x in (cells(mesh)):
count += 1
print (count)
c00 = MeshFunction("double", mesh, 1)
prints 48,000
While
print (len(c00.array())
prints 59,660
I can’t figure out where this 59,660 number comes from. What are the values in c00.array() associated with (if not the mesh elements)?
Also, is there something like an “element_to_dof_map()” (analogous to vertex_to_dof_map()) for mesh functions? The “Tensor-weighted Poisson Tutorial” assigns to c00 like this:
for cell in cells(mesh):
c00[cell] = 1
But this raised an error.
Thanks for the help,
T