Stress tensor in cylindrical coordinates

Hello,
I am trying to solve Stokes flow in 2D axisymmetric coordinates. I was looking through the very helpful example in here, and the stress tensor is defined as a 3 by 3 matrix, but the flow field obviously has two components. I can’t get my dimensions to match in my variational form.
For example, defining

mesh = RectangleMesh(Point(0, 0), Point(1, 1), 60, 60)
n = FacetNormal(mesh)

# Define Taylor--Hood function space W
V = VectorElement("CG", triangle, 2)
Q = FiniteElement("CG", triangle, 1)
W = FunctionSpace(mesh, MixedElement([V, Q]))

# Define Function and TestFunction(s)
w = Function(W)
(u, p) = split(w)
(v, q) = split(TestFunction(W))

# stress tensor
def epsilon(v):
    return sym(as_tensor([[v[0].dx(0), 0, v[0].dx(1)],
                          [0, v[0] / x[0], 0],
                          [v[1].dx(0), 0, v[1].dx(1)]]))

Things like

dot(dot(p * I3, v), n)
    - 2 * mu * dot(dot(epsilon(u), v), n)) * x[0] * ds(1)

are mismatched in size, I guess because v is in 2D and p * I3 is a 3 by 3 matrix. But it somehow seems to work in the axisymmetric example. Can anyone tell me what obvious thing I’m missing?

Hi,
I think you have to extend v and n to a 3d vector with a zero third component

2 Likes

Hello,
Yes! I think that’s an option. I don’t know how to do that … I tried using as_vector to redefine v but it doesn’t work either. Can you tell me what the command should be? Or how to redefine vectors? I can’t seem to figure it out.
Thanks so much!

v3D = as_vector([v[0], v[1], 0])

1 Like