Skip to content

Commit b9d3aff

Browse files
authored
Merge pull request #2281 from boutproject/laplacexz-bndry-fix
Set all boundary cells in LaplaceXZ
2 parents 9ffca2a + a64d1ec commit b9d3aff

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

examples/laplacexy/alfven-wave/alfven.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class Alfven : public PhysicsModel {
120120
// Field2D Vort2D = DC(Vort); // n=0 component
121121
// phi2D = laplacexy->solve(Vort2D, phi2D);
122122

123-
// Calculate phi from potential
123+
// Calculate phi from vorticity
124124
if (split_n0) {
125125
// Split into axisymmetric and non-axisymmetric components
126126
Field2D Vort2D = DC(Vort); // n=0 component

src/invert/laplacexz/impls/petsc/laplacexz-petsc.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,9 @@ Field3D LaplaceXZpetsc::solve(const Field3D &bin, const Field3D &x0in) {
788788
for(int z=0; z < localmesh->LocalNz; z++) {
789789
PetscScalar val;
790790
VecGetValues(xs, 1, &ind, &val );
791-
result(localmesh->xstart-1,y,z) = val;
791+
for (int x = localmesh->xstart - 1; x >= 0; --x){
792+
result(x,y,z) = val;
793+
}
792794
ind++;
793795
}
794796
}
@@ -807,7 +809,9 @@ Field3D LaplaceXZpetsc::solve(const Field3D &bin, const Field3D &x0in) {
807809
for(int z=0; z < localmesh->LocalNz; z++) {
808810
PetscScalar val;
809811
VecGetValues(xs, 1, &ind, &val );
810-
result(localmesh->xend+1,y,z) = val;
812+
for(int x=localmesh->xend+1; x<localmesh->LocalNx; ++x){
813+
result(x,y,z) = val;
814+
}
811815
ind++;
812816
}
813817
}

0 commit comments

Comments
 (0)