Skip to content

Commit 0883eda

Browse files
authored
Merge pull request #3241 from boutproject/remove-arakawa-old
Remove `BRACKET_ARAKAWA_OLD`
2 parents d2f3f44 + 0b48cc8 commit 0883eda

File tree

7 files changed

+7
-121
lines changed

7 files changed

+7
-121
lines changed

examples/performance/bracket/bracket.cxx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ int main(int argc, char** argv) {
6868
ITERATOR_TEST_BLOCK("Bracket [2D,3D] ARAKAWA",
6969
result = bracket(a, c, BRACKET_ARAKAWA););
7070

71-
ITERATOR_TEST_BLOCK("Bracket [2D,3D] ARAKAWA_OLD",
72-
result = bracket(a, c, BRACKET_ARAKAWA_OLD););
73-
7471
ITERATOR_TEST_BLOCK("Bracket [2D,3D] SIMPLE",
7572
result = bracket(a, c, BRACKET_SIMPLE););
7673

@@ -81,21 +78,12 @@ int main(int argc, char** argv) {
8178
ITERATOR_TEST_BLOCK("Bracket [3D,3D] ARAKAWA",
8279
result = bracket(a, b, BRACKET_ARAKAWA););
8380

84-
ITERATOR_TEST_BLOCK("Bracket [3D,3D] ARAKAWA_OLD",
85-
result = bracket(a, b, BRACKET_ARAKAWA_OLD););
86-
8781
ITERATOR_TEST_BLOCK("Bracket [3D,3D] SIMPLE",
8882
result = bracket(a, b, BRACKET_SIMPLE););
8983

9084
ITERATOR_TEST_BLOCK("Bracket [3D,3D] DEFAULT", result = bracket(a, b, BRACKET_STD););
9185
}
9286

93-
// Uncomment below for a "correctness" check
94-
// Field3D resNew = bracket(a, b, BRACKET_ARAKAWA); mesh->communicate(resNew);
95-
// Field3D resOld = bracket(a, b, BRACKET_ARAKAWA_OLD); mesh->communicate(resOld);
96-
// time_output << "Max abs diff is
97-
// "<<max(abs(resNew-resOld),true)/max(abs(resOld),true)<<std::endl;
98-
9987
if (profileMode) {
10088
int nthreads = 0;
10189
#if BOUT_USE_OPENMP

include/bout/difops.hxx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,18 +271,16 @@ Field3D b0xGrad_dot_Grad(const Field3D& phi, const Field3D& A,
271271
* Poisson bracket methods
272272
*/
273273
enum class BRACKET_METHOD {
274-
standard, ///< Use b0xGrad_dot_Grad
275-
simple, ///< Keep only terms in X-Z
276-
arakawa, ///< Arakawa method in X-Z (optimised)
277-
ctu, ///< Corner Transport Upwind (CTU) method. Explicit method only, needs the
278-
/// timestep from the solver
279-
arakawa_old ///< Older version, for regression testing of optimised version.
274+
standard, ///< Use b0xGrad_dot_Grad
275+
simple, ///< Keep only terms in X-Z
276+
arakawa, ///< Arakawa method in X-Z
277+
ctu, ///< Corner Transport Upwind (CTU) method. Explicit method only, needs the
278+
/// timestep from the solver
280279
};
281280
constexpr BRACKET_METHOD BRACKET_STD = BRACKET_METHOD::standard;
282281
constexpr BRACKET_METHOD BRACKET_SIMPLE = BRACKET_METHOD::simple;
283282
constexpr BRACKET_METHOD BRACKET_ARAKAWA = BRACKET_METHOD::arakawa;
284283
constexpr BRACKET_METHOD BRACKET_CTU = BRACKET_METHOD::ctu;
285-
constexpr BRACKET_METHOD BRACKET_ARAKAWA_OLD = BRACKET_METHOD::arakawa_old;
286284

287285
/*!
288286
* Compute advection operator terms, which can be cast as

manual/sphinx/user_docs/python_boutpp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ A real example - check derivative contributions:
160160
phi[-1,:,z]=phi_arr
161161
with open(path+"/equilibrium/phi_eq.dat","rb") as inf:
162162
phi_arr=np.fromfile(inf,dtype=np.double)
163-
bm="BRACKET_ARAKAWA_OLD"
163+
bm="BRACKET_ARAKAWA"
164164
165165
for tind in range(len(times)):
166166
vort = Field3D.fromCollect("vort" ,path=path,tind=tind,info=False)

src/mesh/difops.cxx

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -771,46 +771,6 @@ Field3D bracket(const Field3D& f, const Field2D& g, BRACKET_METHOD method,
771771

772772
break;
773773
}
774-
case BRACKET_ARAKAWA_OLD: {
775-
#if not(BOUT_USE_METRIC_3D)
776-
const int ncz = mesh->LocalNz;
777-
BOUT_OMP_PERF(parallel for)
778-
for (int jx = mesh->xstart; jx <= mesh->xend; jx++) {
779-
for (int jy = mesh->ystart; jy <= mesh->yend; jy++) {
780-
const BoutReal partialFactor = 1.0 / (12 * metric->dz(jx, jy));
781-
const BoutReal spacingFactor = partialFactor / metric->dx(jx, jy);
782-
for (int jz = 0; jz < mesh->LocalNz; jz++) {
783-
const int jzp = jz + 1 < ncz ? jz + 1 : 0;
784-
// Above is alternative to const int jzp = (jz + 1) % ncz;
785-
const int jzm = jz - 1 >= 0 ? jz - 1 : ncz - 1;
786-
// Above is alternative to const int jzmTmp = (jz - 1 + ncz) % ncz;
787-
788-
// J++ = DDZ(f)*DDX(g) - DDX(f)*DDZ(g)
789-
BoutReal Jpp =
790-
((f(jx, jy, jzp) - f(jx, jy, jzm)) * (g(jx + 1, jy) - g(jx - 1, jy))
791-
- (f(jx + 1, jy, jz) - f(jx - 1, jy, jz)) * (g(jx, jy) - g(jx, jy)));
792-
793-
// J+x
794-
BoutReal Jpx = (g(jx + 1, jy) * (f(jx + 1, jy, jzp) - f(jx + 1, jy, jzm))
795-
- g(jx - 1, jy) * (f(jx - 1, jy, jzp) - f(jx - 1, jy, jzm))
796-
- g(jx, jy) * (f(jx + 1, jy, jzp) - f(jx - 1, jy, jzp))
797-
+ g(jx, jy) * (f(jx + 1, jy, jzm) - f(jx - 1, jy, jzm)));
798-
799-
// Jx+
800-
BoutReal Jxp = (g(jx + 1, jy) * (f(jx, jy, jzp) - f(jx + 1, jy, jz))
801-
- g(jx - 1, jy) * (f(jx - 1, jy, jz) - f(jx, jy, jzm))
802-
- g(jx - 1, jy) * (f(jx, jy, jzp) - f(jx - 1, jy, jz))
803-
+ g(jx + 1, jy) * (f(jx + 1, jy, jz) - f(jx, jy, jzm)));
804-
805-
result(jx, jy, jz) = (Jpp + Jpx + Jxp) * spacingFactor;
806-
}
807-
}
808-
}
809-
#else
810-
throw BoutException("BRACKET_ARAKAWA_OLD not valid with 3D metrics yet.");
811-
#endif
812-
break;
813-
}
814774
case BRACKET_SIMPLE: {
815775
// Use a subset of terms for comparison to BOUT-06
816776
result = VDDX(DDZ(f, outloc), g, outloc);
@@ -1090,63 +1050,6 @@ Field3D bracket(const Field3D& f, const Field3D& g, BRACKET_METHOD method,
10901050
}
10911051
break;
10921052
}
1093-
case BRACKET_ARAKAWA_OLD: {
1094-
// Arakawa scheme for perpendicular flow
1095-
1096-
const int ncz = mesh->LocalNz;
1097-
1098-
// We need to discard const qualifier in order to manipulate
1099-
// storage array directly
1100-
Field3D f_temp = f;
1101-
Field3D g_temp = g;
1102-
1103-
BOUT_OMP_PERF(parallel for)
1104-
for (int jx = mesh->xstart; jx <= mesh->xend; jx++) {
1105-
for (int jy = mesh->ystart; jy <= mesh->yend; jy++) {
1106-
#if not(BOUT_USE_METRIC_3D)
1107-
const BoutReal spacingFactor =
1108-
1.0 / (12 * metric->dz(jx, jy) * metric->dx(jx, jy));
1109-
#endif
1110-
const BoutReal* Fxm = f_temp(jx - 1, jy);
1111-
const BoutReal* Fx = f_temp(jx, jy);
1112-
const BoutReal* Fxp = f_temp(jx + 1, jy);
1113-
const BoutReal* Gxm = g_temp(jx - 1, jy);
1114-
const BoutReal* Gx = g_temp(jx, jy);
1115-
const BoutReal* Gxp = g_temp(jx + 1, jy);
1116-
for (int jz = 0; jz < mesh->LocalNz; jz++) {
1117-
#if BOUT_USE_METRIC_3D
1118-
const BoutReal spacingFactor =
1119-
1.0 / (12 * metric->dz(jx, jy, jz) * metric->dx(jx, jy, jz));
1120-
#endif
1121-
const int jzp = jz + 1 < ncz ? jz + 1 : 0;
1122-
// Above is alternative to const int jzp = (jz + 1) % ncz;
1123-
const int jzm = jz - 1 >= 0 ? jz - 1 : ncz - 1;
1124-
// Above is alternative to const int jzm = (jz - 1 + ncz) % ncz;
1125-
1126-
// J++ = DDZ(f)*DDX(g) - DDX(f)*DDZ(g)
1127-
// NOLINTNEXTLINE
1128-
BoutReal Jpp = ((Fx[jzp] - Fx[jzm]) * (Gxp[jz] - Gxm[jz])
1129-
- (Fxp[jz] - Fxm[jz]) * (Gx[jzp] - Gx[jzm]));
1130-
1131-
// J+x
1132-
// NOLINTNEXTLINE
1133-
BoutReal Jpx =
1134-
(Gxp[jz] * (Fxp[jzp] - Fxp[jzm]) - Gxm[jz] * (Fxm[jzp] - Fxm[jzm])
1135-
- Gx[jzp] * (Fxp[jzp] - Fxm[jzp]) + Gx[jzm] * (Fxp[jzm] - Fxm[jzm]));
1136-
1137-
// Jx+
1138-
// NOLINTNEXTLINE
1139-
BoutReal Jxp =
1140-
(Gxp[jzp] * (Fx[jzp] - Fxp[jz]) - Gxm[jzm] * (Fxm[jz] - Fx[jzm])
1141-
- Gxm[jzp] * (Fx[jzp] - Fxm[jz]) + Gxp[jzm] * (Fxp[jz] - Fx[jzm]));
1142-
1143-
result(jx, jy, jz) = (Jpp + Jpx + Jxp) * spacingFactor;
1144-
}
1145-
}
1146-
}
1147-
1148-
break;
1149-
}
11501053
case BRACKET_SIMPLE: {
11511054
// Use a subset of terms for comparison to BOUT-06
11521055
result = VDDX(DDZ(f, outloc), g, outloc) + VDDZ(-DDX(f, outloc), g, outloc);

tests/MMS/spatial/advection/runtest

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ build_and_log("MMS steady-state advection test")
4343
# List of options to be passed for each test
4444
options = [
4545
("method=2", "Arakawa", "-^", 2),
46-
("method=4", "Arakawa-old", "-.", 2),
4746
(
4847
"method=1 mesh:ddx:upwind=u1 mesh:ddz:upwind=u1",
4948
"SIMPLE: 1st order upwind",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#ifdef YOU_SHOULDNT_READ_THIS
22
#error YOU_SHOULDNT_BE_HERE
3-
enum class BRACKET_METHOD { standard, simple, arakawa, ctu, arakawa_old };
3+
enum class BRACKET_METHOD { standard, simple, arakawa, ctu };
44
#endif

tools/pylib/_boutpp_build/scan_enums.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ def __str__(self):
7878
"ARAKAWA": "arakawa",
7979
"BRACKET_CTU": "ctu",
8080
"CTU": "ctu",
81-
"BRACKET_ARAKAWA_OLD": "arakawa_old",
82-
"ARAKAWA_OLD": "arakawa_old",
8381
}
8482
enums["CELL_LOC"].extra = {
8583
"CELL_DEFAULT": "deflt",

0 commit comments

Comments
 (0)