diff --git a/include/bout/coordinates.hxx b/include/bout/coordinates.hxx index b6d100c48a..b586d524ec 100644 --- a/include/bout/coordinates.hxx +++ b/include/bout/coordinates.hxx @@ -120,6 +120,7 @@ public: const std::string& region = "RGN_ALL"); void setJ(FieldMetric J); + void setJ(BoutReal value, int x, int y); void setBxy(FieldMetric Bxy); diff --git a/src/mesh/coordinates.cxx b/src/mesh/coordinates.cxx index f1780b46e9..cc8f137159 100644 --- a/src/mesh/coordinates.cxx +++ b/src/mesh/coordinates.cxx @@ -1885,6 +1885,11 @@ void Coordinates::setJ(FieldMetric J) { this_J = J; } +void Coordinates::setJ(BoutReal value, int x, int y) { + //TODO: Calculate Bxy and check value is close + this_J(x, y) = value; +} + void Coordinates::setBxy(FieldMetric Bxy) { //TODO: Calculate Bxy and check value is close this_Bxy = Bxy; diff --git a/tests/integrated/test-snb/test_snb.cxx b/tests/integrated/test-snb/test_snb.cxx index 1b96bfc8b1..f16f678170 100644 --- a/tests/integrated/test-snb/test_snb.cxx +++ b/tests/integrated/test-snb/test_snb.cxx @@ -212,7 +212,7 @@ int main(int argc, char** argv) { double yn = (double(y) + 0.5) / double(mesh->yend + 1); coord->dy(x, y) = 1. - 0.9 * yn; - coord->J(x, y) = (1. + yn * yn); + coord->setJ((1. + yn * yn), x, y); } } @@ -229,7 +229,7 @@ int main(int argc, char** argv) { EXPECT_FALSE(IsFieldClose(Div_q, Div_q_SH, "RGN_NOBNDRY")); const Field2D dy = coord->dy; - const Field2D J = coord->J; + const Field2D J = coord->J(); // Integrate Div(q) over domain BoutReal q_sh = 0.0;