This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

evaluation of diffusion tensor coefficients at the quadrature points

+2 votes

Hi,
I am solving a diffusion problem on heterogeneous material. The diffusion tensors are only available at the vertices. I tried to interpolate a scalar coefficient vector using the Function():

V = FunctionSpace(mesh, "Lagrange", 1)
x = Vector(mesh.num_vertices())

# then assign the values in x according to the vertices. 
# x[i] = ....
# and then do the interpolation:
g = Function(V,x)

Seems as if the index of the vertices does not correspond to the dofs. In
http://fenicsproject.org/qa/121/python-how-to-set-expansion-coefficients-for-a-function

u.vector().set_local(coeff[V.dofmap().vertex_to_dof_map(mesh)])
u.update()

So my questions are:

(1) Using the method mentioned above, is the u vector aligned according to the local vertex index as a result? I tried to use these lines, and got this warning:
*** -------------------------------------------------------------------------
*** Warning: dof_to_vertex_map has been deprecated in DOLFIN version 1.3.0.
*** DofMap::dof_to_vertex_map has been replaced by the free function vertex_to_dof_map.
*** -------------------------------------------------------------------------
And I couldn't use
g = Function(V,x)
as the error:
TypeError: in method 'new_Function', argument 1 of type 'dolfin::Function const &'

(2) Which function could be useful when it comes to the interpolation of tensors rather than scalars vectors?

Thanks.

asked Apr 23, 2014 by qiangzini FEniCS Novice (760 points)
...