Hi,
my goal is to solve the stationary Navier-Stokes Equations.
Therefore i have written an ufl file and described the Weak Formulation:
#kind of element
cell = tetrahedron
# Function Space for Velocity U and Pressure V
U = VectorElement("CG", cell, 2)
V = FiniteElement("CG", cell, 1)
# Mixed Function Space
W = U*V
# (initial guess) Function for solution
w = Coefficient(W)
# (right hand side) Function
f = Coefficient(U);
# split into parts, w_u is desired solution
(w_u,w_p) = (as_vector((w[0],w[1],w[2])),w[3])
# TestFunction
(psi_u,psi_p) = TestFunctions(W)
# user defined viscosity
# NU = Constant(cell)
# Weak Formulation
# nonlinear termin (+)
# laplace (+)
# pressure (+)
# solenoidal (+)
# rhs
F = inner(psi_u,dot(grad(w_u),w_u))*dx + \
inner(grad(psi_u),grad(w_u))*dx + \
-1*div(psi_u)*w_p*dx + \
-1*psi_p*div(w_u)*dx + \
dot(psi_u,f)*dx
# Derivative
dw = TrialFunction(W)
J = derivative(F, w, dw)
This Formulation is for the 3 dimensional case.
Is it possible to "generalize" the code, that it is also working for 2 dimensional case?
The main problems are:
cell = tetrahedron
(w_u,w_p) = (as_vector((w[0],w[1],w[2])),w[3])
Thanks in advance