mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-13 09:28:23 +01:00
fix: reverted local profiling_openmp.cpp to commit 1dbee6d8, small updates in index.rst
This commit is contained in:
parent
6363585a00
commit
2d50f32e37
@ -10,8 +10,9 @@ Welcome to the documentation of the TUG project, a simulation program
|
||||
for solving transport equations in one- and two-dimensional uniform
|
||||
grids using cell centered finite differences.
|
||||
|
||||
---------
|
||||
Diffusion
|
||||
-----------
|
||||
---------
|
||||
|
||||
TUG can solve diffusion problems with heterogeneous and anisotropic
|
||||
diffusion coefficients. The partial differential equation expressing
|
||||
|
||||
@ -2,47 +2,60 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <chrono>
|
||||
#include <easy/profiler.h>
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
EASY_MAIN_THREAD;
|
||||
EASY_PROFILER_ENABLE;
|
||||
profiler::startListen();
|
||||
|
||||
int n = 1000;
|
||||
int n[4] = {100, 500, 1000, 2000};
|
||||
int threads[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
int iterations[1] = {5};
|
||||
int repetition = 1;
|
||||
|
||||
Grid grid = Grid(n, n);
|
||||
grid.setDomain(10, 10);
|
||||
ofstream myfile;
|
||||
myfile.open("testLarge.csv");
|
||||
|
||||
MatrixXd concentrations = MatrixXd::Constant(n, n, 0);
|
||||
concentrations(n/2,n/2) = 1;
|
||||
grid.setConcentrations(concentrations);
|
||||
MatrixXd alpha = MatrixXd::Constant(n, n, 0.001);
|
||||
|
||||
Boundary bc = Boundary(grid);
|
||||
|
||||
Simulation sim = Simulation(grid, bc, BTCS_APPROACH);
|
||||
sim.setSolver(THOMAS_ALGORITHM_SOLVER);
|
||||
sim.setNumberThreads(1);
|
||||
|
||||
sim.setTimestep(0.001);
|
||||
sim.setIterations(2);
|
||||
sim.setOutputCSV(CSV_OUTPUT_OFF);
|
||||
|
||||
auto begin = std::chrono::high_resolution_clock::now();
|
||||
for (int i = 0; i < size(n); i++){
|
||||
cout << "Grid size: " << n[i] << " x " << n[i] << endl << endl;
|
||||
myfile << "Grid size: " << n[i] << " x " << n[i] << endl << endl;
|
||||
for(int j = 0; j < size(iterations); j++){
|
||||
cout << "Iterations: " << iterations[j] << endl;
|
||||
myfile << "Iterations: " << iterations[j] << endl;
|
||||
for (int k = 0; k < repetition; k++){
|
||||
cout << "Wiederholung: " << k << endl;
|
||||
Grid grid = Grid(n[i], n[i]);
|
||||
grid.setDomain(1, 1);
|
||||
|
||||
EASY_BLOCK("SIMULATION");
|
||||
sim.run();
|
||||
EASY_END_BLOCK;
|
||||
MatrixXd concentrations = MatrixXd::Constant(n[i], n[i], 0);
|
||||
concentrations(n[i]/2,n[i]/2) = 1;
|
||||
grid.setConcentrations(concentrations);
|
||||
MatrixXd alpha = MatrixXd::Constant(n[i], n[i], 0.5);
|
||||
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
Boundary bc = Boundary(grid);
|
||||
|
||||
auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(end - begin);
|
||||
cout << milliseconds.count() << endl;
|
||||
Simulation sim = Simulation(grid, bc, BTCS_APPROACH);
|
||||
sim.setSolver(THOMAS_ALGORITHM_SOLVER);
|
||||
|
||||
profiler::dumpBlocksToFile("./mytest_profile.prof");
|
||||
profiler::stopListen();
|
||||
if(argc == 2){
|
||||
int numThreads = atoi(argv[1]);
|
||||
sim.setNumberThreads(numThreads);
|
||||
}
|
||||
else{
|
||||
sim.setNumberThreads(1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
sim.setTimestep(0.001);
|
||||
sim.setIterations(iterations[j]);
|
||||
sim.setOutputCSV(CSV_OUTPUT_OFF);
|
||||
|
||||
auto begin = std::chrono::high_resolution_clock::now();
|
||||
sim.run();
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(end - begin);
|
||||
myfile << milliseconds.count() << endl;
|
||||
}
|
||||
}
|
||||
cout << endl;
|
||||
myfile << endl;
|
||||
|
||||
}
|
||||
myfile.close();
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user