Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/invert/laplace/impls/petsc/petsc_laplace.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ FieldPerp LaplacePetsc::solve(const FieldPerp& b, const FieldPerp& x0) {
}
if (!isOuterBoundaryFlagSet(INVERT_RHS)) {
BOUT_FOR_SERIAL(index, indexer->getRegionOuterX()) {
rhs(index) = isInnerBoundaryFlagSet(INVERT_SET) ? x0[index] : 0.0;
rhs(index) = isOuterBoundaryFlagSet(INVERT_SET) ? x0[index] : 0.0;
}
}

Expand Down Expand Up @@ -488,10 +488,10 @@ void LaplacePetsc::setSecondOrderMatrix(int y, bool inner_X_neumann,
// Set the boundaries
if (inner_X_neumann) {
const auto dx = sliceXZ(coords->dx, y);
const auto g11 = sliceXZ(coords->g11, y);
const auto g_11 = sliceXZ(coords->g_11, y);

BOUT_FOR_SERIAL(i, indexer->getRegionInnerX()) {
const auto factor = 1. / dx[i] / std::sqrt(g11[i]);
const auto factor = 1. / dx[i] / std::sqrt(g_11[i]);
operator2D(i, i) = -factor;
operator2D(i, i.xp()) = factor;
}
Expand All @@ -503,10 +503,10 @@ void LaplacePetsc::setSecondOrderMatrix(int y, bool inner_X_neumann,
}
if (outer_X_neumann) {
const auto dx = sliceXZ(coords->dx, y);
const auto g11 = sliceXZ(coords->g11, y);
const auto g_11 = sliceXZ(coords->g_11, y);

BOUT_FOR_SERIAL(i, indexer->getRegionOuterX()) {
const auto factor = 1. / dx[i] / std::sqrt(g11[i]);
const auto factor = 1. / dx[i] / std::sqrt(g_11[i]);
operator2D(i, i) = factor;
operator2D(i, i.xm()) = -factor;
}
Expand Down Expand Up @@ -558,10 +558,10 @@ void LaplacePetsc::setFourthOrderMatrix(int y, bool inner_X_neumann,
// Set boundaries
if (inner_X_neumann) {
const auto dx = sliceXZ(coords->dx, y);
const auto g11 = sliceXZ(coords->g11, y);
const auto g_11 = sliceXZ(coords->g_11, y);

BOUT_FOR_SERIAL(i, indexer->getRegionInnerX()) {
const auto factor = 1. / dx[i] / std::sqrt(g11[i]);
const auto factor = 1. / dx[i] / std::sqrt(g_11[i]);
operator2D(i, i) = (-25.0 / 12.0) * factor;
operator2D(i, i.xp(1)) = 4.0 * factor;
operator2D(i, i.xp(2)) = -3.0 * factor;
Expand All @@ -580,10 +580,10 @@ void LaplacePetsc::setFourthOrderMatrix(int y, bool inner_X_neumann,

if (outer_X_neumann) {
const auto dx = sliceXZ(coords->dx, y);
const auto g11 = sliceXZ(coords->g11, y);
const auto g_11 = sliceXZ(coords->g_11, y);

BOUT_FOR_SERIAL(i, indexer->getRegionOuterX()) {
const auto factor = 1. / dx[i] / std::sqrt(g11[i]);
const auto factor = 1. / dx[i] / std::sqrt(g_11[i]);
operator2D(i, i) = (25.0 / 12.0) * factor;
operator2D(i, i.xm(1)) = -4.0 * factor;
operator2D(i, i.xm(2)) = 3.0 * factor;
Expand Down
Loading