Periodic BCs on curved domains

Hi,

I’m trying to use periodic boundary conditions as it is described in
Periodicity — NGS-Py 6.2.2302 documentation

for a 3D quarter annulus. It works for me on brick domains, but I cannot make it work on curved geometries. It seems that the mesh is not periodic.

Here is what I do:

import netgen.gui
#%gui tk
from ngsolve import * 
from netgen.csg import *
from ngsolve.internal import *

geo = CSGeometry()
front = Plane (Pnt(0,0,3), Vec(0,0,1) )
back = Plane (Pnt(0,0,-3), Vec(0,0,-1) )
cleft = Plane(Pnt(0,0,0),Vec(-1,0,0))
cbot = Plane(Pnt(0,0,0),Vec(0,-1,0))
cyl2 = Cylinder ( Pnt(0, 0, -5), Pnt(0, 0, 5), 10) 
cyl3 = Cylinder ( Pnt(0, 0, -5), Pnt(0, 0, 5), 20)
cyl23 = ((cyl3  - cyl2)*front*back).bc("outer")
dom = cyl23 * cleft * cbot

geo.Add(dom)
geo.PeriodicSurfaces(cleft, cbot)

mesh = Mesh(geo.GenerateMesh(maxh=3))

fes = Periodic(H1(mesh,order=3,dirichlet="outer"))         #periodic bcs

u,v = fes.TrialFunction(), fes.TestFunction()

a = BilinearForm(fes,symmetric=True)
a += SymbolicBFI(grad(u) * grad(v))

f = LinearForm(fes)
f += SymbolicLFI(atan(y/x)*v)

u = GridFunction(fes,"u")

with TaskManager():
    a.Assemble()
    f.Assemble()
    u.vec.data = a.mat.Inverse(fes.FreeDofs()) * f.vec

Draw(u)

ngsolve.internal.visoptions.clipsolution="scal"
ngsolve.internal.viewoptions.clipping.enable=1
ngsolve.internal.viewoptions.clipping.ny=0
ngsolve.internal.viewoptions.clipping.nz=-1
ngsolve.internal.viewoptions.clipping.dist=0

Is there a way to get a periodic mesh also for curved geometries?

Many thanks in advance,
Peter

Hi Peter,

it works with the latest Netgen 19.02 released yesterday:

You have to provide a transformation from one to the other periodic boundary. It may be a shift (defined by a vector) or a rotation (defined by a point on the axis, direction of the axis, and the angle):

geo.PeriodicSurfaces(cleft, cbot, trafo=Trafo(Pnt(0,0,0),Vec(0,0,-1), math.pi/2))

best, Joachim