mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-13 09:28:23 +01:00
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:
commit
4e8933862e
@ -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)
|
||||
|
||||
@ -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)
|
||||
# target_link_libraries(FTCS_2D_proto_example easy_profiler)
|
||||
@ -7,17 +7,17 @@
|
||||
*/
|
||||
|
||||
#include <tug/Simulation.hpp>
|
||||
#include <easy/profiler.h>
|
||||
#define EASY_PROFILER_ENABLE ::profiler::setEnabled(true);
|
||||
// #include <easy/profiler.h>
|
||||
// #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();
|
||||
}
|
||||
36
src/FTCS.cpp
36
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user