Skip to content

Commit 80e01ad

Browse files
committed
Apply formatting
1 parent 58b66f6 commit 80e01ad

10 files changed

Lines changed: 1084 additions & 960 deletions

File tree

CMakeLists.txt

Lines changed: 647 additions & 528 deletions
Large diffs are not rendered by default.

include/bout/metric_tensor.hxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ public:
8787
CovariantMetricTensor(FieldMetric g11, FieldMetric g22, FieldMetric g33,
8888
FieldMetric g12, FieldMetric g13, FieldMetric g23)
8989
: MetricTensor(std::move(g11), std::move(g22), std::move(g33), std::move(g12),
90-
std::move(g13), std::move(g23)){};
90+
std::move(g13), std::move(g23)) {};
9191

9292
CovariantMetricTensor(const BoutReal g11, const BoutReal g22, const BoutReal g33,
9393
const BoutReal g12, const BoutReal g13, const BoutReal g23,
9494
Mesh* mesh)
95-
: MetricTensor(g11, g22, g33, g12, g13, g23, mesh){};
95+
: MetricTensor(g11, g22, g33, g12, g13, g23, mesh) {};
9696
};
9797

9898
class ContravariantMetricTensor : public MetricTensor {
@@ -101,12 +101,12 @@ public:
101101
ContravariantMetricTensor(FieldMetric g_11, FieldMetric g_22, FieldMetric g_33,
102102
FieldMetric g_12, FieldMetric g_13, FieldMetric g_23)
103103
: MetricTensor(std::move(g_11), std::move(g_22), std::move(g_33), std::move(g_12),
104-
std::move(g_13), std::move(g_23)){};
104+
std::move(g_13), std::move(g_23)) {};
105105

106106
ContravariantMetricTensor(const BoutReal g_11, const BoutReal g_22, const BoutReal g_33,
107107
const BoutReal g_12, const BoutReal g_13, const BoutReal g_23,
108108
Mesh* mesh)
109-
: MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23, mesh){};
109+
: MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23, mesh) {};
110110
};
111111

112112
#endif //BOUT_METRIC_TENSOR_HXX

src/mesh/boundary_standard.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,9 +2171,9 @@ void BoundaryNeumann_NonOrthogonal::apply(Field3D& f) {
21712171
BoutReal delta = bndry->bx * metric->dx(bndry->x, bndry->y, zk)
21722172
+ bndry->by * metric->dy(bndry->x, bndry->y, zk);
21732173
#else
2174-
BoutReal delta = bndry->bx * metric->dx(bndry->x, bndry->y)
2175-
+ bndry->by * metric->dy(bndry->x, bndry->y);
2176-
for (int zk = 0; zk < mesh->LocalNz; zk++) {
2174+
BoutReal delta = bndry->bx * metric->dx(bndry->x, bndry->y)
2175+
+ bndry->by * metric->dy(bndry->x, bndry->y);
2176+
for (int zk = 0; zk < mesh->LocalNz; zk++) {
21772177
#endif
21782178
if (fg) {
21792179
val = fg->generate(Context(bndry, zk, loc, t, mesh));
@@ -2670,8 +2670,8 @@ void BoundaryNeumann_NonOrthogonal::apply(Field3D& f) {
26702670
-1.0 * sqrt(metric->g33(x, y) / metric->g11(x, y)) * metric->dx(x, y);
26712671
for (int jz = 1; jz <= ncz / 2; jz++) {
26722672
BoutReal kwave =
2673-
jz * 2.0 * PI / metric->zlength(x, y); // wavenumber in [rad^-1]
2674-
c0[jz] *= exp(coef * kwave); // The decaying solution only
2673+
jz * 2.0 * PI / metric->zlength(x, y); // wavenumber in [rad^-1]
2674+
c0[jz] *= exp(coef * kwave); // The decaying solution only
26752675
}
26762676
// Reverse FFT
26772677
irfft(c0.begin(), mesh->LocalNz, f(x, y));

src/mesh/christoffel_symbols.cxx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,15 @@ ChristoffelSymbols::ChristoffelSymbols(Coordinates& coordinates) {
9696
+ 0.5 * g23 * coordinates.DDX(g_22)
9797
//+ 0.5 *g33*(coordinates.DDY(covariantMetricTensor.Getg31()) + coordinates.DDX(covariantMetricTensor.Getg32()) - coordinates.DDZ(g_12));
9898
// which equals to
99-
+ 0.5 * g33 * (coordinates.DDY(g_13)) + coordinates.DDX(g_23) - coordinates.DDZ(g_12);
100-
G3_13_m = 0.5 * g13 * coordinates.DDZ(g_11) + 0.5 * g23 * (coordinates.DDZ(g_12) + coordinates.DDX(g_23) - coordinates.DDY(g_13))
101-
+ 0.5 * g33 * coordinates.DDX(g_33);
102-
G3_23_m = 0.5 * g13 * (coordinates.DDZ(g_12) + coordinates.DDY(g_13)) - coordinates.DDX(g_23) + 0.5 * g23 * coordinates.DDZ(g_22)
99+
+ 0.5 * g33 * (coordinates.DDY(g_13)) + coordinates.DDX(g_23)
100+
- coordinates.DDZ(g_12);
101+
G3_13_m =
102+
0.5 * g13 * coordinates.DDZ(g_11)
103+
+ 0.5 * g23
104+
* (coordinates.DDZ(g_12) + coordinates.DDX(g_23) - coordinates.DDY(g_13))
105+
+ 0.5 * g33 * coordinates.DDX(g_33);
106+
G3_23_m = 0.5 * g13 * (coordinates.DDZ(g_12) + coordinates.DDY(g_13))
107+
- coordinates.DDX(g_23) + 0.5 * g23 * coordinates.DDZ(g_22)
103108
+ 0.5 * g33 * coordinates.DDY(g_33);
104109

105110
output_progress.write("\tCommunicating connection terms\n");

src/mesh/coordinates.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
#include <bout/sys/timer.hxx>
1414
#include <bout/utils.hxx>
1515

16-
#include <bout/fft.hxx>
17-
#include <bout/interpolation.hxx>
18-
#include <bout/output_bout_types.hxx>
1916
#include "parallel/fci.hxx"
2017
#include "parallel/shiftedmetricinterp.hxx"
2118
#include "bout/derivs.hxx"
19+
#include <bout/fft.hxx>
20+
#include <bout/interpolation.hxx>
21+
#include <bout/output_bout_types.hxx>
2222

2323
#include <bout/bout_types.hxx>
2424

@@ -1547,4 +1547,4 @@ void Coordinates::communicateMetricTensor() {
15471547
covariantMetricTensor.communicate();
15481548
}
15491549

1550-
void Coordinates::communicateDz() { localmesh->communicate(dz_); }
1550+
void Coordinates::communicateDz() { localmesh->communicate(dz_); }

src/mesh/difops.cxx

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Field3D Grad_parP(const Field3D& apar, const Field3D& f) {
8484

8585
Field3D result{emptyFrom(f)};
8686

87-
int const ncz = mesh->LocalNz;
87+
const int ncz = mesh->LocalNz;
8888

8989
Coordinates* metric = apar.getCoordinates();
9090

@@ -106,15 +106,15 @@ Field3D Grad_parP(const Field3D& apar, const Field3D& f) {
106106
for (int z = 0; z < ncz; z++) {
107107
BoutReal by = 1. / sqrt(metric->g_22(x, y, z));
108108
// Z indices zm and zp
109-
int const zm = (z - 1 + ncz) % ncz;
110-
int const zp = (z + 1) % ncz;
109+
const int zm = (z - 1 + ncz) % ncz;
110+
const int zp = (z + 1) % ncz;
111111

112112
// bx = -DDZ(apar)
113-
BoutReal const bx = (apar(x, y, zm) - apar(x, y, zp))
113+
const BoutReal bx = (apar(x, y, zm) - apar(x, y, zp))
114114
/ (0.5 * metric->dz(x, y, zm) + metric->dz(x, y, z)
115115
+ 0.5 * metric->dz(x, y, zp));
116116
// bz = DDX(f)
117-
BoutReal const bz = (apar(x + 1, y, z) - apar(x - 1, y, z))
117+
const BoutReal bz = (apar(x + 1, y, z) - apar(x - 1, y, z))
118118
/ (0.5 * metric->dx(x - 1, y, z) + metric->dx(x, y, z)
119119
+ 0.5 * metric->dx(x + 1, y, z));
120120

@@ -251,19 +251,19 @@ Field3D Div_par(const Field3D& f, const Field3D& v) {
251251
for (int j = mesh->ystart; j <= mesh->yend; j++) {
252252
for (int k = mesh->zstart; k <= mesh->zend; k++) {
253253
// Value of f and v at left cell face
254-
BoutReal const fL = 0.5 * (f(i, j, k) + f.ydown()(i, j - 1, k));
255-
BoutReal const vL = 0.5 * (v(i, j, k) + v.ydown()(i, j - 1, k));
254+
const BoutReal fL = 0.5 * (f(i, j, k) + f.ydown()(i, j - 1, k));
255+
const BoutReal vL = 0.5 * (v(i, j, k) + v.ydown()(i, j - 1, k));
256256

257-
BoutReal const fR = 0.5 * (f(i, j, k) + f.yup()(i, j + 1, k));
258-
BoutReal const vR = 0.5 * (v(i, j, k) + v.yup()(i, j + 1, k));
257+
const BoutReal fR = 0.5 * (f(i, j, k) + f.yup()(i, j + 1, k));
258+
const BoutReal vR = 0.5 * (v(i, j, k) + v.yup()(i, j + 1, k));
259259

260260
// Calculate flux at right boundary (y+1/2)
261-
BoutReal const fluxRight =
261+
const BoutReal fluxRight =
262262
fR * vR * (coord->J(i, j, k) + coord->J(i, j + 1, k))
263263
/ (sqrt(coord->g_22(i, j, k)) + sqrt(coord->g_22(i, j + 1, k)));
264264

265265
// Calculate at left boundary (y-1/2)
266-
BoutReal const fluxLeft =
266+
const BoutReal fluxLeft =
267267
fL * vL * (coord->J(i, j, k) + coord->J(i, j - 1, k))
268268
/ (sqrt(coord->g_22(i, j, k)) + sqrt(coord->g_22(i, j - 1, k)));
269269

@@ -469,12 +469,12 @@ Coordinates::FieldMetric b0xGrad_dot_Grad(const Field2D& phi, const Field2D& A,
469469
Coordinates* metric = phi.getCoordinates(outloc);
470470

471471
// Calculate phi derivatives
472-
Coordinates::FieldMetric const dpdx = DDX(phi, outloc);
473-
Coordinates::FieldMetric const dpdy = DDY(phi, outloc);
472+
const Coordinates::FieldMetric dpdx = DDX(phi, outloc);
473+
const Coordinates::FieldMetric dpdy = DDY(phi, outloc);
474474

475475
// Calculate advection velocity
476-
Coordinates::FieldMetric const vx = -metric->g_23() * dpdy;
477-
Coordinates::FieldMetric const vy = metric->g_23() * dpdx;
476+
const Coordinates::FieldMetric vx = -metric->g_23() * dpdy;
477+
const Coordinates::FieldMetric vy = metric->g_23() * dpdx;
478478

479479
// Upwind A using these velocities
480480
Coordinates::FieldMetric result = VDDX(vx, A, outloc) + VDDY(vy, A, outloc);
@@ -502,12 +502,12 @@ Field3D b0xGrad_dot_Grad(const Field2D& phi, const Field3D& A, CELL_LOC outloc)
502502
Coordinates* metric = phi.getCoordinates(outloc);
503503

504504
// Calculate phi derivatives
505-
Coordinates::FieldMetric const dpdx = DDX(phi, outloc);
506-
Coordinates::FieldMetric const dpdy = DDY(phi, outloc);
505+
const Coordinates::FieldMetric dpdx = DDX(phi, outloc);
506+
const Coordinates::FieldMetric dpdy = DDY(phi, outloc);
507507

508508
// Calculate advection velocity
509-
Coordinates::FieldMetric const vx = -metric->g_23() * dpdy;
510-
Coordinates::FieldMetric const vy = metric->g_23() * dpdx;
509+
const Coordinates::FieldMetric vx = -metric->g_23() * dpdy;
510+
const Coordinates::FieldMetric vy = metric->g_23() * dpdx;
511511
Coordinates::FieldMetric vz = metric->g_12() * dpdy - metric->g_22() * dpdx;
512512

513513
if (mesh->IncIntShear) {
@@ -542,13 +542,13 @@ Field3D b0xGrad_dot_Grad(const Field3D& p, const Field2D& A, CELL_LOC outloc) {
542542
Coordinates* metric = p.getCoordinates(outloc);
543543

544544
// Calculate phi derivatives
545-
Field3D const dpdx = DDX(p, outloc);
546-
Field3D const dpdy = DDY(p, outloc);
547-
Field3D const dpdz = DDZ(p, outloc);
545+
const Field3D dpdx = DDX(p, outloc);
546+
const Field3D dpdy = DDY(p, outloc);
547+
const Field3D dpdz = DDZ(p, outloc);
548548

549549
// Calculate advection velocity
550-
Field3D const vx = metric->g_22() * dpdz - metric->g_23() * dpdy;
551-
Field3D const vy = metric->g_23() * dpdx - metric->g_12() * dpdz;
550+
const Field3D vx = metric->g_22() * dpdz - metric->g_23() * dpdy;
551+
const Field3D vy = metric->g_23() * dpdx - metric->g_12() * dpdz;
552552

553553
// Upwind A using these velocities
554554

@@ -579,13 +579,13 @@ Field3D b0xGrad_dot_Grad(const Field3D& phi, const Field3D& A, CELL_LOC outloc)
579579
Coordinates* metric = phi.getCoordinates(outloc);
580580

581581
// Calculate phi derivatives
582-
Field3D const dpdx = DDX(phi, outloc);
583-
Field3D const dpdy = DDY(phi, outloc);
584-
Field3D const dpdz = DDZ(phi, outloc);
582+
const Field3D dpdx = DDX(phi, outloc);
583+
const Field3D dpdy = DDY(phi, outloc);
584+
const Field3D dpdz = DDZ(phi, outloc);
585585

586586
// Calculate advection velocity
587-
Field3D const vx = metric->g_22() * dpdz - metric->g_23() * dpdy;
588-
Field3D const vy = metric->g_23() * dpdx - metric->g_12() * dpdz;
587+
const Field3D vx = metric->g_22() * dpdz - metric->g_23() * dpdy;
588+
const Field3D vy = metric->g_23() * dpdx - metric->g_12() * dpdz;
589589
Field3D vz = metric->g_12() * dpdy - metric->g_22() * dpdx;
590590

591591
if (mesh->IncIntShear) {
@@ -666,13 +666,13 @@ Field3D bracket(const Field3D& f, const Field2D& g, BRACKET_METHOD method,
666666
for (int x = mesh->xstart; x <= mesh->xend; x++) {
667667
for (int y = mesh->ystart; y <= mesh->yend; y++) {
668668
for (int z = 0; z < ncz; z++) {
669-
int const zm = (z - 1 + ncz) % ncz;
670-
int const zp = (z + 1) % ncz;
669+
const int zm = (z - 1 + ncz) % ncz;
670+
const int zp = (z + 1) % ncz;
671671

672672
BoutReal gp, gm;
673673

674674
// Vx = DDZ(f)
675-
BoutReal const vx = (f(x, y, zp) - f(x, y, zm)) / (2. * metric->dz(x, y, z));
675+
const BoutReal vx = (f(x, y, zp) - f(x, y, zm)) / (2. * metric->dz(x, y, z));
676676

677677
// Set stability condition
678678
solver->setMaxTimestep(metric->dx(x, y, z) / (fabs(vx) + 1e-16));
@@ -786,19 +786,19 @@ Field3D bracket(const Field3D& f, const Field2D& g, BRACKET_METHOD method,
786786
// Above is alternative to const int jzmTmp = (jz - 1 + ncz) % ncz;
787787

788788
// J++ = DDZ(f)*DDX(g) - DDX(f)*DDZ(g)
789-
BoutReal const Jpp =
789+
const BoutReal Jpp =
790790
((f(jx, jy, jzp) - f(jx, jy, jzm)) * (g(jx + 1, jy) - g(jx - 1, jy))
791791
- (f(jx + 1, jy, jz) - f(jx - 1, jy, jz)) * (g(jx, jy) - g(jx, jy)));
792792

793793
// J+x
794-
BoutReal const Jpx =
794+
const BoutReal Jpx =
795795
(g(jx + 1, jy) * (f(jx + 1, jy, jzp) - f(jx + 1, jy, jzm))
796796
- g(jx - 1, jy) * (f(jx - 1, jy, jzp) - f(jx - 1, jy, jzm))
797797
- g(jx, jy) * (f(jx + 1, jy, jzp) - f(jx - 1, jy, jzp))
798798
+ g(jx, jy) * (f(jx + 1, jy, jzm) - f(jx - 1, jy, jzm)));
799799

800800
// Jx+
801-
BoutReal const Jxp = (g(jx + 1, jy) * (f(jx, jy, jzp) - f(jx + 1, jy, jz))
801+
const BoutReal Jxp = (g(jx + 1, jy) * (f(jx, jy, jzp) - f(jx + 1, jy, jz))
802802
- g(jx - 1, jy) * (f(jx - 1, jy, jz) - f(jx, jy, jzm))
803803
- g(jx - 1, jy) * (f(jx, jy, jzp) - f(jx - 1, jy, jz))
804804
+ g(jx + 1, jy) * (f(jx + 1, jy, jz) - f(jx, jy, jzm)));
@@ -894,20 +894,20 @@ Field3D bracket(const Field3D& f, const Field3D& g, BRACKET_METHOD method,
894894
}
895895

896896
// Get current timestep
897-
BoutReal const dt = solver->getCurrentTimestep();
897+
const BoutReal dt = solver->getCurrentTimestep();
898898

899899
FieldPerp vx(mesh), vz(mesh);
900900
vx.allocate();
901901
vx.setLocation(outloc);
902902
vz.allocate();
903903
vz.setLocation(outloc);
904904

905-
int const ncz = mesh->LocalNz;
905+
const int ncz = mesh->LocalNz;
906906
for (int y = mesh->ystart; y <= mesh->yend; y++) {
907907
for (int x = 1; x <= mesh->LocalNx - 2; x++) {
908908
for (int z = 0; z < mesh->LocalNz; z++) {
909-
int const zm = (z - 1 + ncz) % ncz;
910-
int const zp = (z + 1) % ncz;
909+
const int zm = (z - 1 + ncz) % ncz;
910+
const int zp = (z + 1) % ncz;
911911

912912
// Vx = DDZ(f)
913913
vx(x, z) = (f(x, y, zp) - f(x, y, zm)) / (2. * metric->dz(x, y, z));
@@ -926,8 +926,8 @@ Field3D bracket(const Field3D& f, const Field3D& g, BRACKET_METHOD method,
926926

927927
for (int x = mesh->xstart; x <= mesh->xend; x++) {
928928
for (int z = 0; z < ncz; z++) {
929-
int const zm = (z - 1 + ncz) % ncz;
930-
int const zp = (z + 1) % ncz;
929+
const int zm = (z - 1 + ncz) % ncz;
930+
const int zp = (z + 1) % ncz;
931931

932932
BoutReal gp, gm;
933933

src/mesh/metric_tensor.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "bout/metric_tensor.hxx"
22
#include "fmt/core.h"
3-
#include "bout/bout_types.hxx"
43
#include "invert3x3.hxx"
4+
#include "bout/bout_types.hxx"
55
#include "bout/boutexception.hxx"
66
#include "bout/field2d.hxx"
77
#include "bout/mesh.hxx"
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
bout_add_integrated_test(test-laplacexy2-hypre
1+
bout_add_integrated_test(
2+
test-laplacexy2-hypre
23
SOURCES test-laplacexy.cxx
34
REQUIRES BOUT_HAS_HYPRE
45
CONFLICTS BOUT_USE_METRIC_3D
5-
USE_RUNTEST
6-
USE_DATA_BOUT_INP
7-
)
6+
USE_RUNTEST USE_DATA_BOUT_INP
7+
)

0 commit comments

Comments
 (0)