Skip to content

Commit 33d78fe

Browse files
Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 14a621b commit 33d78fe

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

examples/elm-pb/elm_pb.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ class ELMpb : public PhysicsModel {
13641364
// Only update if simulation time has advanced
13651365
// Uses an exponential decay of the weighting of the value in the boundary
13661366
// so that the solution is well behaved for arbitrary steps
1367-
BoutReal weight = exp(-(t - phi_boundary_last_update) / phi_boundary_timescale);
1367+
BoutReal const weight = exp(-(t - phi_boundary_last_update) / phi_boundary_timescale);
13681368
phi_boundary_last_update = t;
13691369

13701370
if (mesh->firstX()) {
@@ -1378,7 +1378,7 @@ class ELMpb : public PhysicsModel {
13781378
}
13791379
}
13801380
MPI_Comm comm_inner = mesh->getYcomm(0);
1381-
int np;
1381+
int np = 0;
13821382
MPI_Comm_size(comm_inner, &np);
13831383
MPI_Allreduce(&philocal, &phivalue, 1, MPI_DOUBLE, MPI_SUM, comm_inner);
13841384
phivalue /= (np * mesh->LocalNz * mesh->LocalNy);
@@ -1393,11 +1393,11 @@ class ELMpb : public PhysicsModel {
13931393
}
13941394

13951395
// Old value of phi at boundary. Note: this is constant in Z
1396-
BoutReal oldvalue =
1396+
BoutReal const oldvalue =
13971397
0.5 * (phi(mesh->xstart - 1, j, 0) + phi(mesh->xstart, j, 0));
13981398

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

14021402
// Set phi at the boundary to this value
14031403
for (int k = 0; k < mesh->LocalNz; k++) {
@@ -1420,7 +1420,7 @@ class ELMpb : public PhysicsModel {
14201420
0.5 * (phi(mesh->xend + 1, j, 0) + phi(mesh->xend, j, 0));
14211421

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

14251425
// Set phi at the boundary to this value
14261426
for (int k = 0; k < mesh->LocalNz; k++) {

0 commit comments

Comments
 (0)