fix: Typos in FTCS

In the calculation of alpha intercell values, the concentration of alpha
and its neighboring concentrations were utilized, as opposed to
employing neighboring alpha concentrations.

For evaluating the left/right boundary conditions, there was an error in
indexing - specifically, column indexing was erroneously employed
instead of the intended row indexing.
This commit is contained in:
Max Lübke 2023-11-30 08:58:46 +01:00
parent e2bf3a7662
commit cdfc42ac9c

View File

@ -88,9 +88,9 @@ static inline T calcHorizontalChangeLeftBoundaryClosed(Grid<T> &grid, int &row,
template <class T> template <class T>
static inline T calcHorizontalChangeLeftBoundary(Grid<T> &grid, Boundary<T> &bc, static inline T calcHorizontalChangeLeftBoundary(Grid<T> &grid, Boundary<T> &bc,
int &row, int &col) { int &row, int &col) {
if (bc.getBoundaryElementType(BC_SIDE_LEFT, col) == BC_TYPE_CONSTANT) { if (bc.getBoundaryElementType(BC_SIDE_LEFT, row) == BC_TYPE_CONSTANT) {
return calcHorizontalChangeLeftBoundaryConstant(grid, bc, row, col); return calcHorizontalChangeLeftBoundaryConstant(grid, bc, row, col);
} else if (bc.getBoundaryElementType(BC_SIDE_LEFT, col) == BC_TYPE_CLOSED) { } else if (bc.getBoundaryElementType(BC_SIDE_LEFT, row) == BC_TYPE_CLOSED) {
return calcHorizontalChangeLeftBoundaryClosed(grid, row, col); return calcHorizontalChangeLeftBoundaryClosed(grid, row, col);
} else { } else {
throw_invalid_argument("Undefined Boundary Condition Type!"); throw_invalid_argument("Undefined Boundary Condition Type!");
@ -130,9 +130,9 @@ template <class T>
static inline T calcHorizontalChangeRightBoundary(Grid<T> &grid, static inline T calcHorizontalChangeRightBoundary(Grid<T> &grid,
Boundary<T> &bc, int &row, Boundary<T> &bc, int &row,
int &col) { int &col) {
if (bc.getBoundaryElementType(BC_SIDE_RIGHT, col) == BC_TYPE_CONSTANT) { if (bc.getBoundaryElementType(BC_SIDE_RIGHT, row) == BC_TYPE_CONSTANT) {
return calcHorizontalChangeRightBoundaryConstant(grid, bc, row, col); return calcHorizontalChangeRightBoundaryConstant(grid, bc, row, col);
} else if (bc.getBoundaryElementType(BC_SIDE_RIGHT, col) == BC_TYPE_CLOSED) { } else if (bc.getBoundaryElementType(BC_SIDE_RIGHT, row) == BC_TYPE_CLOSED) {
return calcHorizontalChangeRightBoundaryClosed(grid, row, col); return calcHorizontalChangeRightBoundaryClosed(grid, row, col);
} else { } else {
throw_invalid_argument("Undefined Boundary Condition Type!"); throw_invalid_argument("Undefined Boundary Condition Type!");
@ -162,7 +162,7 @@ static inline T calcVerticalChangeTopBoundaryClosed(Grid<T> &grid, int &row,
int &col) { int &col) {
return calcAlphaIntercell(grid.getAlphaY()(row + 1, col), return calcAlphaIntercell(grid.getAlphaY()(row + 1, col),
grid.getConcentrations()(row, col)) * grid.getAlphaY()(row, col)) *
(grid.getConcentrations()(row + 1, col) - (grid.getConcentrations()(row + 1, col) -
grid.getConcentrations()(row, col)); grid.getConcentrations()(row, col));
} }