Hello, I am currently working on forced convective flow. However, I have problem in running the code for my variational formulation at energy equation.
This is my energy equation:
rhoC(u.grad(T))=c*div(grad(T)
This is my coding:
#define test functions
(v, q, s) = TestFunctions(W)
#define functions
u = Function(W)
p = Function(W)
T = Function(W)
#split functions
w =Function(W)
(u, p, T) = w.split()
#define expression used in variational forms
n = FacetNormal(mesh)
mu = Constant(mu)
rho = Constant(rho)
sigma = Constant(sigma)
C = Constant(C)
c = Constant(c)
B_0 = Constant(B_0)
#define variational problem
F=nabla_grad(u)*q*dx \
+rho*dot(dot(u,nabla_grad(u)),v)*dx+dot(p,nabla_grad(v))*dx- dot(n*p,v)*ds \
+dot(mu*nabla_grad(u),nabla_grad(v))*dx \
-dot(n*nabla_grad(u),v)*ds+dot(sigma*pow(B_0,2)*u,v)*dx \
+rho*C*dot(u,nabla_grad(T))*s*dx-c*div(nabla_grad(T))*s*dx #energy equation
There is error while running the code:
Invalid ranks 1 and 1 in product. Traceback (most recent call last):
File "steady.py", line 79, in
+rhoCdot(u,nabla_grad(T))sdx-cdiv(nabla_grad(T))sdx File "/usr/lib/python2.7/dist-packages/ufl/exproperators.py", line 190, in
_mul
return _mult(self, o) File "/usr/lib/python2.7/dist-packages/ufl/exproperators.py", line 165, in
_mult
error("Invalid ranks {0} and {1} in product.".format(r1, r2)) File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 171, in error
raise self._exception_type(self._format_raw(message)) ufl.log.UFLException: Invalid ranks 1 and 1 in product. Aborted (core
dumped)
Could you help me? Thanks in advance.