Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . 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.

Notice

The forum is in read only mode.

OpenCascade geometry Periodic Boundary Conditions

More
1 year 5 months ago - 1 year 5 months ago #4545 by acesarano
Hello,

I would like to impose periodic boundary conditions on the bottom and top of a space-time cylinder mesh.

To create a 2pi rotation in space-time of a subdomain in the domain, we use here the OpenCascade library of NGSolve, but it seems not to include he attribute PeriodicSurfaces() to impose the boundary condition:

 File "occ_periodic.py", line 86, in <module>
   geoOCC.PeriodicSurfaces(bottom,top)
AttributeError: 'netgen.libngpy._NgOCC.OCCGeometry' object has no attribute 'PeriodicSurfaces'

Is there a way to do this? We were looking at other solutions as well. For example the function GlobalInterfaceSpace(), but we are not sure of to use the mapping argument for our purposes (and if it is possible).

Thank you very much in advance for your help!

Alessio
Last edit: 1 year 5 months ago by acesarano.
More
1 year 5 months ago #4546 by christopher
Hi,
for opencascade the syntax is a little different, here a cube with 2 faces identified:
Code:
from netgen.occ import * from ngsolve import * from netgen.meshing import IdentificationType a = Box((0,0,0),(1,1,1)) a.faces.Min(X).Identify(a.faces.Max(X),                         "periodic",                         IdentificationType.PERIODIC) geo = OCCGeometry(a) mesh = Mesh(geo.GenerateMesh(maxh=0.2)) Draw(mesh)

If your transformation between the faces is not a translation you have to create a netgen.occ.gp_Trsf and give the trafo as a fourth argument to identify (also if you want to identify multiple faces at once).

Look at the output if the identification was successful there should be something like

 Map face 1 -> 2

Also check identified points in the gui with view->Viewing Options->Mesh->Show identified Points

Best
Christopher
More
1 year 5 months ago #4550 by acesarano
Hello Christopher,

thank you very much for your quick answer!

I have tried the command you suggested and it works in our case. We have a full 2*pi rotation and so a translation in Z-axis is fine.

Many thanks,
Alessio


 
More
1 year 1 month ago - 1 year 1 month ago #4694 by mgobrial
Hi,

I am trying to impose periodic boundary conditions on the top and the bottom of a rotating object. Now, using a 360 degree rotation the periodic identification works pretty good. But when using only a 90 degree rotation, I have to create this trafo netgen.occ.gp_Trsf and use it as the fourth argument in the command as mentioned in the last post.

Here a short example, what I did so far:

from ngsolve import *
from netgen.occ import *
import math
import time
from ngsolve.internal import visoptions
from ngsolve.internal import viewoptions
from netgen.meshing import IdentificationType

origin = (0,0,0)
T = 1
desiredRad = 0.1
rotationAngle = pi/2

face1 = WorkPlane().Circle(0.25,0.25,desiredRad).Face()
spine = Segment(origin, (0,0,T))
cyl = Cylinder(origin, Z, r=0.5*desiredRad, h=T).faces[0]
heli = Edge(Segment((0,0), (rotationAngle, T)), cyl)
pipe1 = Pipe(spine, face1, auxspine=heli).mat("pipe1")
pipe1.faces.name="pipe_outer"
pipe1.faces.Min(Z).name ="bottom"

rot = Rotation(Axis((0,0,0), Z), 180)
pipe1.faces.Min(Z).Identify(pipe1.faces.Max(Z), "periodic", IdentificationType.PERIODIC, rot)

geoOCC = OCCGeometry(pipe1)
mesh = Mesh(geoOCC.GenerateMesh(maxh=0.1))
mesh.Curve(3)

Unfortunately, this does not work, after trying to adapt the rot object in several ways.

Thanks in advance for your help!

Best, Mario
Last edit: 1 year 1 month ago by mgobrial.
More
1 year 2 weeks ago #4737 by joachim
Hi Mario,

you have to give the transformation from the first to the second face, which consists of rotation (by 90 degrees) and translation, then it works:

rot = Rotation(Axis((0,0,0), Z), 90)
trans = Translation(T*Z)
pipe1.faces.Min(Z).Identify(pipe1.faces.Max(Z), "periodic", IdentificationType.PERIODIC, rot*trans)

best, Joachim
 
The following user(s) said Thank You: acesarano
More
1 year 1 week ago #4750 by acesarano
Dear Professor Schöberl,

thank you very much for taking the time to check this for us and find the solution, or better said our mistake.

Now I am happy, it doesn't matter if the solution is or is not unique ;)

All the best,
Alessio

 
Time to create page: 0.168 seconds