Skip to content

Commit 13c57a8

Browse files
committed
have outputs for the ionisation, charge-exchange and recombination rates and included the option to reverse the Curl(b/B) vector. Also had some small code tidy ups
1 parent 7d84855 commit 13c57a8

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

include/hermes-2.hxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ private:
226226

227227
// Curvature, Grad-B drift
228228
Vector3D Curlb_B; // Curl(b/B)
229+
bool revCurlb_B; // Reverse direction of Curl(b/B) vector
229230

230231
// Perturbed parallel gradient operators
231232
const Field3D Grad_parP(const Field3D &f);

include/mixed.hxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ private:
3333
Field3D Pnlim; // Limited pressure, used to calculate pressure-driven diffusive flows
3434
Field3D Vn;
3535
Field3D Dnn;
36+
37+
Field3D Riz, Rrc, Rcx, Rex;
3638

3739
bool sheath_ydown, sheath_yup;
3840

src/hermes-2.cxx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ int Hermes::init(bool restarting) {
307307
poloidal_flows = optsc["poloidal_flows"]
308308
.doc("Include ExB flows in X-Y plane")
309309
.withDefault(true);
310+
311+
revCurlb_B = optsc["revCurlb_B"]
312+
.doc("Reverse the direction of Curl(b/B)")
313+
.withDefault(true);
310314

311315
OPTION(optsc, ion_velocity, true);
312316

@@ -522,6 +526,12 @@ int Hermes::init(bool restarting) {
522526
// Inflowing density carries momentum
523527
OPTION(optne, density_inflow, false);
524528

529+
auto& optpe = opt["Pe"];
530+
PeSource = optpe["source"].withDefault(Field3D{0.0});
531+
532+
auto& optpi = opt["Pi"];
533+
PiSource = optpi["source"].withDefault(Field3D{0.0});
534+
525535
// radial buffer setup
526536
if (slab_radial_buffers || radial_buffers) {
527537
// Need to set the sources in the radial buffer regions to zero
@@ -585,13 +595,13 @@ int Hermes::init(bool restarting) {
585595
NeSource /= Omega_ci;
586596
Sn = DC(NeSource);
587597

588-
auto& optpe = opt["Pe"];
589-
PeSource = optpe["source"].withDefault(Field3D{0.0});
598+
// auto& optpe = opt["Pe"];
599+
// PeSource = optpe["source"].withDefault(Field3D{0.0});
590600
PeSource /= Omega_ci;
591601
Spe = DC(PeSource);
592602

593-
auto& optpi = opt["Pi"];
594-
PiSource = optpi["source"].withDefault(Field3D{0.0});
603+
// auto& optpi = opt["Pi"];
604+
// PiSource = optpi["source"].withDefault(Field3D{0.0});
595605
PiSource /= Omega_ci;
596606
Spi = DC(PiSource);
597607

@@ -603,7 +613,7 @@ int Hermes::init(bool restarting) {
603613
for (int y = mesh->ystart; y <= mesh->yend; y++) {
604614
Sn(x, y) = 0.0;
605615
Spe(x, y) = 0.0;
606-
Spi(x, y) = 0.0;
616+
Spi(x, y) = 0.0;
607617
}
608618
}
609619
}
@@ -907,6 +917,10 @@ int Hermes::init(bool restarting) {
907917
}
908918
}
909919
}
920+
921+
if (revCurlb_B) {
922+
Curlb_B = -1.0 * Curlb_B
923+
}
910924

911925
if (Options::root()["mesh"]["paralleltransform"].as<std::string>() == "shifted") {
912926
// Check if the gridfile was created for "shiftedmetric" or for "identity" parallel

src/mixed.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ NeutralMixed::NeutralMixed(Solver *solver, Mesh *UNUSED(mesh), Options &options)
6464
F = 0;
6565
Qi = 0;
6666
Rp = 0;
67+
68+
SAVE_REPEAT4(Riz, Rrc, Rcx, Rex);
6769
}
6870

6971
void NeutralMixed::update(const Field3D &Ne, const Field3D &Te,
@@ -168,7 +170,6 @@ void NeutralMixed::update(const Field3D &Ne, const Field3D &Te,
168170
// Atomic processes
169171
TRACE("Atomic processes");
170172

171-
Field3D Riz, Rrc, Rcx, Rex;
172173
neutral_rates(Ne, Te, Ti, Vi, Nn, Tn, Vn, S, F, Qi, Rp, Riz, Rrc, Rcx, Rex);
173174

174175
// Neutral cross-field diffusion coefficient

src/neutral-model.cxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ void NeutralModel::neutral_rates(
6161
Rcx = 0.0;
6262
Rex = 0.0;
6363

64-
SAVE_REPEAT4(Riz, Rrc, Rcx, Rex);
65-
6664
Coordinates *coord = mesh->getCoordinates();
6765

6866
for (int i = mesh->xstart; i <= mesh->xend; i++)

0 commit comments

Comments
 (0)