diff --git a/src/ASM/ASMs2D.C b/src/ASM/ASMs2D.C index c17789b2..57445220 100644 --- a/src/ASM/ASMs2D.C +++ b/src/ASM/ASMs2D.C @@ -718,18 +718,19 @@ void ASMs2D::closeBoundaries (int dir, int basis, int master) int n1, n2; if (!this->getSize(n1,n2,basis)) return; + int dirs = utl::getDirs(this->getNoFields(basis)); switch (dir) { case 1: // Edges are closed in I-direction for (int i2 = 1; i2 <= n2; i2++, master += n1) - this->makePeriodic(master,master+n1-1); + this->makePeriodic(master,master+n1-1,dirs); threadGroups.stripDir = ThreadGroups::U; break; case 2: // Edges are closed in J-direction for (int i1 = 1; i1 <= n1; i1++, master++) - this->makePeriodic(master,master+n1*(n2-1)); + this->makePeriodic(master,master+n1*(n2-1),dirs); threadGroups.stripDir = ThreadGroups::V; break; } diff --git a/src/ASM/ASMs3D.C b/src/ASM/ASMs3D.C index e50bf67e..5e081f30 100644 --- a/src/ASM/ASMs3D.C +++ b/src/ASM/ASMs3D.C @@ -784,26 +784,28 @@ void ASMs3D::closeBoundaries (int dir, int basis, int master) int n1, n2, n3; if (!this->getSize(n1,n2,n3,basis)) return; + int dirs = utl::getDirs(this->getNoFields(basis)); + switch (dir) { case 1: // Faces are closed in I-direction for (int i3 = 1; i3 <= n3; i3++) - for (int i2 = 1; i2 <= n2; i2++, master += n1) - this->makePeriodic(master,master+n1-1); + for (int i2 = 1; i2 <= n2; i2++, master += n1) + this->makePeriodic(master,master+n1-1,dirs); threadGroupsVol.stripDir = ThreadGroups::U; break; case 2: // Faces are closed in J-direction for (int i3 = 1; i3 <= n3; i3++, master += n1*(n2-1)) - for (int i1 = 1; i1 <= n1; i1++, master++) - this->makePeriodic(master,master+n1*(n2-1)); + for (int i1 = 1; i1 <= n1; i1++, master++) + this->makePeriodic(master,master+n1*(n2-1),dirs); threadGroupsVol.stripDir = ThreadGroups::V; break; case 3: // Faces are closed in K-direction for (int i2 = 1; i2 <= n2; i2++) - for (int i1 = 1; i1 <= n1; i1++, master++) - this->makePeriodic(master,master+n1*n2*(n3-1)); + for (int i1 = 1; i1 <= n1; i1++, master++) + this->makePeriodic(master,master+n1*n2*(n3-1),dirs); threadGroupsVol.stripDir = ThreadGroups::W; break; }