A problem using "make_periodicity_constraints" function

83 views
Skip to first unread message

Masoud Ahmadi

unread,
Dec 2, 2022, 12:20:29 PM12/2/22
to deal.II User Group
Hi everyone,

I am trying to use "DoFTools::make_periodicity_constraints" function to apply periodic BCs on my geometry.
For simplicity, here I've just uploaded a test program which only applies PBCs to a single square element. I am doing this by using the function twice, first for faces 1 and 2; then for faces 3 and 4.

When I use "GridGenerator::subdivided_hyper_rectangle" function to generate the mesh, everything is fine. (Case <I> in the below image). I get the following constraints:
U2 = U0
U3 = U1
U6 = U4
U7 = U5
for the first function, and
U4 = U0
U5 = U1
for the second function. Which is exactly what I want.

The problem is, when I import the mesh from Cubit (Lines 68-71 in the uploaded code), I will have different numbering for the nodes (Case <II> in the below image). While I expect the constraints to be as follows:
U4 = U6
U5 = U7
U0 = U2
U1 = U3
for the first function, and
U2 = U6
U3 = U7
they are the same as case <I>!

thumbnail_1670000336889-51b6154e-13b9-4e82-9bd8-f3b3c0e3945d_.jpg
test.zip

Wolfgang Bangerth

unread,
Dec 2, 2022, 6:43:08 PM12/2/22
to dea...@googlegroups.com
On 12/2/22 10:20, Masoud Ahmadi wrote:
>
> The problem is, when I import the mesh from Cubit (Lines 68-71 in the uploaded
> code), I will have different numbering for the nodes (Case <II> in the below
> image). While I expect the constraints to be as follows:
> U4 = U6
> U5 = U7
> U0 = U2
> U1 = U3
> for the first function, and
> U2 = U6
> U3 = U7
> they are the same as case <I>!

Masoud -- you don't say in your question, but are the constraints wrong? You
say that you *expect* them to be different, but not where your expectation
stems from.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Masoud Ahmadi

unread,
Dec 3, 2022, 5:38:28 AM12/3/22
to deal.II User Group
Dear Wolfgang,

Thanks for your reply.
My expectation stems from the fact that I am using the exact same mesh, but instead of using "GridGenerator" function of dealii, this time I import a mesh from Cubit. Then, I mark the boundaries in the same order: left: 1, right: 2, bottom: 3, up: 4. So, I think I did the exact same thing.

What happens is the order of DoF numbering changes (as shown in the pictures). But since my mesh is the same, and so are the boundary IDs, I expect the results to be as I described since "DoFTools::make_periodicity_constraints" function gets the boundary IDs as inputs.

Please let me know if I am still not clear.

Masoud

Wolfgang Bangerth

unread,
Dec 3, 2022, 11:01:03 AM12/3/22
to dea...@googlegroups.com
On 12/3/22 03:38, Masoud Ahmadi wrote:
> My expectation stems from the fact that I am using the exact same mesh, but
> instead of using "GridGenerator" function of dealii, this time I import a mesh
> from Cubit. Then, I mark the boundaries in the same order: left: 1, right: 2,
> bottom: 3, up: 4. So, I think I did the exact same thing.
>
> What happens is the order of DoF numbering changes (as shown in the pictures).
> But since my mesh is the same, and so are the boundary IDs, I expect the
> results to be as I described since "DoFTools::make_periodicity_constraints"
> function gets the boundary IDs as inputs.

What I'm trying to say is that just because the two meshes describe the same
geometric region in space does not mean that they are constructed in the same
way. GridGenerator may use a different numbering of vertices than the imported
mesh, for example.

So I'll come back to the original question: Is what happens actually wrong? Or
is it just unexpected?

Masoud Ahmadi

unread,
Dec 5, 2022, 4:27:33 AM12/5/22
to deal.II User Group
OK, the more I think about it, the more I am confident to say: It is Wrong.

In my logic, I am not doing anything related to DoF numbering. In both cases, I create a square by the length of 44.72, assign the same boundary IDs to the sides (left: 1, right:2, down:3, up:4), then use the "DoFTools::make_periodicity_constraints" function to apply periodic BCs. Since the arguments for this function are the paired boundary IDs, and again, they are the same in both cases (because I marked them manually), I do not see a reason why we get a different result.

Regards,
Masoud
Reply all
Reply to author
Forward
0 new messages