I try to solve the incompressible flow with Marangoni effect. Following is how I formulate the problem. However, It seems take long time to assemble the matrix after including supg stabilization. Also, the Expression function also take time. Is there any way to improve this?
def dtang_T(T_n,T):
dtang = Expression((‘Tx’, ‘Ty’),Tx=project(T_n.dx(0),T,solver_type=‘cg’, preconditioner_type=‘hypre_amg’),
Ty=project(T_n.dx(1),T,solver_type=‘cg’, preconditioner_type=‘hypre_amg’),degree=2)
return dtang
Res = rho*(1.0/dt)*(u-u0) + rho*dot(u0,grad(u)) - (mu)*div(grad(u)+grad(u).T) + grad(p)
tau_supg = ((2.0/dt1)**2 + (2.0*sqrt(inner(u0,u0))/h)**2 + 9*(4.0*mu_l/rho_l/(h**2))**2)**(-0.5)
F_supg = (tau_supg*inner(Res,rho*(1.0/dt)*(v-u0)+rho*dot(u0, grad(v))-mu*div(grad(v)+grad(v).T)+ grad(q)) \
+inner(grad(u),(sqrt(inner(u0,u0))*h)*grad(v)))*dx
F1 = rho*dot((u - u0) / dt, v)*dx + \
rho*inner(v, dot(grad(u), u0))*dx \
+ (mu)*inner(grad(v), grad(u)+grad(u).T)*dx \
- inner(div(v), p)*dx +inner(q, div(u))*dx- dot(-0.000083*dtang_T(T_n,T),v)*ds1 \
+F_supg
a_u1 = lhs(F1)
L_u1 = rhs(F1)
A_u1=assemble(a_u1, tensor=A_u1)
b_u1=assemble(L_u1, tensor=b_u1)