45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#include <Eigen/Eigen>
|
|
#include <tug/Simulation.hpp>
|
|
#include <chrono>
|
|
#include <iostream>
|
|
|
|
using namespace Eigen;
|
|
using namespace tug;
|
|
using namespace std::chrono;
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
// **** GRID ****
|
|
int cells = 45;
|
|
Grid64 grid(cells);
|
|
|
|
MatrixXd concentrations = MatrixXd::Constant(1, cells, 10);
|
|
concentrations(0, 5) = 2000;
|
|
grid.setConcentrations(concentrations);
|
|
|
|
MatrixXd alpha = MatrixXd::Constant(1, cells, 1);
|
|
alpha.block(0, 0, 1, 15) = MatrixXd::Constant(1, 15, 0.5);
|
|
alpha.block(0, 30, 1, 15) = MatrixXd::Constant(1, 15, 1.5);
|
|
grid.setAlpha(alpha);
|
|
|
|
// **** BOUNDARY ****
|
|
Boundary bc = Boundary(grid);
|
|
bc.setBoundarySideClosed(BC_SIDE_LEFT);
|
|
bc.setBoundarySideClosed(BC_SIDE_RIGHT);
|
|
|
|
// **** SIMULATION ****
|
|
Simulation simulation = Simulation(grid, bc);
|
|
simulation.setTimestep(1.23);
|
|
simulation.setIterations(75000);
|
|
simulation.setOutputCSV(CSV_OUTPUT_ON);
|
|
simulation.setOutputConsole(CONSOLE_OUTPUT_OFF);
|
|
|
|
// **** RUN SIMULATION ****
|
|
auto start = high_resolution_clock::now();
|
|
simulation.run();
|
|
auto stop = high_resolution_clock::now();
|
|
|
|
auto duration = duration_cast<nanoseconds>(stop - start);
|
|
std::cout << duration.count() << std::endl;
|
|
}
|