Merge branch 'boundaries-closed-case' into 'dynamic-boundary-conditions-functionality'

feat: add boundary conditons for closed cases in independent functions

See merge request naaice/tug!5
This commit is contained in:
Philipp Ungrund 2023-07-28 11:05:28 +02:00
commit 4e8933862e
4 changed files with 39 additions and 19 deletions

View File

@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD 17)
find_package(Eigen3 REQUIRED NO_MODULE) find_package(Eigen3 REQUIRED NO_MODULE)
find_package(OpenMP) find_package(OpenMP)
find_package(easy_profiler REQUIRED) find_package(easy_profiler)
## SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfma") ## SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfma")
option(TUG_USE_OPENMP "Compile with OpenMP support" ON) option(TUG_USE_OPENMP "Compile with OpenMP support" ON)

View File

@ -9,4 +9,4 @@ target_link_libraries(second_example tug)
target_link_libraries(boundary_example1D tug) target_link_libraries(boundary_example1D tug)
target_link_libraries(FTCS_2D_proto_example tug) target_link_libraries(FTCS_2D_proto_example tug)
target_link_libraries(FTCS_1D_proto_example tug) target_link_libraries(FTCS_1D_proto_example tug)
target_link_libraries(FTCS_2D_proto_example easy_profiler) # target_link_libraries(FTCS_2D_proto_example easy_profiler)

View File

@ -7,17 +7,17 @@
*/ */
#include <tug/Simulation.hpp> #include <tug/Simulation.hpp>
#include <easy/profiler.h> // #include <easy/profiler.h>
#define EASY_PROFILER_ENABLE ::profiler::setEnabled(true); // #define EASY_PROFILER_ENABLE ::profiler::setEnabled(true);
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
EASY_PROFILER_ENABLE; // EASY_PROFILER_ENABLE;
profiler::startListen(); // profiler::startListen();
// ************** // **************
// **** GRID **** // **** GRID ****
// ************** // **************
profiler::startListen(); // profiler::startListen();
// create a grid with a 20 x 20 field // create a grid with a 20 x 20 field
int row = 20; int row = 20;
int col = 20; int col = 20;
@ -77,9 +77,9 @@ int main(int argc, char *argv[]) {
// run the simulation // run the simulation
EASY_BLOCK("SIMULATION") // EASY_BLOCK("SIMULATION")
simulation.run(); simulation.run();
EASY_END_BLOCK; // EASY_END_BLOCK;
profiler::dumpBlocksToFile("test_profile.prof"); // profiler::dumpBlocksToFile("test_profile.prof");
profiler::stopListen(); // profiler::stopListen();
} }

View File

@ -63,8 +63,13 @@ double calcHorizontalChangeLeftBoundaryConstant(Grid grid, Boundary bc, int row,
} }
double calcHorizontalChangeLeftBoundaryClosed() { double calcHorizontalChangeLeftBoundaryClosed(Grid grid, int row, int col) {
return 0;
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() { double calcHorizontalChangeRightBoundaryClosed(Grid grid, int row, int col) {
return 0;
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() { double calcVerticalChangeTopBoundaryClosed(Grid grid, int row, int col) {
return 0;
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() { double calcVerticalChangeBottomBoundaryClosed(Grid grid, int row, int col) {
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;
} }