- Thank you received: 0
Periodic BCs on curved domains
5 years 8 months ago #1511
by pgangl
Periodic BCs on curved domains was created by pgangl
Hi,
I'm trying to use periodic boundary conditions as it is described in
ngsolve.org/docu/latest/how_to/periodic.html
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:
Is there a way to get a periodic mesh also for curved geometries?
Many thanks in advance,
Peter
I'm trying to use periodic boundary conditions as it is described in
ngsolve.org/docu/latest/how_to/periodic.html
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:
Code:
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
5 years 7 months ago #1514
by joachim
Replied by joachim on topic Periodic BCs on curved domains
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):
best, Joachim
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):
Code:
geo.PeriodicSurfaces(cleft, cbot, trafo=Trafo(Pnt(0,0,0),Vec(0,0,-1), math.pi/2))
best, Joachim
The following user(s) said Thank You: pgangl
Time to create page: 0.106 seconds