CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > SU2

SU2_MSH: Periodic boundary conditions bug

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Zef

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 16, 2015, 09:37
Default SU2_MSH: Periodic boundary conditions bug
  #1
Zef
New Member
 
Join Date: Mar 2009
Posts: 13
Rep Power: 17
Zef is on a distinguished road
I found a bug in SU2_MSH module conserned with periodic boundary setup. As far as i understand, SU2_MSH makes a set halo nodes on the one side of periodic boundary and marks nodes as halo on another boundary. After that, routine CPeriodicGeometry::SetMeshFile renumbers all nodes in order to have all halo nodes at the end of the list of nodes. To explain what the bug is, let's consider the mesh with 100 nodes, 2 periodic boundaries with 10 nodes each. SU2_MSH will produce totally corrupted mesh if we have nodes with numbers greater than 90 on the receive boundary. During the sort procedure, SetMeshFile routine looks for the receive nodes at the periodic boundary and places them at the end of list (with numbers from 90 to 99). But any receive node at the end of list destroys the sort algorithm since the new numbers of the found nodes would be also from 90 to 99. So this algorithm would rewrite any receive node at the end of list and would produce overlapping elements, single nodes with no elements, etc.

Remark: this algorithm would funсtion properly if all receive nodes are in descending order.

In order to have property functioning algorithm, i have to introduce another boolean array in the routine SetMeshFile and split the sort procedure in two steps. On the first step i scan all receive nodes and place "true" in the array if the receive node at the end of list (with numbers from 90 to 99 in the example above) is found. After that i do the sort with respect to filled array: if i want to exchange two nodes and the relevant boolean array element is "true", i skip this node number until "false" in the array appears. Such a trick produces correct mesh file with periodic boundaries and halo nodes. Below you can see a part of the SetMeshFile code. Maybe proposed algorithm is not optimal (i'm not programmer), but it works.

I hope that i explain what the bug is. Sorry for my poor english.

Code:
/*--- Ghost points, look at the nodes in the send receive ---*/
iMarkerReceive = nMarker - 1;
GhostPoints = nElem_Bound[iMarkerReceive];
unsigned long recpnts = GhostPoints/2;
bool prohibited[recpnts];

/*--- Change the numbering to guarantee that the all the receive
points are at the end of the file ---*/
unsigned long OldnPoint = geometry->GetnPoint();
unsigned long NewSort[nPoint];
for (iPoint = 0; iPoint < nPoint; iPoint++) {
NewSort[iPoint] = iPoint;
if (iPoint < recpnts) prohibited[iPoint] = false;
}

for (iMarker = 0; iMarker < nMarker; iMarker++) { // First loop - fill prohibited array
if (bound[iMarker][0]->GetVTK_Type() == VERTEX) {
if (config->GetMarker_All_SendRecv(iMarker) < 0) {
for (iElem_Bound = 0; iElem_Bound < nElem_Bound[iMarker]; iElem_Bound++) {
if (bound[iMarker][iElem_Bound]->GetNode(0) < geometry->GetnPoint() && bound[iMarker][iElem_Bound]->GetNode(0) > nPoint - GhostPoints) {
prohibited[bound[iMarker][iElem_Bound]->GetNode(0) - nPoint + GhostPoints] = true;
}
}
}
}
}

unsigned long Index = OldnPoint-1;
for (iMarker = 0; iMarker < nMarker; iMarker++) { // Second loop - do the permutations if needed
if (bound[iMarker][0]->GetVTK_Type() == VERTEX) {
if (config->GetMarker_All_SendRecv(iMarker) < 0) {
for (iElem_Bound = 0; iElem_Bound < nElem_Bound[iMarker]; iElem_Bound++) {
if (bound[iMarker][iElem_Bound]->GetNode(0) < nPoint - GhostPoints) {
while (prohibited[Index - nPoint + GhostPoints]) Index--;
NewSort[bound[iMarker][iElem_Bound]->GetNode(0)] = Index;
NewSort[Index] = bound[iMarker][iElem_Bound]->GetNode(0);
Index--;
}
}
}
}
}

The rest of the SetMeshFile routine stays the same.
omidhldn likes this.
Zef is offline   Reply With Quote

Old   February 18, 2015, 13:28
Default
  #2
Super Moderator
 
Francisco Palacios
Join Date: Jan 2013
Location: Long Beach, CA
Posts: 404
Rep Power: 15
fpalacios is on a distinguished road
Thanks a lot for your contribution,

In fact, these days we are updating the Periodic BC and your comments are very useful.

I'll keep you posted.

Best,

Francisco Palacios
SU2 lead developer
fpalacios is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 07:38
PEMFC module + multiple periodic boundary conditions vkrastev FLUENT 2 December 22, 2014 04:15
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 14:32
Problem with Periodic Boundary Conditions Help!!! otsigun FLUENT 0 July 11, 2013 03:20
periodic boundary conditions fro pressure Salem Main CFD Forum 21 April 10, 2013 00:44


All times are GMT -4. The time now is 15:26.