Skip to content

Commit 14a621b

Browse files
committed
elm_pb example: Fix outer boundary phivalue
Should average over Z
1 parent d377379 commit 14a621b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

examples/elm-pb/elm_pb.cxx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,11 +1410,14 @@ class ELMpb : public PhysicsModel {
14101410
if (mesh->lastX()) {
14111411
for (int j = mesh->ystart; j <= mesh->yend; j++) {
14121412
BoutReal phivalue = 0.0;
1413-
BoutReal oldvalue = 0.0;
14141413
for (int k = 0; k < mesh->LocalNz; k++) {
1415-
phivalue = phi(mesh->xend, j, k);
1416-
oldvalue = 0.5 * (phi(mesh->xend + 1, j, k) + phi(mesh->xend, j, k));
1414+
phivalue += phi(mesh->xend, j, k);
14171415
}
1416+
phivalue /= mesh->LocalNz; // Average in Z of point next to boundary
1417+
1418+
// Old value of phi at boundary. Note: this is constant in Z
1419+
BoutReal oldvalue =
1420+
0.5 * (phi(mesh->xend + 1, j, 0) + phi(mesh->xend, j, 0));
14181421

14191422
// New value of phi at boundary, relaxing towards phivalue
14201423
BoutReal newvalue = weight * oldvalue + (1. - weight) * phivalue;

0 commit comments

Comments
 (0)