Problem in imposing uniqueness condition in weak foirmulation for poission equation with neumann boundary condition

Hello sir!!

if we are making a code of neumann problem “-laplacian u=f on omega , del u/del n =0 on del omega”.
In order to get unique solution we have to impose additional constraint " integral u over omega dx =0 “. how this condition we will impose in weak formulation in fenics.
please provide the idea of the code for " a and l” for the above problem.

See: Singular Poisson — DOLFIN documentation

1 Like

sir similar to singular poisson equation code, this is the stokes equation code with additional constraint “integral over omega tr(sig)=0” . then please check is correct. i think their is some error in

"Create vector that spans the null space and normalize" part. here, sig is a stress matrix so tr(sig) is simply the trace of stress matrix. please recorrect my syntax. provide some hint to resolve this problem.

V = VectorElement("Lagrange", mesh.ufl_cell(), 1)
T = TensorElement("Lagrange", mesh.ufl_cell(), 1)
TH = V * T
W = FunctionSpace(mesh, TH)

A = assemble(a)
b = assemble(L)

w = Function(W)

Create Krylov solver

solver = PETScKrylovSolver("cg")
solver.set_operator(A)

Create vector that spans the null space and normalize

null_vec = Vector(tr(sig).vector())
V.dofmap().set(null_vec, 1.0)
null_vec *= 1.0/null_vec.norm("l2")

Create null space basis object and attach to PETSc matrix

null_space = VectorSpaceBasis([null_vec])
as_backend_type(A).set_nullspace(null_space)
null_space.orthogonalize(b);

solver.solve(w.vector(), b)

(u,sig) = w.split()

This is the stokes equation code with additional constraint “integral over omega tr(sig)=0” . As, tr(sig) is simply the trace of stress matrix and it is not a vector component. how we can impose our additional constraint.


null_vec = Vector(tr(sig).vector())
V.dofmap().set(null_vec, 1.0)

null_vec *= 1.0/null_vec.norm("l2")

Sir what is the attribute for trace object ?

sir, can you explain these three lines of singular poisson code. i am unable to understand these lines. what exactly they are doing? 

sir what is the syntax of tangential jump i.e. [curl u] in fenics

Sir can we use quadrature rule in fenics in order to impose the condition that is integral over omega (p) dx =0 in weak formulation if yes then how we can impose…

Please provide some hint