OpenCascade geometry Periodic Boundary Conditions
- acesarano
- Topic Author
- New Member
Less
More
2 years 1 month ago - 2 years 1 month ago #4545
by acesarano
OpenCascade geometry Periodic Boundary Conditions was created 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
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: 2 years 1 month ago by acesarano.
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
2 years 1 month ago #4546
by christopher
Replied by christopher on topic OpenCascade geometry Periodic Boundary Conditions
Hi,
for opencascade the syntax is a little different, here a cube with 2 faces identified:
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
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
- acesarano
- Topic Author
- New Member
Less
More
2 years 1 month ago #4550
by acesarano
Replied by acesarano on topic OpenCascade geometry Periodic Boundary Conditions
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
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
- mgobrial
- New Member
Less
More
1 year 9 months ago - 1 year 9 months ago #4694
by mgobrial
Replied by mgobrial on topic OpenCascade geometry Periodic Boundary Conditions
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
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 9 months ago by mgobrial.
1 year 8 months ago #4737
by joachim
Replied by joachim on topic OpenCascade geometry Periodic Boundary Conditions
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
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
- acesarano
- Topic Author
- New Member
Less
More
1 year 8 months ago #4750
by acesarano
Replied by acesarano on topic OpenCascade geometry Periodic Boundary Conditions
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
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.102 seconds