From cdfc42ac9c43e36c21f3c36113beede79630740a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20L=C3=BCbke?= Date: Thu, 30 Nov 2023 08:58:46 +0100 Subject: [PATCH] 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. --- include/tug/Core/FTCS.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/tug/Core/FTCS.hpp b/include/tug/Core/FTCS.hpp index 7f12780..76d8d1b 100644 --- a/include/tug/Core/FTCS.hpp +++ b/include/tug/Core/FTCS.hpp @@ -88,9 +88,9 @@ static inline T calcHorizontalChangeLeftBoundaryClosed(Grid &grid, int &row, template static inline T calcHorizontalChangeLeftBoundary(Grid &grid, Boundary &bc, 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); - } 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); } else { throw_invalid_argument("Undefined Boundary Condition Type!"); @@ -130,9 +130,9 @@ template static inline T calcHorizontalChangeRightBoundary(Grid &grid, Boundary &bc, int &row, 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); - } 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); } else { throw_invalid_argument("Undefined Boundary Condition Type!"); @@ -162,7 +162,7 @@ static inline T calcVerticalChangeTopBoundaryClosed(Grid &grid, int &row, int &col) { return calcAlphaIntercell(grid.getAlphaY()(row + 1, col), - grid.getConcentrations()(row, col)) * + grid.getAlphaY()(row, col)) * (grid.getConcentrations()(row + 1, col) - grid.getConcentrations()(row, col)); }