Skip to content

Commit

Permalink
Remove call to calculateGeometry() in tests and examples since no lon…
Browse files Browse the repository at this point in the history
…ger need to call it now that metric tensor quantities are updated by Coordinates::recalculateAndReset when calling setContravariantMetricTensor() and setCovariantMetricTensor().
  • Loading branch information
tomchapman committed Dec 5, 2023
1 parent 4af8002 commit 1412aaa
Show file tree
Hide file tree
Showing 21 changed files with 7 additions and 49 deletions.
2 changes: 0 additions & 2 deletions examples/2Dturbulence_multigrid/esel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ class ESEL : public PhysicsModel {
g_23 = 0.0;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();

SOLVE_FOR(N, vort);
SAVE_REPEAT(phi);
if (test_laplacian) {
Expand Down
2 changes: 0 additions & 2 deletions examples/6field-simple/elm_6f.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1072,8 +1072,6 @@ class Elm_6f : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry(); // Calculate quantities from metric tensor

// Set B field vector

B0vec.covariant = false;
Expand Down
2 changes: 0 additions & 2 deletions examples/conducting-wall-mode/cwm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ class CWM : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();

/**************** SET EVOLVING VARIABLES *************/

// Tell BOUT++ which variables to evolve
Expand Down
2 changes: 0 additions & 2 deletions examples/constraints/alfven-wave/alfven.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ class Alfven : public PhysicsModel {
g_13 = sinty * Rxy * Rxy;
g_23 = sbp * Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();
}
};

Expand Down
2 changes: 0 additions & 2 deletions examples/dalf3/dalf3.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,6 @@ class DALF3 : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry(); // Calculate quantities from metric tensor

SOLVE_FOR3(Vort, Pe, Vpar);
comms.add(Vort, Pe, Vpar);
if (!(estatic && ZeroElMass)) {
Expand Down
12 changes: 5 additions & 7 deletions examples/elm-pb-outerloop/elm_pb_outerloop.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1109,8 +1109,6 @@ class ELMpb : public PhysicsModel {
metric->g_13 = I * Rxy * Rxy;
metric->g_23 = Btxy * hthe * Rxy / Bpxy;

metric->calculateGeometry(); // Calculate quantities from metric tensor

// Set B field vector

B0vec.covariant = false;
Expand Down Expand Up @@ -1669,12 +1667,12 @@ class ELMpb : public PhysicsModel {
#endif
};

// Terms which are not yet single index operators
// Note: Terms which are included in the single index loop
// may be commented out here, to allow comparison/testing
// Terms which are not yet single index operators
// Note: Terms which are included in the single index loop
// may be commented out here, to allow comparison/testing

////////////////////////////////////////////////////
// Parallel electric field
////////////////////////////////////////////////////
// Parallel electric field

#if not EVOLVE_JPAR
// Vector potential
Expand Down
2 changes: 0 additions & 2 deletions examples/elm-pb/elm_pb.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1049,8 +1049,6 @@ class ELMpb : public PhysicsModel {
metric->g_13 = I * Rxy * Rxy;
metric->g_23 = Btxy * hthe * Rxy / Bpxy;

metric->calculateGeometry(); // Calculate quantities from metric tensor

// Set B field vector

B0vec.covariant = false;
Expand Down
2 changes: 0 additions & 2 deletions examples/gyro-gem/gem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,6 @@ class GEM : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();

// Set B field vector

B0vec.covariant = false;
Expand Down
2 changes: 0 additions & 2 deletions examples/jorek-compare/jorek_compare.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,6 @@ class Jorek : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry(); // Calculate quantities from metric tensor

// Set B field vector
B0vec.covariant = false;
B0vec.x = 0.;
Expand Down
2 changes: 0 additions & 2 deletions examples/lapd-drift/lapd_drift.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,6 @@ class LAPDdrift : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();

rho0 = Ni0 * Delp2(phi0) + Perp_Grad_dot_Grad(phi0, Ni0);

/**************** SET EVOLVING VARIABLES *************/
Expand Down
4 changes: 1 addition & 3 deletions examples/laplacexy/alfven-wave/alfven.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Alfven : public PhysicsModel {
if (min(Bpxy, true) < 0.0) {
sbp = -1.0;
}

MetricTensor::FieldMetric g11, g22, g33, g12, g13, g23;
g11 = SQ(Rxy * Bpxy);
g22 = 1.0 / SQ(hthe);
Expand All @@ -221,8 +221,6 @@ class Alfven : public PhysicsModel {
g_13 = sinty * Rxy * Rxy;
g_23 = sbp * Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();
}
};

Expand Down
2 changes: 0 additions & 2 deletions examples/laplacexy/laplace_perp/test.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ int main(int argc, char** argv) {
g_13 = I * Rxy * Rxy;
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();
}
///////////////////////////////////////

Expand Down
2 changes: 0 additions & 2 deletions examples/reconnect-2field/2field.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ class TwoField : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();

// Tell BOUT++ which variables to evolve
SOLVE_FOR(U, Apar);

Expand Down
2 changes: 0 additions & 2 deletions examples/shear-alfven-wave/2fluid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ class ShearAlfven : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();

/**************** SET EVOLVING VARIABLES *************/

// Tell BOUT++ which variables to evolve
Expand Down
2 changes: 0 additions & 2 deletions examples/uedge-benchmark/ue_bmark.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ class UedgeBenchmark : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coords->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coords->calculateGeometry(); // Calculate other metrics

//////////////// BOUNDARIES ///////////////////////
//
// We want to apply the relaxing boundries to total density,
Expand Down
2 changes: 0 additions & 2 deletions examples/wave-slab/wave_slab.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ class WaveTest : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coords->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coords->calculateGeometry();

solver->add(f, "f");
solver->add(g, "g");

Expand Down
5 changes: 1 addition & 4 deletions tests/MMS/diffusion/diffusion.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,12 @@ int Diffusion::init(bool UNUSED(restarting)) {
SAVE_ONCE(mu_N);

//set mesh
auto contravariant_metric_tensor =
MetricTensor(1.1, 1.1, 1.1, 0.0, 0.0, 0.0);
auto contravariant_metric_tensor = MetricTensor(1.1, 1.1, 1.1, 0.0, 0.0, 0.0);
coord->setContravariantMetricTensor(contravariant_metric_tensor);

auto covariant_metric_tensor = MetricTensor(1.1, 1.1, 1.1, 0.0, 0.0, 0.0);
coord->setCovariantMetricTensor(covariant_metric_tensor);

coord->calculateGeometry();

// Tell BOUT++ to solve N
SOLVE_FOR(N);

Expand Down
2 changes: 0 additions & 2 deletions tests/MMS/wave-1d/wave.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class Wave1D : public PhysicsModel {
auto covariant_metric_tensor = MetricTensor(1.1, 1.1, 1.1, 0.0, 0.0, 0.0);
coord->setCovariantMetricTensor(covariant_metric_tensor);

coord->calculateGeometry();

g.setLocation(CELL_XLOW); // g staggered to the left of f

// Tell BOUT++ to solve f and g
Expand Down
2 changes: 0 additions & 2 deletions tests/integrated/test-drift-instability/2fluid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ class TwoFluid : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();

/**************** SET EVOLVING VARIABLES *************/

// Tell BOUT++ which variables to evolve
Expand Down
2 changes: 0 additions & 2 deletions tests/integrated/test-interchange-instability/2fluid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ class Interchange : public PhysicsModel {
g_23 = Btxy * hthe * Rxy / Bpxy;
coord->setCovariantMetricTensor(MetricTensor(g_11, g_22, g_33, g_12, g_13, g_23));

coord->calculateGeometry();

// Tell BOUT++ which variables to evolve
SOLVE_FOR2(rho, Ni);

Expand Down
1 change: 0 additions & 1 deletion tests/unit/invert/laplace/test_laplace_cyclic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class CyclicTest : public FakeMeshFixture,

static_cast<FakeMesh*>(bout::globals::mesh)
->setGridDataSource(new GridFromOptions(Options::getRoot()));
bout::globals::mesh->getCoordinates()->calculateGeometry();
f3.allocate();
coef2.allocate();
coef3.allocate();
Expand Down

0 comments on commit 1412aaa

Please sign in to comment.