Hi Hossein,
I'm not exacly sure what you want to do...
You have a sphere intersecting the periodic boundary, how would you want to define the periodicity there?
Periodicity only on the part of the boundary that is on both sides? - I think this may not be easily achieved with Netgen...
Or maybe you wanted the sphere inside the domain?
Best Christopher
Last edit: Christopher Lackner 2017-05-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you want a periodic mesh with the spheres in the edges you could do it like this, but I think the boundary that you want to mesh periodic must be the same on both sides
Thank you for the replys and sorry I could not write earlier. Anyhow, I got my answer.
What I want to do is "computational homogenization" where I create and mesh the microstrucutre and compute the effective properties. So, in some cases it is better to apply Periodic boundary conditions EVEN if the structure is not periodic i.e. I have the nodes opposite faces.
So, what I understand is Netgen can produce periodic structures if the geometry is periodic. For me however, this covers most of the cases.
Anyhow, I would like to thank you for such a nice software.
Best Regards
Hossein
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am now a bit confused with Exporting the mesh from a periodic structure. In the code from Joachim's comment,
from ngsolve import *
mesh = Mesh(geo.GenerateMesh(maxh=0.3))
the Mesh class from ngsolve is used. Now how would I Export the mesh to Abaqus for example?
Previously I would do:
ngmesh = geo.GenerateMesh(maxh=0.3)
ngmesh.GenerateVolumeMesh()
ngmesh.Export ("abcde.inp", "Abaqus Format")
But now, mesh does not have an Export member. I see that "mesh" has a "ngmesh" member that can export. But, it seems the mesh in "mesh.ngmesh" is different to "mesh". What am I missing?
Another question is why ngmesh.GenerateVolumeMesh() does not produce periodic meshes?
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have the following code to apply periodicity on all edges of a block. But there seems to be a bug. Thank you.
Cheers
Hossein
from netgen.csg import *
geo = CSGeometry()
left = Plane(Pnt(0,0,0),Vec(-1,0,0))
right = Plane(Pnt(1,0,0),Vec(1,0,0))
bot = Plane(Pnt(0,0,0),Vec(0,-1,0))
top = Plane(Pnt(0,1,0),Vec(0,1,0))
back = Plane(Pnt(0,0,0),Vec(0,0,-1))
forward = Plane(Pnt(0,0,1),Vec(0,0,1))
brick = OrthoBrick(Pnt(0,0,0),Pnt(1,1,1))
sphere = Sphere(Pnt(0,0,0),.2).maxh(0.05)
brick1=brick #+sphere
cube = brick1 * left * right * bot * top * back * forward
geo.Add(cube)
geo.PeriodicSurfaces(left , right )
geo.PeriodicSurfaces(bot , top )
geo.PeriodicSurfaces(back , forward)
from ngsolve import *
mesh = Mesh(geo.GenerateMesh(maxh=0.3))
Hello Hossein,
I tested your code and everything works fine for me.
Please describe your problem in more detail?
Regards
Christoph
Hi Christoph,
Thank you. Sorry I forgot to uncomment the problematic line. Here is the problematic code. I just had to add "+sphere" below.
from netgen.csg import
geo = CSGeometry()
left = Plane(Pnt(0,0,0),Vec(-1,0,0))
right = Plane(Pnt(1,0,0),Vec(1,0,0))
bot = Plane(Pnt(0,0,0),Vec(0,-1,0))
top = Plane(Pnt(0,1,0),Vec(0,1,0))
back = Plane(Pnt(0,0,0),Vec(0,0,-1))
forward = Plane(Pnt(0,0,1),Vec(0,0,1))
brick = OrthoBrick(Pnt(0,0,0),Pnt(1,1,1))
sphere = Sphere(Pnt(0,0,0),.2).maxh(0.05)
brick1=brick +sphere
cube = brick1 * left * right * bot * top * back * forward
geo.Add(cube)
geo.PeriodicSurfaces(left , right )
geo.PeriodicSurfaces(bot , top )
geo.PeriodicSurfaces(back , forward)
from ngsolve import
mesh = Mesh(geo.GenerateMesh(maxh=0.3))
Hi Hossein,
I'm not exacly sure what you want to do...
You have a sphere intersecting the periodic boundary, how would you want to define the periodicity there?
Periodicity only on the part of the boundary that is on both sides? - I think this may not be easily achieved with Netgen...
Or maybe you wanted the sphere inside the domain?
Best Christopher
Last edit: Christopher Lackner 2017-05-11
If you want a periodic mesh with the spheres in the edges you could do it like this, but I think the boundary that you want to mesh periodic must be the same on both sides
Hi Hossein,
I guess it should be a unit-cell cut out of a periodic structure. So you need two domains (cube-spheres) and (cube * spheres):
from netgen.csg import *
geo = CSGeometry()
left = Plane(Pnt(0,0,0),Vec(-1,0,0))
right = Plane(Pnt(1,0,0),Vec(1,0,0))
bot = Plane(Pnt(0,0,0),Vec(0,-1,0))
top = Plane(Pnt(0,1,0),Vec(0,1,0))
back = Plane(Pnt(0,0,0),Vec(0,0,-1))
forward = Plane(Pnt(0,0,1),Vec(0,0,1))
sphere1 = Sphere(Pnt(0,0,0),.2).maxh(0.05)
sphere2 = Sphere(Pnt(1,0,0),.2).maxh(0.05)
sphere3 = Sphere(Pnt(1,1,0),.2).maxh(0.05)
sphere4 = Sphere(Pnt(1,1,1),.2).maxh(0.05)
sphere5 = Sphere(Pnt(1,0,1),.2).maxh(0.05)
sphere6 = Sphere(Pnt(0,1,0),.2).maxh(0.05)
sphere7 = Sphere(Pnt(0,0,1),.2).maxh(0.05)
sphere8 = Sphere(Pnt(0,1,1),.2).maxh(0.05)
spheres =sphere1 + sphere2 + sphere3 + sphere4 + sphere5 + sphere6 + sphere7 + sphere8
cube = left * right * bot * top * back * forward
geo.Add(cube * spheres)
geo.Add(cube - spheres)
geo.PeriodicSurfaces(left , right )
geo.PeriodicSurfaces(bot , top )
geo.PeriodicSurfaces(back , forward)
from ngsolve import *
mesh = Mesh(geo.GenerateMesh(maxh=0.3))
Hi Joachim and Christopher,
Thank you for the replys and sorry I could not write earlier. Anyhow, I got my answer.
What I want to do is "computational homogenization" where I create and mesh the microstrucutre and compute the effective properties. So, in some cases it is better to apply Periodic boundary conditions EVEN if the structure is not periodic i.e. I have the nodes opposite faces.
So, what I understand is Netgen can produce periodic structures if the geometry is periodic. For me however, this covers most of the cases.
Anyhow, I would like to thank you for such a nice software.
Best Regards
Hossein
Hi again,
I am now a bit confused with Exporting the mesh from a periodic structure. In the code from Joachim's comment,
from ngsolve import *
mesh = Mesh(geo.GenerateMesh(maxh=0.3))
the Mesh class from ngsolve is used. Now how would I Export the mesh to Abaqus for example?
Previously I would do:
ngmesh = geo.GenerateMesh(maxh=0.3)
ngmesh.GenerateVolumeMesh()
ngmesh.Export ("abcde.inp", "Abaqus Format")
But now, mesh does not have an Export member. I see that "mesh" has a "ngmesh" member that can export. But, it seems the mesh in "mesh.ngmesh" is different to "mesh". What am I missing?
Another question is why ngmesh.GenerateVolumeMesh() does not produce periodic meshes?
Thank you.