VM2D  1.12
Vortex methods for 2D flows simulation
gammaCirc.h File Reference

Go to the source code of this file.

Macros

#define radiuses   { 1.0, 2.0, 3.0, 4.0, 5.0 }
 
#define scales   { 1.0 }
 

Functions

 if (currentStep%10==0)
 

Macro Definition Documentation

#define radiuses   { 1.0, 2.0, 3.0, 4.0, 5.0 }

Definition at line 15 of file gammaCirc.h.

#define scales   { 1.0 }

Definition at line 19 of file gammaCirc.h.

Function Documentation

if ( currentStep%  10 = = 0)

Definition at line 22 of file gammaCirc.h.

23 {
24 
25 
26 
27  std::vector<double> rad = radiuses;
28  std::vector<double> scale = scales;
29 
30 
31  std::string circFileName = getPassport().dir + "circ";
32 
33 
34  if (currentStep == 0)
35  {
36  std::ofstream circFile(circFileName.c_str());
37 
38  VMlib::PrintLogoToTextFile(circFile, circFileName, "Circulations along the circles of fixed radius");
39 
40  std::stringstream ssCirc;
41  ssCirc << "step time scale";
42  for (auto r : rad)
43  ssCirc << " R=" << r;
44 
45  VMlib::PrintHeaderToTextFile(circFile, ssCirc.str());
46 
47  circFile << std::endl;
48  circFile.close();
49  circFile.clear();
50  }
51 
52  for (int c = 0; c < scale.size(); ++c)
53  {
54  std::vector<double> circRad(rad.size(), 0.0);
55 
56  int nPts = 50; //50
57  double dist = 3.0; //3.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,dist,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 > dist * epsAst)
78  curCirc += gam;
79  else if (R - L > -dist * epsAst)
80  {
81  auto func = [R, L, epsAst, gam](double phi) -> double
82  {
83  return IDPI * exp(-sqr(L / epsAst)) - IDPI * exp(-(L * L - 2.0 * L * R * cos(phi) + R * R) / sqr(epsAst)) + exp(-sqr(L * sin(phi) / epsAst)) * L * cos(phi) * (erf(L * cos(phi) / epsAst) + erf((R - L * cos(phi)) / epsAst)) / (2.0 * sqrt(PI) * epsAst);
84  };
85 
86  double cft = dist * epsAst / (nPts * R);
87 
88  for (int s = 0; s < nPts; ++s)
89  curCirc += gam * 2.0 * cft * func((s + 0.5) * cft);
90  }//else
91  }//for j
92 
93  circRad[i] = curCirc;
94  }//for i
95 
96 
97  std::ofstream circFile(circFileName.c_str(), std::ios::app);
98 
99  circFile << currentStep << " " << getPassport().physicalProperties.getCurrTime() << " " << scale[c];
100 
101  for (auto gamma : circRad)
102  circFile << " " << gamma;
103  circFile << std::endl;
104 
105 
106  circFile.close();
107  circFile.clear();
108 
109  }// for c
110 
111 }
const double PI
Число .
Definition: defs.h:73
const double IDPI
Число .
Definition: defs.h:76
void PrintHeaderToTextFile(std::ofstream &str, const std::string &header)
Формирование подзаголовка в текстовом файле вывода программы VM2D/VM3D.
Definition: defs.cpp:172
T sqr(T x)
Возведение числа в квадрат
Definition: defs.h:430
void PrintLogoToTextFile(std::ofstream &str, const std::string &fileName, const std::string &descr)
Формирование заголовка файла программы VM2D/VM3D.
Definition: defs.cpp:136
#define scales
Definition: gammaCirc.h:19
R dist(const numvector< T, n > &x, const numvector< P, n > &y)
Вычисление расстояния между двумя точками
Definition: numvector.h:804
#define radiuses
Definition: gammaCirc.h:15

Here is the call graph for this function:

Here is the caller graph for this function: