Hi all,
I am trying to rewrite an old dolfin script in dolfinX language.
I am having problems when I try to write the following variable using dolfinX:
i, j = ufl.indices(2)
variable = dolf.as_tensor(test_velocity[i].dx(j), (i, j))
Does anybody know how it would be in dolfinx?
Thank you very much in advance.
The following runs for me with dolfinx
:
from mpi4py import MPI
import dolfinx as dolf
import ufl
mesh = dolf.generation.RectangleMesh(MPI.COMM_WORLD,
[[0,0,0], [1,1,0]], [2, 2])
test_velocity = dolf.Constant(mesh,(1,1))
i,j = ufl.indices(2)
# The `as_tensor` function is part of UFL, not DOLFIN:
#variable = dolf.as_tensor(test_velocity[i].dx(j),(i,j))
variable = ufl.as_tensor(test_velocity[i].dx(j),(i,j))