-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
79 lines (64 loc) · 2.39 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <cstddef>
#include <exception>
#include <fstream>
#include <iostream>
#include "simulation.hpp"
#include "slopeLimiter.hpp"
#include "euler2Dtests.hpp"
#include "levelSet.hpp"
void runSimulation(fvm::Simulation& sim, std::ofstream& output) {
output << sim << "\n\n";
// Change variables to conserved for solving.
for (double t = sim.tStart(); t < sim.tEnd(); t = sim.tNow()) {
sim.step();
output << sim << "\n\n";
}
output << sim;
}
int main(void) {
try {
fvm::Simulation sodsX(100, 0, 1, 0, 0.25, 0.9, 1.4,
&test1DensityX, &test1VelocityX, &constantVY,
&test1PressureX, fvm::FluxScheme::hllc,
fvm::SlopeLimiter::superbee);
fvm::Simulation sodsY(100, 0, 1, 0, 0.25, 0.9, 1.4,
&test1DensityY, &constantVX, &test1VelocityY,
&test1PressureY, fvm::FluxScheme::hllc,
fvm::SlopeLimiter::superbee);
fvm::Simulation cylExplosion(100, -1, 1, 0, 0.25, 0.9, 1.4,
&cylExplDensity, &cylExplVelocityX, &cylExplVelocityY,
&cylExplPressure, fvm::FluxScheme::hllc,
fvm::SlopeLimiter::superbee);
fvm::Simulation singleCircle(100, 0, 1, 0, 0.4, 0.9, 1.4,
&rigidTestDensity, &rigidTestVelocityX, &rigidTestVelocityY,
&rigidTestPressure, fvm::FluxScheme::hllc,
fvm::SlopeLimiter::superbee, &circleLS);
fvm::Simulation sepCircles(100, 0, 1, 0, 0.4, 0.9, 1.4,
&rigidTestDensity, &rigidTestVelocityX, &rigidTestVelocityY,
&rigidTestPressure, fvm::FluxScheme::hllc,
fvm::SlopeLimiter::superbee, &separateCirclesLS);
fvm::Simulation overlapCircles(100, 0, 1, 0, 0.4, 0.9, 1.4,
&rigidTestDensity, &rigidTestVelocityX, &rigidTestVelocityY,
&rigidTestPressure, fvm::FluxScheme::hllc,
fvm::SlopeLimiter::superbee, &overlapCirclesLS);
std::ofstream sodsXOut("test1X.dat");
std::ofstream sodsYOut("test1Y.dat");
std::ofstream cylOut("cylExpl.dat");
std::ofstream circleOut("single.dat");
std::ofstream sepOut("separate.dat");
std::ofstream overlapOut("overlap.dat");
if (!sodsXOut || !sodsYOut || !cylOut) {
std::cerr << "Error: could not create output file.\n";
return 1;
}
runSimulation(sodsX, sodsXOut);
runSimulation(sodsY, sodsYOut);
runSimulation(cylExplosion, cylOut);
runSimulation(singleCircle, circleOut);
runSimulation(sepCircles, sepOut);
runSimulation(overlapCircles, overlapOut);
} catch (std::exception const& ex) { //std::exception const& ex){
std::cerr << "Error: " << ex.what() << "\n";
}
return 0;
}