From 049fc319db9386f77884bd5a748e136b9786a870 Mon Sep 17 00:00:00 2001 From: Hannes Signer Date: Wed, 26 Jul 2023 22:17:37 +0200 Subject: [PATCH 1/6] 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; } From 8f48830bdab673cf86d9178ac805f135d7ab0531 Mon Sep 17 00:00:00 2001 From: philippun Date: Fri, 28 Jul 2023 10:46:05 +0200 Subject: [PATCH 2/6] reviewed closed case functions --- src/FTCS.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FTCS.cpp b/src/FTCS.cpp index 04194d0..bb91844 100644 --- a/src/FTCS.cpp +++ b/src/FTCS.cpp @@ -62,7 +62,7 @@ double calcHorizontalChangeLeftBoundaryConstant(Grid grid, Boundary bc, int row, return result; } -// TODO: REVIEW + double calcHorizontalChangeLeftBoundaryClosed(Grid grid, int row, int col) { double result = @@ -88,7 +88,7 @@ double calcHorizontalChangeRightBoundaryConstant(Grid grid, Boundary bc, int row return result; } -// TODO: REVIEW + double calcHorizontalChangeRightBoundaryClosed(Grid grid, int row, int col) { double result = @@ -114,7 +114,7 @@ double calcVerticalChangeTopBoundaryConstant(Grid grid, Boundary bc, int row, in return result; } -// TODO: REVIEW + double calcVerticalChangeTopBoundaryClosed(Grid grid, int row, int col) { double result = @@ -140,7 +140,7 @@ double calcVerticalChangeBottomBoundaryConstant(Grid grid, Boundary bc, int row, return result; } -// TODO: REVIEW + double calcVerticalChangeBottomBoundaryClosed(Grid grid, int row, int col) { double result = From 3364042af714e7fe8df41a43988083bfa80f5ad7 Mon Sep 17 00:00:00 2001 From: philippun Date: Fri, 28 Jul 2023 10:55:28 +0200 Subject: [PATCH 3/6] unset easyprofiler as required --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a980a35..9cd2625 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD 17) find_package(Eigen3 REQUIRED NO_MODULE) find_package(OpenMP) -find_package(easy_profiler REQUIRED) +find_package(easy_profiler) ## SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfma") option(TUG_USE_OPENMP "Compile with OpenMP support" ON) From c9b714b241f8b435f8207fe0f79d7e51a2377181 Mon Sep 17 00:00:00 2001 From: philippun Date: Fri, 28 Jul 2023 10:59:08 +0200 Subject: [PATCH 4/6] commented out easy profiler --- examples/FTCS_2D_proto_example.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/FTCS_2D_proto_example.cpp b/examples/FTCS_2D_proto_example.cpp index 27dd892..99502cc 100644 --- a/examples/FTCS_2D_proto_example.cpp +++ b/examples/FTCS_2D_proto_example.cpp @@ -8,16 +8,16 @@ #include #include -#define EASY_PROFILER_ENABLE ::profiler::setEnabled(true); +// #define EASY_PROFILER_ENABLE ::profiler::setEnabled(true); int main(int argc, char *argv[]) { - EASY_PROFILER_ENABLE; - profiler::startListen(); + // EASY_PROFILER_ENABLE; + // profiler::startListen(); // ************** // **** GRID **** // ************** - profiler::startListen(); + // profiler::startListen(); // create a grid with a 20 x 20 field int row = 20; int col = 20; @@ -77,9 +77,9 @@ int main(int argc, char *argv[]) { // run the simulation - EASY_BLOCK("SIMULATION") + // EASY_BLOCK("SIMULATION") simulation.run(); - EASY_END_BLOCK; - profiler::dumpBlocksToFile("test_profile.prof"); - profiler::stopListen(); + // EASY_END_BLOCK; + // profiler::dumpBlocksToFile("test_profile.prof"); + // profiler::stopListen(); } \ No newline at end of file From 605000de5e1dfc15ec27e6b5171038839acdc957 Mon Sep 17 00:00:00 2001 From: philippun Date: Fri, 28 Jul 2023 11:00:21 +0200 Subject: [PATCH 5/6] commented out another easy profiler include --- examples/FTCS_2D_proto_example.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/FTCS_2D_proto_example.cpp b/examples/FTCS_2D_proto_example.cpp index 99502cc..ac27d25 100644 --- a/examples/FTCS_2D_proto_example.cpp +++ b/examples/FTCS_2D_proto_example.cpp @@ -7,7 +7,7 @@ */ #include -#include +// #include // #define EASY_PROFILER_ENABLE ::profiler::setEnabled(true); From 16d3663909f7141eb6997725612f583e7abd04dd Mon Sep 17 00:00:00 2001 From: philippun Date: Fri, 28 Jul 2023 11:02:56 +0200 Subject: [PATCH 6/6] commented out the probably last easy profiler reference --- examples/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 47042c2..b7c0d71 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -9,4 +9,4 @@ target_link_libraries(second_example tug) target_link_libraries(boundary_example1D tug) target_link_libraries(FTCS_2D_proto_example tug) target_link_libraries(FTCS_1D_proto_example tug) -target_link_libraries(FTCS_2D_proto_example easy_profiler) \ No newline at end of file +# target_link_libraries(FTCS_2D_proto_example easy_profiler) \ No newline at end of file