VM2D 1.14
Vortex methods for 2D flows simulation
Loading...
Searching...
No Matches
VM2D::MechanicsDeformable Class Reference

Класс, определяющий вид механической системы More...

#include <Mechanics2DDeformable.h>

Inheritance diagram for VM2D::MechanicsDeformable:
Collaboration diagram for VM2D::MechanicsDeformable:

Public Member Functions

Point2D & getVcm ()
 текущая скорость профиля
 
Point2D & getRcm ()
 текущее отклонение профиля
 
double & getWcm ()
 текущая угловая скорость профиля
 
double & getPhicm ()
 текущий угол поворота профиля
 
 MechanicsDeformable (const World2D &W_, size_t numberInPassport_)
 Конструктор
 
 ~MechanicsDeformable ()
 Деструктор
 
virtual void GetHydroDynamForce () override
 Вычисление гидродинамической силы, действующей на профиль
 
virtual Point2D VeloOfAirfoilRcm (double currTime) override
 Вычисление скорости центра масс профиля
 
virtual Point2D PositionOfAirfoilRcm (double currTime) override
 Вычисление положения центра масс профиля
 
virtual double AngularVelocityOfAirfoil (double currTime) override
 Вычисление угловой скорости профиля
 
virtual double AngleOfAirfoil (double currTime) override
 Вычисление угла поворота профиля
 
virtual void VeloOfAirfoilPanels (double currTime) override
 Вычисление скоростей начал панелей
 
virtual void ReadSpecificParametersFromDictionary () override
 Чтение параметров конкретной механической системы
 
virtual void Move () override
 Перемещение профиля в соответствии с законом
 
void Initialize (Point2D Vcm0_, Point2D Rcm0_, double Wcm0_, double Phi0_)
 Задание начального положения и начальной скорости
 
void GenerateForcesHeader ()
 Генерация заголовка файла нагрузок
 
void GeneratePositionHeader ()
 Генерация заголовка файла положения профиля
 
void GenerateForcesString ()
 Сохранение строки со статистикой в файл нагрузок
 
void GeneratePositionString ()
 Сохранение строки со статистикой в файл нагрузок
 

Public Attributes

size_t indexOfUpperRightAngle
 хорда
 
size_t indexOfUpperLeftAngle
 
size_t indexOfLowerRightAngle
 
size_t indexOfLowerLeftAngle
 
std::vector< ChordPanelinitialChord
 
std::vector< ChordPanelchord
 
std::vector< double > upperShifts
 
std::vector< double > lowerShifts
 
std::unique_ptr< Beambeam
 
std::vector< std::vector< Point2D > > initialPossibleWays
 
Point2D Vcm0
 Начальная скорость центра и угловая скорость
 
double Wcm0
 
Point2D Rcm0
 Начальное положение профиля
 
double Phi0
 
Point2D Vcm
 Текущие скорость центра и угловая скорость
 
double Wcm
 
Point2D Rcm
 Текущие положение профиля
 
double Phi
 
Point2D VcmOld
 Скорость и отклонение с предыдущего шага
 
double WcmOld
 
Point2D RcmOld
 Текущие положение профиля
 
double PhiOld
 
double circulation
 Текущая циркуляция скорости по границе профиля
 
double circulationOld
 Циркуляция скорости по границе профиля с предыдущего шага
 
const bool isMoves
 Переменная, отвечающая за то, двигается профиль или нет
 
const bool isDeform
 Переменная, отвечающая за то, деформируется профиль или нет
 
Point2D hydroDynamForce
 Вектор гидродинамической силы и момент, действующие на профиль
 
double hydroDynamMoment
 
Point2D viscousForce
 Вектор силы и момент вязкого трения, действующие на профиль
 
double viscousMoment
 

Protected Attributes

const World2DW
 Константная ссылка на решаемую задачу
 
const size_t numberInPassport
 Номер профиля в паспорте
 
Airfoilafl
 
const Boundaryboundary
 
const VortexesParamsvirtVortParams
 
std::unique_ptr< VMlib::StreamParsermechParamsParser
 Умный указатель на парсер параметров механической системы
 

Private Member Functions

void ReadParametersFromDictionary ()
 Парсинг списка параметров механической системы
 

Private Attributes

std::vector< double > deformParam
 
bool fsi
 

Detailed Description

Класс, определяющий вид механической системы

Деформируемое твердое тело

Author
Марчевский Илья Константинович
Сокол Ксения Сергеевна
Рятина Евгения Павловна
Колганова Александра Олеговна
Серебровская Екатерина Александровна
Version
1.14
Date
6 марта 2026 г.

Definition at line 129 of file Mechanics2DDeformable.h.

Constructor & Destructor Documentation

◆ MechanicsDeformable()

MechanicsDeformable::MechanicsDeformable ( const World2D W_,
size_t  numberInPassport_ 
)

Конструктор

Parameters
[in]W_константная ссылка на решаемую задачу
[in]numberInPassport_номер профиля в паспорте задачи

Definition at line 179 of file Mechanics2DDeformable.cpp.

180 :
181 Mechanics(W_, numberInPassport_, true, true)
182{
183 const auto& airfoil = W_.getAirfoil(numberInPassport_);
184
185 Vcm0 = { 0.0, 0.0 };
186 Rcm0 = { airfoil.rcm[0], airfoil.rcm[1] };
187 Vcm = Vcm0;
188 Rcm = Rcm0;
189 VcmOld = Vcm0;
190 RcmOld = Rcm;
191
192
194
195 Point2D zero = { 0.0, 0.0 };
196
197 Initialize(zero, airfoil.rcm + zero, 0.0, airfoil.phiAfl + 0.0);
198
199 if (airfoil.phiAfl != 0)
200 {
201 W.getInfo('e') << "Airfoil rotation for Turek problem is not allowed" << std::endl;
202 exit(2345);
203 }
204
205 if (fsi)
206 {
207 //Turek
208 //Выделение упругой хорды
210 double x0 = airfoil.getR(indexOfUpperRightAngle)[0];
211 double x1 = x0;
212 while (fabs(x1 - x0) < 1e-12)
213 {
215 x0 = x1;
216 x1 = airfoil.getR(indexOfUpperRightAngle)[0];
217 }
219
221 for (size_t i = 0; i < upperShifts.size(); ++i)
222 upperShifts[i] = airfoil.getR(i + 1)[1] - airfoil.getR(0)[1];
223
224
226 double y0 = airfoil.getR(indexOfUpperLeftAngle)[1];
227 double y1 = y0;
228 while (fabs(y1 - y0) < 1e-12)
229 {
231 y0 = y1;
232 y1 = airfoil.getR(indexOfUpperLeftAngle)[1];
233 }
235
236
237 indexOfLowerRightAngle = airfoil.getNumberOfPanels() + 1;
238 x0 = airfoil.getR(indexOfLowerRightAngle)[0];
239 x1 = x0;
240 while (fabs(x1 - x0) < 1e-12)
241 {
243 x0 = x1;
244 x1 = airfoil.getR(indexOfLowerRightAngle)[0];
245 }
247
248
249 lowerShifts.resize(airfoil.getNumberOfPanels() - indexOfLowerRightAngle - 1);
250 for (size_t i = 0; i < lowerShifts.size(); ++i)
251 lowerShifts[i] = airfoil.getR(airfoil.getNumberOfPanels() - 1 - i)[1] - airfoil.getR(0)[1];
252
254 y0 = airfoil.getR(indexOfLowerLeftAngle)[1];
255 y1 = y0;
256 while (fabs(y1 - y0) < 1e-12)
257 {
259 y0 = y1;
260 y1 = airfoil.getR(indexOfLowerLeftAngle)[1];
261 }
263
264 //W.getInfo('i') << "UR: " << airfoil.getR(indexOfUpperRightAngle) << std::endl;
265 //W.getInfo('i') << "UL: " << airfoil.getR(indexOfUpperLeftAngle) << std::endl;
266 //W.getInfo('i') << "LR: " << airfoil.getR(indexOfLowerRightAngle) << std::endl;
267 //W.getInfo('i') << "LL: " << airfoil.getR(indexOfLowerLeftAngle) << std::endl;
268
270 {
271 W.getInfo('e') << "indexOfUpperLeftAngle - indexOfUpperRightAngle != indexOfLowerRightAngle - indexOfLowerLeftAngle" << std::endl;
272 exit(2346);
273 }
274
276
277 for (size_t i = 0; i < indexOfUpperLeftAngle - indexOfUpperRightAngle; ++i)
278 {
279 size_t idxUp = indexOfUpperLeftAngle - 1 - i;
280 size_t idxDn = indexOfLowerLeftAngle + i;
281 Point2D rUpLeft = airfoil.getR(idxUp + 1);
282 Point2D rUpRight = airfoil.getR(idxUp);
283 Point2D rDnLeft = airfoil.getR(idxDn);
284 Point2D rDnRight = airfoil.getR(idxDn + 1);
285
286 if (std::max(fabs(rUpLeft[0] - rDnLeft[0]), fabs(rUpRight[0] - rDnRight[0])) > \
287 0.01 * std::min((rUpRight[0] - rUpLeft[0]), (rDnRight[0] - rDnLeft[0])))
288 {
289 W.getInfo('e') << "x_up != x_dn" << std::endl;
290 exit(2347);
291 }
292
293 chord[i].beg = 0.5 * (rUpLeft + rDnLeft);
294 chord[i].end = 0.5 * (rUpRight + rDnRight);
295 chord[i].infPanels = { idxUp, idxDn };
296 chord[i].rightSemiWidth = 0.5 * (rUpRight - rDnRight)[1];
297 }
299 beam = std::make_unique<Beam>(W, fsi, chord[0].beg[0], initialChord.back().end[0] - initialChord[0].beg[0], 3); //Beam
300 }
301 else //Fish
302 {
303 int np = (int)airfoil.getNumberOfPanels();
304 chord.resize(np / 2);
305
306 chord[0].beg = airfoil.getR(np / 2);
307 chord[np / 2 - 1].end = airfoil.getR(0);
308 chord[np / 2 - 1].rightSemiWidth = 0.0;
309
310 for (size_t i = 0; i < np / 2; ++i)
311 {
312 if (i != 0)
313 chord[i].beg = 0.5 * (airfoil.getR(np / 2 - i) + airfoil.getR(np / 2 + i));
314
315 if (i != np / 2 - 1)
316 chord[i].end = 0.5 * (airfoil.getR(np / 2 - i - 1) + airfoil.getR(np / 2 + i + 1));
317
318 chord[i].infPanels = { np / 2 - i, np / 2 + i + 1 };
319
320 if (i != np / 2 - 1)
321 chord[i].rightSemiWidth = (airfoil.getR(np / 2 - i - 1) - airfoil.getR(np / 2 + i + 1)).length() * 0.5;
322 }
324 beam = std::make_unique<Beam>(W, fsi, chord[0].beg[0], initialChord.back().end[0] - initialChord[0].beg[0], 3); //Beam
325 }
326
327 //std::ofstream of("chord.txt");
328 //for (size_t i = 0; i < chord.size(); ++i)
329 // of << chord[i].beg[0] << " " << chord[i].beg[1] << " " << chord[i].end[0] << " " << chord[i].end[1] << " " << chord[i].infPanels.first << " " << chord[i].infPanels.second << std::endl;
330 //of.close();
331
332
333
334 initialPossibleWays = airfoil.possibleWays;
335};
virtual void ReadSpecificParametersFromDictionary() override
Чтение параметров конкретной механической системы
std::vector< ChordPanel > initialChord
std::vector< std::vector< Point2D > > initialPossibleWays
std::vector< double > upperShifts
std::vector< double > lowerShifts
std::vector< ChordPanel > chord
std::unique_ptr< Beam > beam
Абстрактный класс, определяющий вид механической системы
Definition Mechanics2D.h:72
Point2D Vcm0
Начальная скорость центра и угловая скорость
Point2D RcmOld
Текущие положение профиля
Point2D VcmOld
Скорость и отклонение с предыдущего шага
const World2D & W
Константная ссылка на решаемую задачу
Definition Mechanics2D.h:79
void Initialize(Point2D Vcm0_, Point2D Rcm0_, double Wcm0_, double Phi0_)
Задание начального положения и начальной скорости
Point2D Rcm
Текущие положение профиля
Point2D Rcm0
Начальное положение профиля
Point2D Vcm
Текущие скорость центра и угловая скорость
const Airfoil & getAirfoil(size_t i) const
Возврат константной ссылки на объект профиля
Definition World2D.h:163
VMlib::LogStream & getInfo() const
Возврат ссылки на объект LogStream Используется в техничеcких целях для организации вывода
Definition WorldGen.h:82
Here is the call graph for this function:

◆ ~MechanicsDeformable()

VM2D::MechanicsDeformable::~MechanicsDeformable ( )
inline

Деструктор

Definition at line 161 of file Mechanics2DDeformable.h.

161{};

Member Function Documentation

◆ AngleOfAirfoil()

double MechanicsDeformable::AngleOfAirfoil ( double  currTime)
overridevirtual

Вычисление угла поворота профиля

Parameters
[in]currTimeтекущее время

Implements VM2D::Mechanics.

Definition at line 424 of file Mechanics2DDeformable.cpp.

425{
426 if (afl.phiAfl != Phi)
427 {
428 std::cout << "afl.phiAfl != Phi" << std::endl;
429 exit(100600);
430 }
431
432 return afl.phiAfl;
433}//AngleOfAirfoil(...)
double phiAfl
Поворот профиля
Definition Airfoil2D.h:100
Airfoil & afl
Definition Mechanics2D.h:87

◆ AngularVelocityOfAirfoil()

double MechanicsDeformable::AngularVelocityOfAirfoil ( double  currTime)
overridevirtual

Вычисление угловой скорости профиля

Parameters
[in]currTimeтекущее время

Implements VM2D::Mechanics.

Definition at line 419 of file Mechanics2DDeformable.cpp.

420{
421 return Wcm;
422}//AngularVelocityOfAirfoil(...)

◆ GenerateForcesHeader()

void Mechanics::GenerateForcesHeader ( )
inherited

Генерация заголовка файла нагрузок

Definition at line 126 of file Mechanics2D.cpp.

127{
128 std::stringstream forceFileName, forceFileNameCsv;
129 forceFileName << W.getPassport().dir << "forces-airfoil-" << numberInPassport;
130 forceFileNameCsv << W.getPassport().dir << "forces-airfoil-" << numberInPassport << ".csv";
131
132 std::ofstream newForcesFile(forceFileName.str());
133 std::ofstream newForcesFileCsv(forceFileNameCsv.str());
134
135 VMlib::PrintLogoToTextFile(newForcesFile, forceFileName.str(), "Hydrodynamic loads for the airfoil " + W.getPassport().airfoilParams[numberInPassport].fileAirfoil);
136
138 VMlib::PrintHeaderToTextFile(newForcesFile, "currentStep currentTime Fx Fy Mz Ftaux Ftauy Mtau");
139 else
140 VMlib::PrintHeaderToTextFile(newForcesFile, "currentStep currentTime CFx CFy CMz CFtaux CFtauy CMtau");
141
143 newForcesFileCsv << "step,time,Fx,Fy,Mz,Ftaux,Ftauy,Mtau";
144 else
145 newForcesFileCsv << "step,time,CFx,CFy,CMz,CFtaux,CFtauy,CMtau";
146
147 newForcesFile.close();
148 newForcesFile.clear();
149
150 newForcesFileCsv.close();
151 newForcesFileCsv.clear();
152
153}//GenerateForcesHeader()
const size_t numberInPassport
Номер профиля в паспорте
Definition Mechanics2D.h:82
bool calcCoefficients
Признак вычисления коэффициентов вместо сил
Definition Passport2D.h:294
std::vector< AirfoilParams > airfoilParams
Список структур с параметрами профилей
Definition Passport2D.h:276
const Passport & getPassport() const
Возврат константной ссылки на паспорт
Definition World2D.h:263
std::string dir
Рабочий каталог задачи
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
Here is the call graph for this function:

◆ GenerateForcesString()

void Mechanics::GenerateForcesString ( )
inherited

Сохранение строки со статистикой в файл нагрузок

Definition at line 184 of file Mechanics2D.cpp.

185{
186 std::stringstream forceFileName, forceFileNameCsv;
187 forceFileName << W.getPassport().dir << "forces-airfoil-" << numberInPassport;
188 forceFileNameCsv << W.getPassport().dir << "forces-airfoil-" << numberInPassport << ".csv";
189
190 //double cShock = (W.getPassport().physicalProperties.getCurrTime() > W.getPassport().physicalProperties.timeAccel + 2.0 * W.getPassport().timeDiscretizationProperties.dt) ? 1.0 : 0.0;
191 double cShock = 1.0;
192
193 Point2D cartesianHydroForce = cShock * hydroDynamForce;
194 Point2D cartesianViscoForce = cShock * viscousForce;
195
196 double cartesianHydroMoment = cShock * hydroDynamMoment;
197 double cartesianViscoMoment = cShock * viscousMoment;
198
199 double rotationAngle = W.getPassport().airfoilParams[numberInPassport].angle;
200
201 //Для обдува ветром, когда углы считаются по компасу
202 //if (W.getPassport().geographicalAngles)
203 //{
204 // cartesianHydroForce = cartesianHydroForce.rotated(-0.5 * PI - W.getPassport().airfoilParams[numberInPassport].angle);
205 // cartesianViscoForce = cartesianViscoForce.rotated(-0.5 * PI - W.getPassport().airfoilParams[numberInPassport].angle);
206 // //rotationAngle += 0.5 * PI;
207 //}
208
209 //if (W.getPassport().rotateForces)
210 //{
211 // cartesianHydroForce = cartesianHydroForce.rotated(rotationAngle);
212 // cartesianViscoForce = cartesianViscoForce.rotated(rotationAngle);
213 //}
214
217 {
218 const double& chord = W.getPassport().airfoilParams[numberInPassport].chord;
219 cartesianHydroForce /= (flowPress * chord);
220 cartesianViscoForce /= (flowPress * chord);
221
222 cartesianHydroMoment /= (flowPress * sqr(chord));
223 cartesianViscoMoment /= (flowPress * sqr(chord));
224 }
225
226
227 std::ofstream forcesFile(forceFileName.str(), std::ios::app);
228 forcesFile << std::endl << W.getCurrentStep() << " " << W.getCurrentTime() << " " << cartesianHydroForce[0] << " " << cartesianHydroForce[1] << " " << cartesianHydroMoment << " " << cartesianViscoForce[0] << " " << cartesianViscoForce[1] << " " << cartesianViscoMoment;
229 forcesFile.close();
230
231 std::ofstream forcesFileCsv(forceFileNameCsv.str(), std::ios::app);
232 forcesFileCsv << std::endl << W.getCurrentStep() << "," << W.getCurrentTime() << "," << cartesianHydroForce[0] << "," << cartesianHydroForce[1] << "," << cartesianHydroMoment << "," << cartesianViscoForce[0] << "," << cartesianViscoForce[1] << "," << cartesianViscoMoment;
233 forcesFileCsv.close();
234
235}//GenerateForcesString()
Point2D hydroDynamForce
Вектор гидродинамической силы и момент, действующие на профиль
Point2D viscousForce
Вектор силы и момент вязкого трения, действующие на профиль
double hydroDynamMoment
PhysicalProperties physicalProperties
Структура с физическими свойствами задачи
Definition Passport2D.h:301
double getCurrentTime() const
Definition WorldGen.h:100
size_t getCurrentStep() const
Возврат константной ссылки на параметры распараллеливания по MPI.
Definition WorldGen.h:99
T sqr(T x)
Возведение числа в квадрат
Definition defs.h:455
double vRef
Референсная скорость
Definition Passport2D.h:81
double rho
Плотность потока
Definition Passport2D.h:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GeneratePositionHeader()

void Mechanics::GeneratePositionHeader ( )
inherited

Генерация заголовка файла положения профиля

Definition at line 157 of file Mechanics2D.cpp.

158{
159 if (isMoves)
160 {
161 std::stringstream positionFileName, positionFileNameCsv;
162 positionFileName << W.getPassport().dir << "position-airfoil-" << numberInPassport;
163 positionFileNameCsv << W.getPassport().dir << "position-airfoil-" << numberInPassport << ".csv";
164
165 std::ofstream newPositionFile(positionFileName.str());
166 std::ofstream newPositionFileCsv(positionFileNameCsv.str());
167
168 VMlib::PrintLogoToTextFile(newPositionFile, positionFileName.str(), "Position of the airfoil " + W.getPassport().airfoilParams[numberInPassport].fileAirfoil);
169
170 VMlib::PrintHeaderToTextFile(newPositionFile, "currentStep currentTime x y phi Vx Vy w");
171
172 newPositionFileCsv << "step,time,x,y,phi,Vx,Vy,w";
173
174 newPositionFile.close();
175 newPositionFile.clear();
176
177 newPositionFileCsv.close();
178 newPositionFileCsv.clear();
179 }
180}//GeneratePositionHeader()
const bool isMoves
Переменная, отвечающая за то, двигается профиль или нет
Here is the call graph for this function:

◆ GeneratePositionString()

void Mechanics::GeneratePositionString ( )
inherited

Сохранение строки со статистикой в файл нагрузок

Definition at line 239 of file Mechanics2D.cpp.

240{
241 if (isMoves)
242 {
243 std::stringstream positionFileName, positionFileNameCsv;
244 positionFileName << W.getPassport().dir << "position-airfoil-" << numberInPassport;
245 positionFileNameCsv << W.getPassport().dir << "position-airfoil-" << numberInPassport << ".csv";
246
247 std::ofstream positionFile(positionFileName.str(), std::ios::app);
248 positionFile << std::endl << W.getCurrentStep() << " " << W.getCurrentTime() << " " << afl.rcm[0] << " " << afl.rcm[1] << " " << Phi << " " << Vcm[0] << " " << Vcm[1] << " " << Wcm;
249 positionFile.close();
250
251 std::ofstream positionFileCsv(positionFileNameCsv.str(), std::ios::app);
252 positionFileCsv << std::endl << W.getCurrentStep() << "," << W.getCurrentTime() << "," << afl.rcm[0] << "," << afl.rcm[1] << "," << Phi << "," << Vcm[0] << "," << Vcm[1] << "," << Wcm;
253 positionFileCsv.close();
254 }
255}
Point2D rcm
Положение центра масс профиля
Definition Airfoil2D.h:97
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHydroDynamForce()

void MechanicsDeformable::GetHydroDynamForce ( )
overridevirtual

Вычисление гидродинамической силы, действующей на профиль

Todo:
Учитываем только нулевой момент решения. Надо ли учитывать остальные?

Implements VM2D::Mechanics.

Definition at line 338 of file Mechanics2DDeformable.cpp.

339{
340 W.getTimers().start("Force");
341
342 const double& dt = W.getPassport().timeDiscretizationProperties.dt;
343
344 hydroDynamForce = { 0.0, 0.0 };
345 hydroDynamMoment = 0.0;
346
347 viscousForce = { 0.0, 0.0 };
348 viscousMoment = 0.0;
349
350 Point2D hDFGam = { 0.0, 0.0 }; //гидродинамические силы, обусловленные присоед.завихренностью
351 Point2D hDFdelta = { 0.0, 0.0 }; //гидродинамические силы, обусловленные приростом завихренности
352 Point2D hDFQ = { 0.0, 0.0 }; //гидродинамические силы, обусловленные присоед.источниками
353
354 double hDMGam = 0.0; //гидродинамический момент, обусловленный присоед.завихренностью
355 double hDMdelta = 0.0; //гидродинамический момент, обусловленный приростом завихренности
356 double hDMQ = 0.0; //гидродинамический момент, обусловленный присоед.источниками
357 for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
358 {
359 Point2D rK = 0.5 * (afl.getR(i + 1) + afl.getR(i)) - afl.rcm;
360
361 Point2D velK = 0.5 * (afl.getV(i) + afl.getV(i + 1));
362 double gAtt = (velK & afl.tau[i]);
363
364 double gAttOld = 0.0;
365 if (W.getCurrentStep() > 0)
366 {
367 auto oldAfl = W.getOldAirfoil(numberInPassport);
368 gAttOld = ((0.5 * (oldAfl.getV(i) + oldAfl.getV(i + 1))) & oldAfl.tau[i]);
369 }
370
371 double deltaGAtt = gAtt - gAttOld;
372
373 double qAtt = (velK & afl.nrm[i]);
374
376 double deltaK = boundary.sheets.freeVortexSheet(i, 0) * afl.len[i] - afl.gammaThrough[i] + deltaGAtt * afl.len[i];
377
378 /*1*/
379 hDFdelta += deltaK * Point2D({ -rK[1], rK[0] });
380 hDMdelta += 0.5 * deltaK * rK.length2();
381
382 /*2*/
383 hDFGam += 0.5 * velK.kcross() * gAtt * afl.len[i];
384 hDMGam += 0.5 * (rK ^ velK.kcross()) * gAtt * afl.len[i];
385
386 /*3*/
387 hDFQ -= 0.5 * velK * qAtt * afl.len[i];
388 hDMQ -= 0.5 * (rK ^ velK) * qAtt * afl.len[i];
389 }
390
391 const double rho = W.getPassport().physicalProperties.rho;
392
393 hydroDynamForce = rho * (hDFGam + hDFdelta * (1.0 / dt) + hDFQ);
394 hydroDynamMoment = rho * (hDMGam + hDMdelta / dt + hDMQ);
395
396 if ((W.getPassport().physicalProperties.nu > 0.0)/* && (W.currentStep > 0)*/)
397 for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
398 {
399 Point2D rK = 0.5 * (afl.getR(i + 1) + afl.getR(i)) - afl.rcm;
400 viscousForce += rho * afl.viscousStress[i] * afl.tau[i];
401 viscousMoment += rho * (afl.viscousStress[i] * afl.tau[i]) & rK;
402 }
403
404 W.getTimers().stop("Force");
405}// GetHydroDynamForce()
std::vector< double > len
Длины панелей профиля
Definition Airfoil2D.h:94
const Point2D & getR(size_t q) const
Возврат константной ссылки на вершину профиля
Definition Airfoil2D.h:113
const Point2D & getV(size_t q) const
Возврат константной ссылки на скорость вершины профиля
Definition Airfoil2D.h:137
std::vector< Point2D > nrm
Нормали к панелям профиля
Definition Airfoil2D.h:81
std::vector< Point2D > tau
Касательные к панелям профиля
Definition Airfoil2D.h:91
size_t getNumberOfPanels() const
Возврат количества панелей на профиле
Definition Airfoil2D.h:163
std::vector< double > gammaThrough
Суммарные циркуляции вихрей, пересекших панели профиля на прошлом шаге
Definition Airfoil2D.h:276
std::vector< double > viscousStress
Нейросеть для коэффициентов I0 и I3 диффузионной скорости
Definition Airfoil2D.h:268
Sheet sheets
Слои на профиле
Definition Boundary2D.h:96
const Boundary & boundary
Definition Mechanics2D.h:91
const double & freeVortexSheet(size_t n, size_t moment) const
Definition Sheet2D.h:100
const AirfoilGeometry & getOldAirfoil(size_t i) const
Возврат константной ссылки на объект старого профиля
Definition World2D.h:169
VMlib::TimersGen & getTimers() const
Возврат ссылки на временную статистику выполнения шага расчета по времени
Definition World2D.h:288
TimeDiscretizationProperties timeDiscretizationProperties
Структура с параметрами процесса интегрирования по времени
void stop(const std::string &timerLabel)
Останов счетчика
Definition TimesGen.cpp:68
void start(const std::string &timerLabel)
Запуск счетчика
Definition TimesGen.cpp:55
numvector< T, 2 > kcross() const
Геометрический поворот двумерного вектора на 90 градусов
Definition numvector.h:511
auto length2() const -> typename std::remove_const< typename std::remove_reference< decltype(this->data[0])>::type >::type
Вычисление квадрата нормы (длины) вектора
Definition numvector.h:386
double nu
Коэффициент кинематической вязкости среды
Definition Passport2D.h:99
double dt
Шаг по времени
Definition PassportGen.h:67
Here is the call graph for this function:

◆ getPhicm()

double & VM2D::MechanicsDeformable::getPhicm ( )
inline

текущий угол поворота профиля

Definition at line 150 of file Mechanics2DDeformable.h.

150{ return Phi; };

◆ getRcm()

Point2D & VM2D::MechanicsDeformable::getRcm ( )
inline

текущее отклонение профиля

Definition at line 144 of file Mechanics2DDeformable.h.

144{ return Rcm; };

◆ getVcm()

Point2D & VM2D::MechanicsDeformable::getVcm ( )
inline

текущая скорость профиля

Definition at line 141 of file Mechanics2DDeformable.h.

141{ return Vcm; };

◆ getWcm()

double & VM2D::MechanicsDeformable::getWcm ( )
inline

текущая угловая скорость профиля

Definition at line 147 of file Mechanics2DDeformable.h.

147{ return Wcm; };

◆ Initialize()

void Mechanics::Initialize ( Point2D  Vcm0_,
Point2D  Rcm0_,
double  Wcm0_,
double  Phi0_ 
)
inherited

Задание начального положения и начальной скорости

Parameters
[in]Vcm0_- скорость центра масс
[in]Rcm0_- положение центра масс
[in]Wcm0_- угловая скорость центра масс
[in]Phi0_- угол поворота центра масс

Definition at line 93 of file Mechanics2D.cpp.

94{
95 Vcm0 = Vcm0_;
96 Wcm0 = Wcm0_;
97 Rcm0 = Rcm0_;
98 Phi0 = Phi0_;
99
100 Vcm = Vcm0;
101 Wcm = Wcm0;
102 Rcm = Rcm0;
103 Phi = Phi0;
104 VcmOld = Vcm0;
105 WcmOld = Wcm0;
106 RcmOld = Rcm0;
107 PhiOld = Phi0;
108
109 circulation = 2.0 * afl.area * Wcm;
111
114}//Initialize(...)
double area
Площадь профиля
Definition Airfoil2D.h:103
virtual void Move(const Point2D &dr)
Перемещение профиля
virtual void Rotate(double alpha)
Поворот профиля
double circulationOld
Циркуляция скорости по границе профиля с предыдущего шага
double circulation
Текущая циркуляция скорости по границе профиля
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Move()

void MechanicsDeformable::Move ( )
overridevirtual

Перемещение профиля в соответствии с законом

Implements VM2D::Mechanics.

Definition at line 460 of file Mechanics2DDeformable.cpp.

461{
462 double x0 = chord[0].beg[0];
463 double t = W.getCurrentTime();
464
465
466 if (fsi) //turek
467 {
468 for (int i = 0; i < beam->R; ++i)
470
471 for (size_t i = 0; i < chord.size(); ++i)
472 {
473 chord[i].beg[1] = beam->getTotalDisp(chord[i].beg[0], t);
474 chord[i].end[1] = beam->getTotalDisp(chord[i].end[0], t);
475 }
476
477 std::vector<Point2D> upperPoints(chord.size() + upperShifts.size());
478 std::vector<Point2D> lowerPoints(chord.size() + lowerShifts.size());
479
480 for (size_t i = 0; i < chord.size() - 1; ++i)
481 {
482 const Point2D& begIp1 = chord[i + 1].beg;
483 const Point2D& endI = chord[i].end;
484 Point2D normI = (endI - chord[i].beg).unit().kcross();
485 Point2D normIp1 = (chord[i + 1].end - begIp1).unit().kcross();
486 upperPoints[i] = endI + 0.5 * chord[i].rightSemiWidth * (normI + normIp1);
487 lowerPoints[i] = endI - 0.5 * chord[i].rightSemiWidth * (normI + normIp1);
488 }
489 Point2D normBack = (chord.back().end - chord.back().beg).unit().kcross();
490 upperPoints[chord.size() - 1] = chord.back().end + chord.back().rightSemiWidth * normBack;
491 lowerPoints[chord.size() - 1] = chord.back().end - chord.back().rightSemiWidth * normBack;
492
493 for (size_t i = 0; i < upperShifts.size(); ++i)
494 upperPoints[chord.size() + i] = chord.back().end + upperShifts[upperShifts.size() - 1 - i] * normBack;
495 for (size_t i = 0; i < lowerShifts.size(); ++i)
496 lowerPoints[chord.size() + i] = chord.back().end + lowerShifts[lowerShifts.size() - 1 - i] * normBack;
497
498 afl.setR(0) = { chord.back().end[0], beam->getTotalDisp(chord.back().end[0], t) };
499 for (size_t i = 0; i < upperPoints.size(); ++i)
500 afl.setR(indexOfUpperLeftAngle - 1 - i) = upperPoints[i];
501 for (size_t i = 0; i < lowerPoints.size(); ++i)
502 afl.setR(indexOfLowerLeftAngle + 1 + i) = lowerPoints[i];
503
504 /*
505 std::ofstream file;
506 file.open(W.getPassport().dir + "file" + std::to_string(W.getCurrentStep()) + ".txt");
507 for (size_t c = 0; c < chord.size(); ++c)
508 file << std::endl;
509 file.close();
510 //*/
511 }
512 else //Fish
513 {
514 for (size_t i = 0; i < chord.size(); ++i)
515 {
516 chord[i].beg[1] = beam->getGivenLaw(chord[i].beg[0], t, deformParam);
517 chord[i].end[1] = beam->getGivenLaw(chord[i].end[0], t, deformParam);
518 }
519
520 std::vector<Point2D> upperPoints(chord.size());
521 std::vector<Point2D> lowerPoints(chord.size());
522
523 for (size_t i = 0; i < chord.size() - 1; ++i)
524 {
525 const Point2D& begIp1 = chord[i + 1].beg;
526 const Point2D& endI = chord[i].end;
527 Point2D normI = (endI - chord[i].beg).unit().kcross();
528 Point2D normIp1 = (chord[i + 1].end - begIp1).unit().kcross();
529 upperPoints[i] = endI + 0.5 * chord[i].rightSemiWidth * (normI + normIp1);
530 lowerPoints[i] = endI - 0.5 * chord[i].rightSemiWidth * (normI + normIp1);
531 }
532
533 Point2D normFront = (chord[0].end - chord[0].beg).unit().kcross();
534 Point2D normBack = (chord.back().end - chord.back().beg).unit().kcross();
535
536 int nph = (int)chord.size();
537
538 afl.setR(0) = chord.back().end;
539 afl.setR(nph) = chord[0].beg;
540 for (size_t i = 0; i < nph - 1; ++i)
541 {
542 afl.setR(nph - 1 - i) = upperPoints[i];
543 afl.setR(nph + 1 + i) = lowerPoints[i];
544 }
545 }
546
547
550
551 afl.possibleWays.clear();
552 afl.possibleWays.resize(initialPossibleWays.size());
553
554 for (size_t w = 0; w < initialPossibleWays.size(); ++w)
555 {
556 std::vector<Point2D> initialWay = initialPossibleWays[w];
557 afl.possibleWays[w].resize(initialWay.size());
558 for (size_t p = 0; p < initialWay.size(); ++p)
559 {
560 double x = initialWay[p][0];
561 double y;
562
563 if (fsi) //turek
564 y = beam->getTotalDisp(x, t);
565 else //fish
566 y = beam->getGivenLaw(x, t, deformParam);
567
568 afl.possibleWays[w][p] = Point2D{ x,y };
569 }
570 }
571
573}//Move()
Point2D & setR(size_t q)
Возврат ссылки на вершину профиля
Definition Airfoil2D.h:125
virtual void GetGabarits(double gap=0.02)
Вычисляет габаритный прямоугольник профиля
void CalcNrmTauLen()
Вычисление нормалей, касательных и длин панелей по текущему положению вершин
void lightningTest()
Тест на "отвещенность".
std::vector< std::vector< Point2D > > possibleWays
Возможные пути внутри профиля от точки (0, 0) к центрам всех панелей
Definition Airfoil2D.h:199
std::vector< double > deformParam
size_t size() const
Definition numvector.h:114
Here is the call graph for this function:

◆ PositionOfAirfoilRcm()

Point2D MechanicsDeformable::PositionOfAirfoilRcm ( double  currTime)
overridevirtual

Вычисление положения центра масс профиля

Parameters
[in]currTimeтекущее время

Implements VM2D::Mechanics.

Definition at line 414 of file Mechanics2DDeformable.cpp.

415{
416 return Rcm;
417}//PositionOfAirfoilRcm(...)

◆ ReadParametersFromDictionary()

void Mechanics::ReadParametersFromDictionary ( )
privateinherited

Парсинг списка параметров механической системы

Definition at line 117 of file Mechanics2D.cpp.

118{
119 std::stringstream ss(W.getPassport().airfoilParams[afl.numberInPassport].mechanicalSystemParameters);
120
121 mechParamsParser.reset(new VMlib::StreamParser(W.getInfo(), "mechanical parser", ss));
122}//ReadParametersFromDictionary()
const size_t numberInPassport
Номер профиля в паспорте
Definition Airfoil2D.h:188
std::unique_ptr< VMlib::StreamParser > mechParamsParser
Умный указатель на парсер параметров механической системы
Definition Mechanics2D.h:98
Класс, позволяющий выполнять разбор файлов и строк с настройками и параметрами
Here is the call graph for this function:

◆ ReadSpecificParametersFromDictionary()

virtual void VM2D::MechanicsDeformable::ReadSpecificParametersFromDictionary ( )
overridevirtual

Чтение параметров конкретной механической системы

Implements VM2D::Mechanics.

Here is the caller graph for this function:

◆ VeloOfAirfoilPanels()

void MechanicsDeformable::VeloOfAirfoilPanels ( double  currTime)
overridevirtual

Вычисление скоростей начал панелей

Parameters
[in]currTimeтекущее время

Implements VM2D::Mechanics.

Definition at line 436 of file Mechanics2DDeformable.cpp.

437{
438 std::vector<Point2D> veloW(afl.getNumberOfPanels(), {0.0, 0.0});
439
440 //if (W.getCurrentStep() == 0)
441 // for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
442 // veloW[i] = { 0.0, 0.0 };//afl.getR(i).kcross();
443
444 if (W.getCurrentStep() > 0)
445 for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
446 veloW[i] = (1.0 / W.getPassport().timeDiscretizationProperties.dt) * (afl.getR(i) - W.getOldAirfoil(0).getR(i));
447
448 afl.setV(veloW);
449
450
451 //Циркуляция
453 circulation = 0.0;
454 for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
455 circulation += 0.5 * afl.len[i] * ((afl.getV(i) + afl.getV(i + 1)) & afl.tau[i]);
456
457}//VeloOfAirfoilPanels(...)
void setV(const Point2D &vel)
Установка постоянной скорости всех вершин профиля
Definition Airfoil2D.h:145
Here is the call graph for this function:

◆ VeloOfAirfoilRcm()

Point2D MechanicsDeformable::VeloOfAirfoilRcm ( double  currTime)
overridevirtual

Вычисление скорости центра масс профиля

Parameters
[in]currTimeтекущее время

Implements VM2D::Mechanics.

Definition at line 408 of file Mechanics2DDeformable.cpp.

409{
410 return Vcm;
411}//VeloOfAirfoilRcm(...)

Member Data Documentation

◆ afl

Airfoil& VM2D::Mechanics::afl
protectedinherited

Константная ссылка на профиль
инициализируется автоматом в конструкторе, при помощи const_cast

Warning
использует const_cast для получения неконстантной ссылки

Definition at line 87 of file Mechanics2D.h.

◆ beam

std::unique_ptr<Beam> VM2D::MechanicsDeformable::beam

Definition at line 184 of file Mechanics2DDeformable.h.

◆ boundary

const Boundary& VM2D::Mechanics::boundary
protectedinherited

Константная ссылка на граничное условие
инициализируется автоматом в конструкторе

Definition at line 91 of file Mechanics2D.h.

◆ chord

std::vector<ChordPanel> VM2D::MechanicsDeformable::chord

Definition at line 180 of file Mechanics2DDeformable.h.

◆ circulation

double VM2D::Mechanics::circulation
inherited

Текущая циркуляция скорости по границе профиля

Definition at line 121 of file Mechanics2D.h.

◆ circulationOld

double VM2D::Mechanics::circulationOld
inherited

Циркуляция скорости по границе профиля с предыдущего шага

Definition at line 124 of file Mechanics2D.h.

◆ deformParam

std::vector<double> VM2D::MechanicsDeformable::deformParam
private

Definition at line 133 of file Mechanics2DDeformable.h.

◆ fsi

bool VM2D::MechanicsDeformable::fsi
private

Definition at line 136 of file Mechanics2DDeformable.h.

◆ hydroDynamForce

Point2D VM2D::Mechanics::hydroDynamForce
inherited

Вектор гидродинамической силы и момент, действующие на профиль

Definition at line 134 of file Mechanics2D.h.

◆ hydroDynamMoment

double VM2D::Mechanics::hydroDynamMoment
inherited

Definition at line 135 of file Mechanics2D.h.

◆ indexOfLowerLeftAngle

size_t VM2D::MechanicsDeformable::indexOfLowerLeftAngle

Definition at line 177 of file Mechanics2DDeformable.h.

◆ indexOfLowerRightAngle

size_t VM2D::MechanicsDeformable::indexOfLowerRightAngle

Definition at line 176 of file Mechanics2DDeformable.h.

◆ indexOfUpperLeftAngle

size_t VM2D::MechanicsDeformable::indexOfUpperLeftAngle

Definition at line 175 of file Mechanics2DDeformable.h.

◆ indexOfUpperRightAngle

size_t VM2D::MechanicsDeformable::indexOfUpperRightAngle

хорда

Definition at line 174 of file Mechanics2DDeformable.h.

◆ initialChord

std::vector<ChordPanel> VM2D::MechanicsDeformable::initialChord

Definition at line 179 of file Mechanics2DDeformable.h.

◆ initialPossibleWays

std::vector<std::vector<Point2D> > VM2D::MechanicsDeformable::initialPossibleWays

Definition at line 186 of file Mechanics2DDeformable.h.

◆ isDeform

const bool VM2D::Mechanics::isDeform
inherited

Переменная, отвечающая за то, деформируется профиль или нет

Definition at line 131 of file Mechanics2D.h.

◆ isMoves

const bool VM2D::Mechanics::isMoves
inherited

Переменная, отвечающая за то, двигается профиль или нет

Definition at line 128 of file Mechanics2D.h.

◆ lowerShifts

std::vector<double> VM2D::MechanicsDeformable::lowerShifts

Definition at line 182 of file Mechanics2DDeformable.h.

◆ mechParamsParser

std::unique_ptr<VMlib::StreamParser> VM2D::Mechanics::mechParamsParser
protectedinherited

Умный указатель на парсер параметров механической системы

Definition at line 98 of file Mechanics2D.h.

◆ numberInPassport

const size_t VM2D::Mechanics::numberInPassport
protectedinherited

Номер профиля в паспорте

Definition at line 82 of file Mechanics2D.h.

◆ Phi

double VM2D::Mechanics::Phi
inherited

Definition at line 112 of file Mechanics2D.h.

◆ Phi0

double VM2D::Mechanics::Phi0
inherited

Definition at line 106 of file Mechanics2D.h.

◆ PhiOld

double VM2D::Mechanics::PhiOld
inherited

Definition at line 118 of file Mechanics2D.h.

◆ Rcm

Point2D VM2D::Mechanics::Rcm
inherited

Текущие положение профиля

Definition at line 112 of file Mechanics2D.h.

◆ Rcm0

Point2D VM2D::Mechanics::Rcm0
inherited

Начальное положение профиля

Definition at line 106 of file Mechanics2D.h.

◆ RcmOld

Point2D VM2D::Mechanics::RcmOld
inherited

Текущие положение профиля

Definition at line 118 of file Mechanics2D.h.

◆ upperShifts

std::vector<double> VM2D::MechanicsDeformable::upperShifts

Definition at line 181 of file Mechanics2DDeformable.h.

◆ Vcm

Point2D VM2D::Mechanics::Vcm
inherited

Текущие скорость центра и угловая скорость

Definition at line 109 of file Mechanics2D.h.

◆ Vcm0

Point2D VM2D::Mechanics::Vcm0
inherited

Начальная скорость центра и угловая скорость

Definition at line 103 of file Mechanics2D.h.

◆ VcmOld

Point2D VM2D::Mechanics::VcmOld
inherited

Скорость и отклонение с предыдущего шага

Definition at line 115 of file Mechanics2D.h.

◆ virtVortParams

const VortexesParams& VM2D::Mechanics::virtVortParams
protectedinherited

Константная ссылка на структуру с параметрами виртуального вихревого слоя для профиля
инициализируется автоматом в конструкторе

Definition at line 95 of file Mechanics2D.h.

◆ viscousForce

Point2D VM2D::Mechanics::viscousForce
inherited

Вектор силы и момент вязкого трения, действующие на профиль

Definition at line 138 of file Mechanics2D.h.

◆ viscousMoment

double VM2D::Mechanics::viscousMoment
inherited

Definition at line 139 of file Mechanics2D.h.

◆ W

const World2D& VM2D::Mechanics::W
protectedinherited

Константная ссылка на решаемую задачу

Definition at line 79 of file Mechanics2D.h.

◆ Wcm

double VM2D::Mechanics::Wcm
inherited

Definition at line 109 of file Mechanics2D.h.

◆ Wcm0

double VM2D::Mechanics::Wcm0
inherited

Definition at line 103 of file Mechanics2D.h.

◆ WcmOld

double VM2D::Mechanics::WcmOld
inherited

Definition at line 115 of file Mechanics2D.h.


The documentation for this class was generated from the following files: