VM2D 1.14
Vortex methods for 2D flows simulation
Loading...
Searching...
No Matches
gammaCirc.h
Go to the documentation of this file.
1// Вычисление количества завихренности, находящейся в круге заданного (довольно большого радиуса)
2//
3// Следует сделать #include "gammaCirc.h" в src/VM2D/World2D/World2D.cpp
4// в функции Step() после строки, в которой вызывается CalcVortexVelo()
5//
6// Ниже числа в строке #define radiuses будут определять, по окружностям
7// каких радиусов измеряется циркуляция поля скоростей
8//
9// Результат сохраняется в файл circ в рабочий каталог задачи
10
11//#define radiuses { 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,
12// 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0,
13// 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0,
14// 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0 }
15//#define radiuses { 0.5, 1.0, 1.5, 2.0, 2.5 }
16#define radiuses { 4.0, 4.5, 5.0, 5.5, 6.0 }
17
18
19//#define scales {0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5}
20#define scales { 1.0 }
21
22
23if (currentStep % 1 == 0)
24{
25
26 std::vector<double> rad = radiuses;
27 std::vector<double> scale = scales;
28
29
30 std::string circFileName = getPassport().dir + "circ";
31
32
33 if (currentStep == 0)
34 {
35 std::ofstream circFile(circFileName.c_str());
36
37 VMlib::PrintLogoToTextFile(circFile, circFileName, "Circulations along the circles of fixed radius");
38
39 std::stringstream ssCirc;
40 ssCirc << "step time scale";
41 for (auto r : rad)
42 ssCirc << " R=" << r;
43
44 VMlib::PrintHeaderToTextFile(circFile, ssCirc.str());
45
46 circFile << std::endl;
47 circFile.close();
48 circFile.clear();
49 }
50
51 for (int c = 0; c < scale.size(); ++c)
52 {
53 std::vector<double> circRad(rad.size(), 0.0);
54
55 int nPts = 50; //50
56
57 double delta = 6.0; //6.0
58
59 double R = 0.0;
60 double L = 0.0;
61 double epsAst = 0.0;
62 double gam = 0.0;
63 double curCirc = 0.0;
64
65 for (size_t i = 0; i < rad.size(); ++i)
66 {
67 R = rad[i];
68 curCirc = 0.0;
69
70#pragma omp parallel for default(none) private(L,gam,epsAst) shared(R,nPts,delta,c,scale) reduction(+:curCirc) schedule(dynamic,100)
71 for (int j = 0; j < (int)wake->vtx.size(); ++j)
72 {
73 L = wake->vtx[j].r().length();
74 gam = wake->vtx[j].g();
75 epsAst = scale[c] * velocity->wakeVortexesParams.epsastWake[j];
76
77 if (R - L > delta * epsAst)
78 curCirc += gam;
79 else if (R - L > -delta * epsAst)
80 {
81 double h = fabs(R - L);
82 if (h / R > 1e-3)
83 {
84 double phi = atan(h / sqrt(delta * delta * epsAst * epsAst - h * h));
85 double deltaPhi = (PI - 2.0 * phi) / nPts;
86
87 double addCirc = 0.0;
88
89 auto func = [h, epsAst, delta](double phi) -> double
90 {
91 return (IDPI / epsAst) * (exp(h / (epsAst * sin(phi))) * (epsAst - h / sin(phi)) - exp(-delta) * (1 + delta));
92 };
93
94 for (int s = 0; s < nPts; ++s)
95 {
96 double valAngle = -phi - deltaPhi * (s + 0.5);
97
98 addCirc += func(valAngle) * deltaPhi;
99 }
100 addCirc *= gam;
101
102 if (L > R)
103 curCirc += addCirc;
104 else
105 curCirc += (gam - addCirc);
106 }
107 else
108 curCirc += 0.5 * gam;
109 }//else
110 }//for j
111
112 circRad[i] = curCirc;
113 }//for i
114
115
116 std::ofstream circFile(circFileName.c_str(), std::ios::app);
117
118 circFile << currentStep << " " << getCurrentTime() << " " << scale[c];
119
120 for (auto gamma : circRad)
121 circFile << " " << gamma;
122 circFile << '\n';
123
124
125 circFile.close();
126 circFile.clear();
127
128 }// for c
129
130}
const double PI
Число .
Definition defs.h:76
const double IDPI
Число .
Definition defs.h:79
#define radiuses
Definition gammaCirc.h:16
#define scales
Definition gammaCirc.h:20
void PrintHeaderToTextFile(std::ofstream &str, const std::string &header)
Формирование подзаголовка в текстовом файле вывода программы VM2D/VM3D.
Definition defs.cpp:175
void PrintLogoToTextFile(std::ofstream &str, const std::string &fileName, const std::string &descr)
Формирование заголовка файла программы VM2D/VM3D.
Definition defs.cpp:139