Boundary terms

More
6 years 2 months ago #736 by mary
Boundary terms was created by mary
Hi,

I have a Laplacian in a nonlinear PDE, which I want to discretize. The weak form of the Laplace operator gives me

\int_{\Omega} \nabla u \nabla v dx - \int_{\Gamma} \nabla u \cdot n v ds

Therefore I defined the following BilinearForm in 1D (the first part of the Laplacian is clear :))

V = H1(ngsmesh, order=1)
w = V.TrialFunction()
phi = V.TestFunction()

n = specialcf.normal(1)

boundaryterm = BilinearForm(V)
boundaryterm += SymbolicBFI(grad(w) * n * phi, definedon=ngsmesh.Boundaries("default"))
boundaryterm.Assemble()

If I run the code I get the following warning

used dof inconsistency
(silence this warning by setting BilinearForm(...check_unused=False) )

and the respective matrix is equal to zero everywhere. However I would expect entries at the two endpoints of the 1D mesh.

I suppose it's a stupid mistake - but at the moment I don't see what I am doing wrong.

Thanks a lot
Marie-Therese
More
6 years 2 months ago #743 by cwinters
Replied by cwinters on topic Boundary terms
Hi,

boundaryterm += SymbolicBFI(grad(w) * n * phi, definedon=ngsmesh.Boundaries("default"))

The function "ngsmesh.Boundaries("default")" gives you a boundary region. Therefore your integrator just integrates over your boundary (where you do not have any volume information) and there the gradient is not defined.
If you set proper boundary conditions, the term is replaced by a function for neumann boundaries and it vanishes for a dirichlet boundary.

If you use a DG method, such terms can make sense. But then you have to use "element_boundary=True" or "skeleleton=True".
The following integrator integrates over ALL element boundaries (loop over the inner interfaces twices and boundary elements once).
Code:
boundaryterm += SymbolicBFI(grad(w) * n * phi, element_boundary=True)
The next one integrates over all boundary elements.
Code:
boundaryterm += SymbolicBFI(grad(w) * n * phi, BND, skeleton=True)

It is always easier to help if we know more details of the problem you want to solve.

Best,
Christoph
Time to create page: 0.119 seconds