Skip to content

Commit

Permalink
Rename struct TokamakCoordinates to TokamakOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchapman committed Jan 28, 2025
1 parent 2ee750f commit d08ecf9
Show file tree
Hide file tree
Showing 18 changed files with 146 additions and 146 deletions.
22 changes: 11 additions & 11 deletions examples/6field-simple/elm_6f.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class Elm_6f : public PhysicsModel {
int damp_width; // Width of inner damped region
BoutReal damp_t_const; // Timescale of damping

TokamakCoordinates tokamak_coordinates = TokamakCoordinates(*mesh);
TokamakOptions tokamak_options = TokamakOptions(*mesh);

BoutReal LnLambda; // ln(Lambda)

Expand Down Expand Up @@ -366,7 +366,7 @@ class Elm_6f : public PhysicsModel {
result = Grad_par(f, loc);

if (nonlinear) {
result -= bracket(Psi, f, bm_mag) * tokamak_coordinates.Bxy;
result -= bracket(Psi, f, bm_mag) * tokamak_options.Bxy;
}
}

Expand Down Expand Up @@ -681,7 +681,7 @@ class Elm_6f : public PhysicsModel {

if (noshear) {
if (include_curvature) {
b0xcv.z += tokamak_coordinates.ShearFactor * b0xcv.x;
b0xcv.z += tokamak_options.ShearFactor * b0xcv.x;
}
}

Expand All @@ -691,7 +691,7 @@ class Elm_6f : public PhysicsModel {
if (not mesh->IncIntShear) {
// Dimits style, using local coordinate system
if (include_curvature) {
b0xcv.z += tokamak_coordinates.ShearFactor * b0xcv.x;
b0xcv.z += tokamak_options.ShearFactor * b0xcv.x;
}
}

Expand Down Expand Up @@ -835,11 +835,11 @@ class Elm_6f : public PhysicsModel {
dump.add(sp_length, "sp_length", 1);
}

auto Bpxy = tokamak_coordinates.Bpxy;
auto hthe = tokamak_coordinates.hthe;
auto Rxy = tokamak_coordinates.Rxy;
auto Btxy = tokamak_coordinates.Btxy;
auto B0 = tokamak_coordinates.Bxy;
auto Bpxy = tokamak_options.Bpxy;
auto hthe = tokamak_options.hthe;
auto Rxy = tokamak_options.Rxy;
auto Btxy = tokamak_options.Btxy;
auto B0 = tokamak_options.Bxy;

J0 = SI::mu0 * Lbar * J0 / B0;
P0 = P0 / (SI::kb * (Tibar + Tebar) * eV_K / 2. * Nbar * density);
Expand Down Expand Up @@ -1034,7 +1034,7 @@ class Elm_6f : public PhysicsModel {
}

/**************** CALCULATE METRICS ******************/
set_tokamak_coordinates_on_mesh(tokamak_coordinates, *mesh, noshear, Lbar, Bbar);
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, noshear, Lbar, Bbar);

//////////////////////////////////////////////////////////////
// SHIFTED RADIAL COORDINATES
Expand Down Expand Up @@ -1224,7 +1224,7 @@ class Elm_6f : public PhysicsModel {
// Field2D lap_temp=0.0;
Field2D logn0 = laplace_alpha * N0;

auto B0 = tokamak_coordinates.Bxy;
auto B0 = tokamak_options.Bxy;

ubyn = U * B0 / N0;
if (diamag) {
Expand Down
12 changes: 6 additions & 6 deletions examples/conducting-wall-mode/cwm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class CWM : public PhysicsModel {
hthe0 / rho_s);
}

auto tokamak_coordinates = TokamakCoordinates(*mesh);
auto tokamak_options = TokamakOptions(*mesh);

/************** NORMALISE QUANTITIES *****************/

Expand All @@ -132,7 +132,7 @@ class CWM : public PhysicsModel {
Te0 /= Te_x;

// Normalise geometry
set_tokamak_coordinates_on_mesh(tokamak_coordinates, *mesh, noshear, rho_s, bmag / 1e4, ShearFactor);
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, noshear, rho_s, bmag / 1e4, ShearFactor);

// Set nu
nu = nu_hat * Ni0 / pow(Te0, 1.5);
Expand All @@ -143,10 +143,10 @@ class CWM : public PhysicsModel {
// add evolving variables to the communication object
SOLVE_FOR(rho, te);

Field2D Rxy = tokamak_coordinates.Rxy;
Field2D Bpxy = tokamak_coordinates.Bpxy;
Field2D Btxy = tokamak_coordinates.Btxy;
Field2D hthe = tokamak_coordinates.hthe;
Field2D Rxy = tokamak_options.Rxy;
Field2D Bpxy = tokamak_options.Bpxy;
Field2D Btxy = tokamak_options.Btxy;
Field2D hthe = tokamak_options.hthe;
SAVE_ONCE(Rxy, Bpxy, Btxy, Zxy, hthe);
SAVE_ONCE(nu_hat, hthe0);

Expand Down
4 changes: 2 additions & 2 deletions examples/constraints/alfven-wave/alfven.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ class Alfven : public PhysicsModel {
noshear = true;
}

auto tokamak_coordinates = TokamakCoordinates(*mesh);
set_tokamak_coordinates_on_mesh(tokamak_coordinates, *mesh, noshear, Lnorm, Bnorm);
auto tokamak_options = TokamakOptions(*mesh);
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, noshear, Lnorm, Bnorm);
}
};

Expand Down
6 changes: 3 additions & 3 deletions examples/dalf3/dalf3.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class DALF3 : public PhysicsModel {
std::unique_ptr<LaplaceXY> laplacexy{nullptr}; // Laplacian solver in X-Y (n=0)
Field2D phi2D; // Axisymmetric potential, used when split_n0=true

TokamakCoordinates tokamak_coordinates = TokamakCoordinates(*mesh);
TokamakOptions tokamak_options = TokamakOptions(*mesh);

protected:
int init(bool UNUSED(restarting)) override {
Expand Down Expand Up @@ -164,7 +164,7 @@ class DALF3 : public PhysicsModel {

if (lowercase(ptstr) == "shifted") {
// Dimits style, using local coordinate system
b0xcv.z += tokamak_coordinates.ShearFactor * b0xcv.x;
b0xcv.z += tokamak_options.ShearFactor * b0xcv.x;
noshear = true;
}

Expand Down Expand Up @@ -224,7 +224,7 @@ class DALF3 : public PhysicsModel {
b0xcv.z *= rho_s * rho_s;

// Metrics
set_tokamak_coordinates_on_mesh(tokamak_coordinates, *mesh, noshear, rho_s, Bnorm);
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, noshear, rho_s, Bnorm);

SOLVE_FOR3(Vort, Pe, Vpar);
comms.add(Vort, Pe, Vpar);
Expand Down
26 changes: 13 additions & 13 deletions examples/elm-pb-outerloop/elm_pb_outerloop.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class ELMpb : public PhysicsModel {
int damp_width; // Width of inner damped region
BoutReal damp_t_const; // Timescale of damping

TokamakCoordinates tokamak_coordinates = TokamakCoordinates(*mesh);
TokamakOptions tokamak_options = TokamakOptions(*mesh);

const BoutReal MU0 = 4.0e-7 * PI;
const BoutReal Mi = 2.0 * 1.6726e-27; // Ion mass
Expand Down Expand Up @@ -717,13 +717,13 @@ class ELMpb : public PhysicsModel {
if (mesh->get(Lbar, "rmag") != 0) { // Typical length scale
Lbar = 1.0;
}
set_tokamak_coordinates_on_mesh(tokamak_coordinates, *mesh, true, Lbar, Bbar);
set_tokamak_coordinates_on_mesh(tokamak_options, *mesh, true, Lbar, Bbar);

auto Bpxy = tokamak_coordinates.Bpxy;
auto hthe = tokamak_coordinates.hthe;
auto Rxy = tokamak_coordinates.Rxy;
auto Btxy = tokamak_coordinates.Btxy;
auto B0 = tokamak_coordinates.Bxy;
auto Bpxy = tokamak_options.Bpxy;
auto hthe = tokamak_options.hthe;
auto Rxy = tokamak_options.Rxy;
auto Btxy = tokamak_options.Btxy;
auto B0 = tokamak_options.Bxy;

V0 = -Rxy * Bpxy * Dphi0 / B0;

Expand Down Expand Up @@ -820,7 +820,7 @@ class ELMpb : public PhysicsModel {

if (noshear) {
if (include_curvature) {
b0xcv.z += tokamak_coordinates.ShearFactor * b0xcv.x;
b0xcv.z += tokamak_options.ShearFactor * b0xcv.x;
}
}

Expand All @@ -830,7 +830,7 @@ class ELMpb : public PhysicsModel {
if (not mesh->IncIntShear) {
// Dimits style, using local coordinate system
if (include_curvature) {
b0xcv.z += tokamak_coordinates.ShearFactor * b0xcv.x;
b0xcv.z += tokamak_options.ShearFactor * b0xcv.x;
}
}

Expand Down Expand Up @@ -1231,7 +1231,7 @@ class ELMpb : public PhysicsModel {

Field3D result = Grad_par(f, loc);

auto B0 = tokamak_coordinates.Bxy;
auto B0 = tokamak_options.Bxy;

if (nonlinear) {
result -= bracket(interp_to(Psi, loc), f, bm_mag) * B0;
Expand All @@ -1252,7 +1252,7 @@ class ELMpb : public PhysicsModel {

Coordinates* metric = mesh->getCoordinates();

auto B0 = tokamak_coordinates.Bxy;
auto B0 = tokamak_options.Bxy;

////////////////////////////////////////////
// Transitions from 0 in core to 1 in vacuum
Expand Down Expand Up @@ -1999,7 +1999,7 @@ class ELMpb : public PhysicsModel {

Field3D U1 = ddt(U);

auto B0 = tokamak_coordinates.Bxy;
auto B0 = tokamak_options.Bxy;

U1 += (gamma * B0 * B0) * Grad_par(Jrhs, CELL_CENTRE) + (gamma * b0xcv) * Grad(P);

Expand Down Expand Up @@ -2053,7 +2053,7 @@ class ELMpb : public PhysicsModel {
JP.setBoundary("P");
JP.applyBoundary();

auto B0 = tokamak_coordinates.Bxy;
auto B0 = tokamak_options.Bxy;

Field3D B0phi = B0 * phi;
mesh->communicate(B0phi);
Expand Down
Loading

0 comments on commit d08ecf9

Please sign in to comment.