Skip to content

Commit 0537766

Browse files
committed
Pass no shear condition to set_tokamak_coordinates_on_mesh() as an (optional) integer parameter rather than a boolean
Suggested on PR.
1 parent 6f58d8e commit 0537766

File tree

17 files changed

+2142
-2151
lines changed

17 files changed

+2142
-2151
lines changed

examples/6field-simple/elm_6f.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,10 +1031,11 @@ class Elm_6f : public PhysicsModel {
10311031
// SHIFTED RADIAL COORDINATES
10321032
if (!mesh->IncIntShear) {
10331033
noshear = true;
1034+
ShearFactor = 1.0;
10341035
}
10351036

10361037
/**************** CALCULATE METRICS ******************/
1037-
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, noshear, Lbar, Bbar);
1038+
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, Lbar, Bbar, 1.0);
10381039

10391040
//////////////////////////////////////////////////////////////
10401041
// SHIFTED RADIAL COORDINATES

examples/conducting-wall-mode/cwm.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ class CWM : public PhysicsModel {
5555

5656
int init(bool UNUSED(restarting)) override {
5757

58-
bool noshear = false;
59-
6058
/************* LOAD DATA FROM GRID FILE ****************/
6159

6260
// Load 2D profiles (set to zero if not found)
@@ -95,7 +93,7 @@ class CWM : public PhysicsModel {
9593
"identity");
9694

9795
if (lowercase(ptstr) == "shifted") {
98-
noshear = true;
96+
ShearFactor = 0.0; // I disappears from metric
9997
}
10098

10199
/************** CALCULATE PARAMETERS *****************/
@@ -132,7 +130,7 @@ class CWM : public PhysicsModel {
132130
Te0 /= Te_x;
133131

134132
// Normalise geometry
135-
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, noshear, rho_s, bmag / 1e4, ShearFactor);
133+
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, rho_s, bmag / 1e4, ShearFactor);
136134

137135
// Set nu
138136
nu = nu_hat * Ni0 / pow(Te0, 1.5);

examples/constraints/alfven-wave/alfven.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,18 @@ class Alfven : public PhysicsModel {
163163
// Get the coordinates object
164164
Coordinates* coord = mesh->getCoordinates();
165165

166-
bool noshear;
167-
168166
// Check type of parallel transform
169167
std::string ptstr =
170168
Options::root()["mesh"]["paralleltransform"]["type"].withDefault("identity");
171169

170+
BoutReal shearFactor = 1.0
172171
if (lowercase(ptstr) == "shifted") {
173-
noshear = true;
172+
// Using shifted metric method
173+
shearFactor = 0.0; // I disappears from metric
174174
}
175175

176176
auto tokamak_options = TokamakOptions(*mesh);
177-
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, noshear, Lnorm, Bnorm);
177+
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, Lnorm, Bnorm, shearFactor);
178178
}
179179
};
180180

examples/dalf3/dalf3.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ class DALF3 : public PhysicsModel {
8686
protected:
8787
int init(bool UNUSED(restarting)) override {
8888

89-
bool noshear;
90-
9189
/////////////////////////////////////////////////////
9290
// Load data from the grid
9391

@@ -162,10 +160,11 @@ class DALF3 : public PhysicsModel {
162160
std::string ptstr =
163161
Options::root()["mesh"]["paralleltransform"]["type"].withDefault("identity");
164162

163+
BoutReal shearFactor = 1.0;
165164
if (lowercase(ptstr) == "shifted") {
166165
// Dimits style, using local coordinate system
167166
b0xcv.z += tokamak_options.I * b0xcv.x;
168-
noshear = true;
167+
shearFactor = 0.0; // I disappears from metric
169168
}
170169

171170
///////////////////////////////////////////////////
@@ -224,7 +223,7 @@ class DALF3 : public PhysicsModel {
224223
b0xcv.z *= rho_s * rho_s;
225224

226225
// Metrics
227-
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, noshear, rho_s, Bnorm);
226+
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, rho_s, Bnorm, shearFactor);
228227

229228
SOLVE_FOR3(Vort, Pe, Vpar);
230229
comms.add(Vort, Pe, Vpar);

0 commit comments

Comments
 (0)