From 049fc319db9386f77884bd5a748e136b9786a870 Mon Sep 17 00:00:00 2001 From: Hannes Signer Date: Wed, 26 Jul 2023 22:17:37 +0200 Subject: [PATCH] feat: add boundary conditons for closed cases in independent functions --- src/FTCS.cpp | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/FTCS.cpp b/src/FTCS.cpp index 58812a9..04194d0 100644 --- a/src/FTCS.cpp +++ b/src/FTCS.cpp @@ -62,9 +62,14 @@ double calcHorizontalChangeLeftBoundaryConstant(Grid grid, Boundary bc, int row, return result; } - -double calcHorizontalChangeLeftBoundaryClosed() { - return 0; +// TODO: REVIEW +double calcHorizontalChangeLeftBoundaryClosed(Grid grid, int row, int col) { + + double result = + calcAlphaIntercell(grid.getAlphaX()(row, col+1), grid.getAlphaX()(row, col)) + * (grid.getConcentrations()(row, col+1) - grid.getConcentrations()(row, col)); + + return result; } @@ -83,9 +88,14 @@ double calcHorizontalChangeRightBoundaryConstant(Grid grid, Boundary bc, int row return result; } - -double calcHorizontalChangeRightBoundaryClosed() { - return 0; +// TODO: REVIEW +double calcHorizontalChangeRightBoundaryClosed(Grid grid, int row, int col) { + + double result = + - (calcAlphaIntercell(grid.getAlphaX()(row, col-1), grid.getAlphaX()(row, col)) + * (grid.getConcentrations()(row, col) - grid.getConcentrations()(row, col-1))); + + return result; } @@ -104,9 +114,14 @@ double calcVerticalChangeTopBoundaryConstant(Grid grid, Boundary bc, int row, in return result; } +// TODO: REVIEW +double calcVerticalChangeTopBoundaryClosed(Grid grid, int row, int col) { + + double result = + calcAlphaIntercell(grid.getAlphaY()(row+1, col), grid.getConcentrations()(row, col)) + * (grid.getConcentrations()(row+1, col) - grid.getConcentrations()(row, col)); -double calcVerticalChangeTopBoundaryClosed() { - return 0; + return result; } @@ -125,9 +140,14 @@ double calcVerticalChangeBottomBoundaryConstant(Grid grid, Boundary bc, int row, return result; } +// TODO: REVIEW +double calcVerticalChangeBottomBoundaryClosed(Grid grid, int row, int col) { -double calcVerticalChangeBottomBoundaryClosed() { - return 0; + double result = + - (calcAlphaIntercell(grid.getAlphaY()(row, col), grid.getAlphaY()(row-1, col)) + * (grid.getConcentrations()(row, col) - grid.getConcentrations()(row-1, col))); + + return result; }