# (Deleted) Help with SUPG.

154
views
-5
12 months ago by

Dear all,
I have a problem with the follow implementation. Any help is appreciated.

    V = VectorElement("CG", mesh.ufl_cell(), 2)       # Velocity vector field
P = FiniteElement("CG", mesh.ufl_cell(), 1)       # Pressure field
L = FiniteElement("CG", mesh.ufl_cell(), 2)       # Levelset field
N = VectorFunctionSpace(mesh, "CG", 1, dim=2)     # Normal vector field
VP = MixedElement([V,P])
Omega = FunctionSpace(mesh,VP)

# Space definition for Level Set
SL = FunctionSpace(mesh,L)
l_ = TestFunction(SL)
(u,p) = split(w)

# Level set FEM disctetization
unorm = sqrt(dot(u,u))
h = CellSize(mesh)
delta = h/(2.0*unorm)

F = inner((l-l0)/k,l_)*dx - 0.5*inner((l-l0)*u,grad(l_))*dx + s*inner((l-l0)/k,l_)*dx + (s*r)*dx

J = derivative(F,l)
bc = []
problem=NonlinearVariationalProblem(F,l,bc,J)
solver=NonlinearVariationalSolver(problem)
prm = solver.parameters
prm['nonlinear_solver'] = 'newton'
prm['newton_solver']['absolute_tolerance'] = 1E-10
prm['newton_solver']['relative_tolerance'] = 1E-10
prm['newton_solver']['maximum_iterations'] = 20
prm['newton_solver']['linear_solver'] = 'mumps'
solver.solve()
1
There is a very good introduction on FEniCS tutorial and FEniCS book that may help you. <https://fenicsproject.org/documentation/>
written 12 months ago by Nelson Tamashiro