Skip to content

Commit b20d19d

Browse files
authored
Merge branch 'next' into more-zstart-zend-loops
2 parents 0386f67 + 0883eda commit b20d19d

File tree

12 files changed

+8
-176
lines changed

12 files changed

+8
-176
lines changed

examples/dalf3/dalf3.cxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ class DALF3 : public PhysicsModel {
7171

7272
BoutReal viscosity, hyper_viscosity;
7373

74-
bool smooth_separatrix;
75-
7674
FieldGroup comms;
7775

7876
std::unique_ptr<Laplacian> phiSolver{nullptr}; // Laplacian solver in X-Z
@@ -132,7 +130,6 @@ class DALF3 : public PhysicsModel {
132130
viscosity = options["viscosity"].withDefault(-1.0);
133131
hyper_viscosity = options["hyper_viscosity"].withDefault(-1.0);
134132
viscosity_par = options["viscosity_par"].withDefault(-1.0);
135-
smooth_separatrix = options["smooth_separatrix"].withDefault(false);
136133

137134
filter_z = options["filter_z"].withDefault(false);
138135

@@ -466,11 +463,6 @@ class DALF3 : public PhysicsModel {
466463
ddt(Pe) = -bracket(phi, Pet, bm)
467464
+ Pet * (Kappa(phi - Pe) + B0 * Grad_parP(jpar - Vpar) / B0);
468465

469-
if (smooth_separatrix) {
470-
// Experimental smoothing across separatrix
471-
ddt(Vort) += mesh->smoothSeparatrix(Vort);
472-
}
473-
474466
if (filter_z) {
475467
ddt(Pe) = filter(ddt(Pe), 1);
476468
}

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

include/bout/mesh.hxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,6 @@ public:
505505
virtual void addBoundaryPar(std::shared_ptr<BoundaryRegionPar> UNUSED(bndry),
506506
BoundaryParType UNUSED(type)) {}
507507

508-
/// Branch-cut special handling (experimental)
509-
virtual Field3D smoothSeparatrix(const Field3D& f) { return f; }
510-
511508
virtual BoutReal GlobalX(int jx) const = 0; ///< Continuous X index between 0 and 1
512509
virtual BoutReal GlobalY(int jy) const = 0; ///< Continuous Y index (0 -> 1)
513510
virtual BoutReal GlobalX(BoutReal jx) const = 0; ///< Continuous X index between 0 and 1

manual/sphinx/user_docs/bout_options.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ automatically set the ``"time_dimension"`` attribute::
950950
data["field"] = Field3D(3.0);
951951
952952
// Append data to file
953-
bout::OptionsIO({{"file", "time.nc"}, {"append", true}})->write(data);
953+
bout::OptionsIO::create({{"file", "time.nc"}, {"append", true}})->write(data);
954954

955955
.. note:: By default, `bout::OptionsIO::write` will only write variables
956956
with a ``"time_dimension"`` of ``"t"``. You can write

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 = mesh->zstart; jz <= mesh->zend; 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);

src/mesh/impls/bout/boutmesh.cxx

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3115,47 +3115,6 @@ void BoutMesh::addBoundaryPar(std::shared_ptr<BoundaryRegionPar> bndry,
31153115
par_boundary[static_cast<int>(BoundaryParType::all)].push_back(bndry);
31163116
}
31173117

3118-
Field3D BoutMesh::smoothSeparatrix(const Field3D& f) {
3119-
Field3D result{emptyFrom(f)};
3120-
if ((ixseps_inner > 0) && (ixseps_inner < nx - 1)) {
3121-
if (XPROC(ixseps_inner) == PE_XIND) {
3122-
int x = getLocalXIndex(ixseps_inner);
3123-
for (int y = 0; y < LocalNy; y++) {
3124-
for (int z = 0; z < LocalNz; z++) {
3125-
result(x, y, z) = 0.5 * (f(x, y, z) + f(x - 1, y, z));
3126-
}
3127-
}
3128-
}
3129-
if (XPROC(ixseps_inner - 1) == PE_XIND) {
3130-
int x = getLocalXIndex(ixseps_inner - 1);
3131-
for (int y = 0; y < LocalNy; y++) {
3132-
for (int z = 0; z < LocalNz; z++) {
3133-
result(x, y, z) = 0.5 * (f(x, y, z) + f(x + 1, y, z));
3134-
}
3135-
}
3136-
}
3137-
}
3138-
if ((ixseps_outer > 0) && (ixseps_outer < nx - 1) && (ixseps_outer != ixseps_inner)) {
3139-
if (XPROC(ixseps_outer) == PE_XIND) {
3140-
int x = getLocalXIndex(ixseps_outer);
3141-
for (int y = 0; y < LocalNy; y++) {
3142-
for (int z = 0; z < LocalNz; z++) {
3143-
result(x, y, z) = 0.5 * (f(x, y, z) + f(x - 1, y, z));
3144-
}
3145-
}
3146-
}
3147-
if (XPROC(ixseps_outer - 1) == PE_XIND) {
3148-
int x = getLocalXIndex(ixseps_outer - 1);
3149-
for (int y = 0; y < LocalNy; y++) {
3150-
for (int z = 0; z < LocalNz; z++) {
3151-
result(x, y, z) = 0.5 * (f(x, y, z) + f(x + 1, y, z));
3152-
}
3153-
}
3154-
}
3155-
}
3156-
return result;
3157-
}
3158-
31593118
BoutReal BoutMesh::GlobalX(int jx) const {
31603119
if (symmetricGlobalX) {
31613120
// With this definition the boundary sits dx/2 away form the first/last inner points

src/mesh/impls/bout/boutmesh.hxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ public:
167167
BoundaryParType type) override;
168168
std::set<std::string> getPossibleBoundaries() const override;
169169

170-
Field3D smoothSeparatrix(const Field3D& f) override;
171-
172170
int getNx() const { return nx; }
173171
int getNy() const { return ny; }
174172

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",

0 commit comments

Comments
 (0)