Forum Message



We have moved the forum to . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.


The forum is in read only mode.

DG jumps over boundary faces in periodic square

2 years 11 months ago #3555 by pde
This is a question concerning the implementation of jump terms in DG methods for periodic problems (2D unit square with periodic boundary conditions). I am new to ngsolve and would appreciate any help. I am working in the space L2(mesh, order=choose_poly_degree, dgjumps=True), where I use the discretization

periodic = SplineGeometry()
pnums = [periodic.AppendPoint(*p) for p in [ (0,0), (1,0), (1,1), (0,1) ]]
lright = periodic.Append ( ["line", pnums[0], pnums[1]],bc="periodic")
btop = periodic.Append ( ["line", pnums[1], pnums[2]], bc="periodic")
periodic.Append ( ["line", pnums[3], pnums[2]], leftdomain=0, rightdomain=1, copy=lright, bc="periodic")
periodic.Append ( ["line", pnums[0], pnums[3]], leftdomain=0, rightdomain=1, copy=btop, bc="periodic")
mesh = Mesh(periodic.GenerateMesh(maxh=choose_discretization_size))

Say we would like to have a bilinear form a(u,v) containing the integral of jump(u)*jump(v) over all faces, where the jump for boundary faces is defined in a periodic way.

While jumps over interior faces can be implemented using jump(u)=u-u.Other(), it is not clear to me how to do this for boundary faces. Ideally, this would be something like u-u.Otherbdry() with .Otherbdry() now accessing the periodic neighbour of a boundary element, i.e., the element on the opposite side of the square sharing the same boundary face upon periodic identification. Many thanks in advance for suggestions.
2 years 11 months ago #3556 by cwinters

did you test if "jump(u)=u-u.Other()" does what you expect?
The periodicity is built into the "Apply(...)" and "Assemble()" member function of the BilinearForm. The boundary facets are handled like interior facets, using the periodic neighbouring elements. Thus you should be fine using "u.Other()" in any case.

See also "py_tutorials/DG/" in the sources of NGSolve.

The following user(s) said Thank You: pde
2 years 11 months ago #3558 by pde
Many thanks Christoph!

The reason I was asking is that I am observing some strange behaviour for the error under uniform mesh refinement in a DG scheme for a linear toy problem $u-\Delta u = f$ with periodic boundary conditions on the unit cell (L2 error is increasing from e.g. 1/h=128 to 256), and wanted to make sure that the bilinear form is actually doing what I had in mind (i.e., that it also contains an integral over boundary faces involving the periodic jump). I have attached a code in case this is helpful.

File Attachment:

File Name:
File Size:3 KB
2 years 11 months ago #3562 by cwinters

since the convergence is fine before you reach h=1/256, I'm pretty sure that the periodicity is handled correctly. The number of "inner facets" during the assembly also corresponds to the total number of facets (mesh.nedges), including the ones on the boundary.

There must be another reason limiting the $L_2$ error. The result of "Integrate((uh-U)*(uh-U),mesh)" is around 1e-12~1e-13 before you apply the sqrt. Could it be that you already see some approximation effects?

Time to create page: 0.115 seconds