I am following one of the fenics examples for the tensor-weighted-poisson. In there, they use the MeshFunction objects to represent elements of the conductivity tensor, i.e., the conductivity is constant actors a single mesh cell. I was wondering if there is a way to modify this example so that the conductivity tensor elements would vary across a single cell, e.g., by using Function objects instead. My hope is that I can set up a continious interpolated function across the simulation domain, instead of splitting things into cells.
Thank you for the response, but I think I am still quite confused about the solution that you mentioned. In that example, the tensor C is evaluated to be constant across each cell and the only spacial dependence of the tensor comes from two subdomains. What I was hoping to do is to construct a tensor C that would depend on the spatial coordinates (x[0] and x[1]) and that can go into the typical fenics PDE solution scheme for tensor-weighted equations:
a = inner(C*grad(u), grad(v))*dx
L = f*v*dx
solve(a == L, u, bc)
The elements of C are defined as functions and can vary across each cell, e.g.:
\begin{pmatrix}
C_{00}\left ( x, y \right ) & C_{01}\left ( x, y \right ) \\
C_{01}\left ( x, y \right ) & C_{11}\left ( x, y \right )
\end{pmatrix}=\begin{pmatrix}
x^2+y^2 & x \\
x & x^2+y^2
\end{pmatrix}
Note standard notaion that x is x[0] and y is x[1].