Hi everyone, thanks for reading!
I reduced the 2D Navier Stokes with energy to a problem that looks like this:
u_x + v_y = 0
p_x = \frac{1}{Re} u_{yy}
p_y = -Ri \ T
\mathbf{u} \cdot \nabla T = \frac{1}{Pr} T_{yy}
where Re, Ri, Pr are constants and \mathbf{u} = (u, w) and p, T are velocity, pressure and temperature, all functions of x and y. I’m not sure how to deal with these derivatives that appear in just one direction.
I tried to formulate it like this:
mesh = UnitSquareMesh(N, N)
P1 = FiniteElement('P', mesh.ufl_cell(), 1)
P2 = VectorElement('P', mesh.ufl_cell(), 2)
mixed_element = MixedElement([P1, P2, P1])
W = FunctionSpace(mesh, mixed_element)
psi_p, psi_u, psi_T = TestFunctions(W)
w = Function(W)
p, u, T = split(w)
# Here I define constants like Re = Constant(1000) etc...
mass = -psi_p*div(u)
momentum = dot(psi_u, -Ri*T*Constant((0., 1.))) - div(psi_u)*p
+ 2./Re*inner(sym(grad(psi_u)), sym(grad(u))) * Constant(((1,0),(0,0)))
energy = dot(grad(psi_T), 1./Pr*grad(T))[1] - dot(grad(psi_T), T*u)
F = (mass + momentum + energy)*dx
And I get an error: Can’t add expressions with different shapes.
Through trying different things I also got at some point: UFLException: Symmetric part of tensor with rank != 2 is undefined.
Any help would be very much appreciated!