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) 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 diff --git a/examples/FTCS_2D_proto_example.cpp b/examples/FTCS_2D_proto_example.cpp index 17bfaf8..7171f62 100644 --- a/examples/FTCS_2D_proto_example.cpp +++ b/examples/FTCS_2D_proto_example.cpp @@ -7,17 +7,17 @@ */ #include -#include -#define EASY_PROFILER_ENABLE ::profiler::setEnabled(true); +// #include +// #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 diff --git a/src/FTCS.cpp b/src/FTCS.cpp index 58812a9..bb91844 100644 --- a/src/FTCS.cpp +++ b/src/FTCS.cpp @@ -63,8 +63,13 @@ double calcHorizontalChangeLeftBoundaryConstant(Grid grid, Boundary bc, int row, } -double calcHorizontalChangeLeftBoundaryClosed() { - return 0; +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; } @@ -84,8 +89,13 @@ double calcHorizontalChangeRightBoundaryConstant(Grid grid, Boundary bc, int row } -double calcHorizontalChangeRightBoundaryClosed() { - return 0; +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; } @@ -105,8 +115,13 @@ double calcVerticalChangeTopBoundaryConstant(Grid grid, Boundary bc, int row, in } -double calcVerticalChangeTopBoundaryClosed() { - return 0; +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)); + + return result; } @@ -126,8 +141,13 @@ double calcVerticalChangeBottomBoundaryConstant(Grid grid, Boundary bc, int row, } -double calcVerticalChangeBottomBoundaryClosed() { - return 0; +double calcVerticalChangeBottomBoundaryClosed(Grid grid, int row, int col) { + + double result = + - (calcAlphaIntercell(grid.getAlphaY()(row, col), grid.getAlphaY()(row-1, col)) + * (grid.getConcentrations()(row, col) - grid.getConcentrations()(row-1, col))); + + return result; }