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?