-
Notifications
You must be signed in to change notification settings - Fork 3
/
TrackSolution.cpp
59 lines (44 loc) · 1.17 KB
/
TrackSolution.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
#include "ExtendedStateVector.h"
#include "Arnoldi.h"
int main(int argc, char* argv[])
{
flowParams.Ri = std::stod(argv[1]);
flowParams.Pr = std::stod(argv[2]);
StateVector::ResetForParams();
DumpParameters();
StateVector state;
if (argc>3)
{
state.LoadFromFile(argv[3]);
}
if (argc>4)
{
StateVector state2;
state2.LoadFromFile(argv[4]);
stratifloat mult=1;
if (argc>5)
{
mult = std::stod(argv[5]);
}
state = state2 + mult*(state2-state);
}
StateVector perturbation;
perturbation.ExciteLowWavenumbers(0.5);
if (argc == 3)
state += perturbation;
// state.MakeMode2();
stratifloat timestep = 10;
for (int n=0; n<3000; n++)
{
//state.PlotAll(std::to_string(n));
std::cout << "Step " << n << " " << state.Energy() << " " << state.Enstrophy() << std::endl;
state.FullEvolve(timestep, state, false, false);
if(n%10 == 0)
{
state.AddBackground();
state.PlotAll("state");
state.RemoveBackground();
state.SaveToFile("trackingresult");
}
}
}