Periodic cube mesh

More
6 years 11 months ago #270 by pschroe
Periodic cube mesh was created by pschroe
Good morning,

I have a problem with periodic meshes ;-)

Attached, there is a script which defines a periodic cube of length L and a structured cube mesh (Joachim posted this somewhere in the forum).
However, I cannot transfer the periodicity to the cube mesh.

This problem is already in 2D. I generally do not know how to tell a manually generated mesh that it should have periodic facets...

I would be grateful for any help.

Best, Philipp
More
6 years 11 months ago #278 by christopher
Replied by christopher on topic Periodic cube mesh
Hi Philipp,

The only thing you do have to do is to set the vertex identification for all your periodic points. This is done by the function mesh.AddPointIdentification. It takes the point identifications of the two points, the identification number (1 based, which periodic boundary it's on if you have multiple ones) and the identification type (which is 2 for periodic). If you change your first loop where you add the points to
Code:
pids = [] for i in range(N+1): for j in range(N+1): for k in range(N+1): pids.append (mesh.Add(MeshPoint(Pnt(L*i/N, L*j/N, L*k/N)))) if k is 0: slave = pids[-1] if k is N: mesh.AddPointIdentification(pids[-1],slave,identnr=1,type=2)

it works for me. I've attached the file with a simple h1 test.
Another tip: If you select in the gui the mesh in the visualization and then go to View-> Viewing options->Mesh and disable "show filled triangles" and enable "show identified points" you can see if your point identification is correct. This helps a lot when debugging ;)

Best
Christopher
More
6 years 11 months ago #281 by pschroe
Replied by pschroe on topic Periodic cube mesh
Thank you very much, Christopher!

The test also works on my computer and the "show identified points" is also very neat ;-)

If I see this correctly, the mesh is now periodic only in one direction.
Somehow, I cannot identify the points in a second direction.
I always end up with identifying one corner point with all points on the opposite face...

So, could you please tell me how to extend the periodicity in one direction to periodicity in, let's say, all directions? :)

Best, Philipp
More
6 years 11 months ago #282 by cwinters
Replied by cwinters on topic Periodic cube mesh
Hi Philipp,

if you identify the other directions, make sure you increase the "identnr" when you use
Code:
mesh.AddPointIdentification(...,identnr=2,type=2)
This function creates an array with identifications for the vertices of two opposite faces.
If you now use the same "identnr" for the identification of two other faces, you overwrite some data.

Best,
Christoph
More
6 years 11 months ago #284 by pschroe
Replied by pschroe on topic Periodic cube mesh
Hi Christoph,

Thank you for your help! I finally managed to get a periodic box manually now :-)

Best, Philipp
More
6 years 6 months ago #519 by pschroe
Replied by pschroe on topic Periodic cube mesh
Hey guys,

I actually have sort of a follow-up question on manually generated meshes.

In the script in this discussion, each face gets a name via e.g. FaceDescriptor(..., bc=1), right?
So this name in form of [int list] is used to specify Dirichlet boundaries, the Set() operator, or billinear form integrator which act only on part of the boundary.

If I use the integer list, I get the following warning:
Code:
warning: Boundaries( [int list] ) is deprecated, pls generate Region

So, how can I generate regions (I guess named in form of strings?) for the boundary faces in this example?

Thank you very much for your help!

Best, Philipp
Time to create page: 0.112 seconds