mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-13 17:38:23 +01:00
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#include <tug/Simulation.hpp>
|
|
#include "csv2eigen.hpp"
|
|
#include "Eigen/Core"
|
|
|
|
int main(int argc, char *argv[]) {
|
|
int row = 11;
|
|
int col = 11;
|
|
int domain_row = 10;
|
|
int domain_col = 10;
|
|
|
|
|
|
// Grid
|
|
Grid grid = Grid(row, col);
|
|
grid.setDomain(domain_row, domain_col);
|
|
|
|
MatrixXd concentrations = MatrixXd::Constant(row, col, 0);
|
|
concentrations(5,5) = 1;
|
|
grid.setConcentrations(concentrations);
|
|
|
|
MatrixXd alpha = MatrixXd::Constant(row, col, 1);
|
|
for (int i = 0; i < 5; i++) {
|
|
for (int j = 0; j < 6; j++) {
|
|
alpha(i, j) = 0.01;
|
|
}
|
|
}
|
|
for (int i = 0; i < 5; i++) {
|
|
for (int j = 6; j < 11; j++) {
|
|
alpha(i, j) = 0.001;
|
|
}
|
|
}
|
|
for (int i = 5; i < 11; i++) {
|
|
for (int j = 6; j < 11; j++) {
|
|
alpha(i, j) = 0.1;
|
|
}
|
|
}
|
|
grid.setAlpha(alpha, alpha);
|
|
|
|
|
|
// Boundary
|
|
Boundary bc = Boundary(grid);
|
|
|
|
|
|
// Simulation
|
|
Simulation sim = Simulation(grid, bc, FTCS_APPROACH);
|
|
//sim.setTimestep(0.001);
|
|
sim.setIterations(2);
|
|
sim.setOutputCSV(CSV_OUTPUT_ON);
|
|
|
|
MatrixXd mymatrix = CSV2Eigen("/Users/hannessigner/Documents/tug/build/examples/FTCS_11_11_2-1.csv");
|
|
|
|
cout << "Matrix start:" << endl;
|
|
cout << mymatrix << endl;
|
|
|
|
//bool r = grid.isApprox(mymatrix);
|
|
|
|
// RUN
|
|
sim.run();
|
|
} |