55 lines
1.7 KiB
C++
55 lines
1.7 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 rows = 450;
|
|
int cols = 670;
|
|
Grid64 grid(rows, cols);
|
|
|
|
MatrixXd concentrations = MatrixXd::Constant(rows, cols, 0);
|
|
concentrations(10, 10) = 1500;
|
|
concentrations(440, 660) = 750;
|
|
concentrations(440, 10) = 750;
|
|
concentrations(10, 660) = 750;
|
|
concentrations(220, 335) = 1500;
|
|
grid.setConcentrations(concentrations);
|
|
|
|
MatrixXd alphax = MatrixXd::Constant(rows, cols, 1);
|
|
MatrixXd alphay = MatrixXd::Constant(rows, cols, 1);
|
|
alphax.block(0, 0, 100, cols) = MatrixXd::Constant(100, cols, 0.5);
|
|
alphax.block(100, 0, 100, cols) = MatrixXd::Constant(100, cols, 0.8);
|
|
alphay.block(0, 0, rows, 200) = MatrixXd::Constant(rows, 200, 0.6);
|
|
alphay.block(0, 200, rows, 200) = MatrixXd::Constant(rows, 200, 0.9);
|
|
grid.setAlpha(alphax, alphay);
|
|
|
|
// **** BOUNDARY ****
|
|
Boundary bc = Boundary(grid);
|
|
bc.setBoundarySideClosed(BC_SIDE_LEFT);
|
|
bc.setBoundarySideClosed(BC_SIDE_RIGHT);
|
|
bc.setBoundarySideClosed(BC_SIDE_TOP);
|
|
bc.setBoundarySideClosed(BC_SIDE_BOTTOM);
|
|
|
|
// **** SIMULATION ****
|
|
Simulation simulation = Simulation(grid, bc);
|
|
simulation.setTimestep(0.2);
|
|
simulation.setIterations(750);
|
|
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;
|
|
}
|