Skip to content

Commit

Permalink
Add setter for J that takes [x, y] indices. Update test_snb.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchapman committed Nov 22, 2023
1 parent 3e52360 commit 394c8ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/bout/coordinates.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions src/mesh/coordinates.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/integrated/test-snb/test_snb.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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;
Expand Down

0 comments on commit 394c8ba

Please sign in to comment.