VM2D 1.14
Vortex methods for 2D flows simulation
Loading...
Searching...
No Matches
Mechanics2DRigidGivenLaw.cpp
Go to the documentation of this file.
1/*--------------------------------*- VM2D -*-----------------*---------------*\
2| ## ## ## ## #### ##### | | Version 1.14 |
3| ## ## ### ### ## ## ## ## | VM2D: Vortex Method | 2026/03/06 |
4| ## ## ## # ## ## ## ## | for 2D Flow Simulation *----------------*
5| #### ## ## ## ## ## | Open Source Code |
6| ## ## ## ###### ##### | https://www.github.com/vortexmethods/VM2D |
7| |
8| Copyright (C) 2017-2026 I. Marchevsky, K. Sokol, E. Ryatina, A. Kolganova |
9*-----------------------------------------------------------------------------*
10| File name: Mechanics2DRigidGivenLaw.cpp |
11| Info: Source code of VM2D |
12| |
13| This file is part of VM2D. |
14| VM2D is free software: you can redistribute it and/or modify it |
15| under the terms of the GNU General Public License as published by |
16| the Free Software Foundation, either version 3 of the License, or |
17| (at your option) any later version. |
18| |
19| VM2D is distributed in the hope that it will be useful, but WITHOUT |
20| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
21| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
22| for more details. |
23| |
24| You should have received a copy of the GNU General Public License |
25| along with VM2D. If not, see <http://www.gnu.org/licenses/>. |
26\*---------------------------------------------------------------------------*/
27
28
40#include <algorithm>
41
43
44#include "Airfoil2D.h"
45#include "Boundary2D.h"
46
47
48#include "MeasureVP2D.h"
49#include "StreamParser.h"
50#include "Velocity2D.h"
51#include "Wake2D.h"
52#include "World2D.h"
53
54using namespace VM2D;
55
62
63
64//Вычисление гидродинамической силы, действующей на профиль
66{
67 W.getTimers().start("Force");
68
69 const double& dt = W.getPassport().timeDiscretizationProperties.dt;
70
71 hydroDynamForce = { 0.0, 0.0 };
72 hydroDynamMoment = 0.0;
73
74 viscousForce = { 0.0, 0.0 };
75 viscousMoment = 0.0;
76
77 Point2D hDFGam = { 0.0, 0.0 }; //гидродинамические силы, обусловленные присоед.завихренностью
78 Point2D hDFdelta = { 0.0, 0.0 }; //гидродинамические силы, обусловленные приростом завихренности
79 Point2D hDFQ = { 0.0, 0.0 }; //гидродинамические силы, обусловленные присоед.источниками
80
81 double hDMGam = 0.0; //гидродинамический момент, обусловленный присоед.завихренностью
82 double hDMdelta = 0.0; //гидродинамический момент, обусловленный приростом завихренности
83 double hDMQ = 0.0; //гидродинамический момент, обусловленный присоед.источниками
84
85
86 for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
87 {
88 /*Point2D*/ Vcm = VeloOfAirfoilRcm(W.getCurrentStep() * dt);
89 /*Point2D*/ VcmOld = VeloOfAirfoilRcm((std::max(W.getCurrentStep(), (size_t)1) - 1) * dt);
90
91 /*double*/ Wcm = AngularVelocityOfAirfoil(W.getCurrentStep() * dt);
92 /*double*/ WcmOld = AngularVelocityOfAirfoil((std::max(W.getCurrentStep(), (size_t)1) - 1) * dt);
93
94 Point2D rK = 0.5 * (afl.getR(i + 1) + afl.getR(i));
95
96 Point2D dr = rK - afl.rcm;
97
98 Point2D velK = { -Wcm * dr[1], Wcm * dr[0] };
99 velK += Vcm;
100
101 double gAtt = Wcm * (dr ^ afl.tau[i]) + (Vcm & afl.tau[i]);
102 double gAttOld = WcmOld * (dr ^ afl.tau[i]) + (VcmOld & afl.tau[i]);
103 double deltaGAtt = gAtt - gAttOld;
104
105 double qAtt = Wcm * (dr ^ afl.nrm[i]) + (Vcm & afl.nrm[i]);
106
108 double deltaK = boundary.sheets.freeVortexSheet(i, 0) * afl.len[i] - afl.gammaThrough[i] + deltaGAtt * afl.len[i];
109
110 /*1*/
111 hDFdelta += deltaK * Point2D({ -dr[1], dr[0] });
112 hDMdelta += 0.5 * deltaK * dr.length2();
113
114 /*2*/
115 hDFGam += 0.25 * (afl.getV(i) + afl.getV(i+1)).kcross() * gAtt * afl.len[i];
116 hDMGam += 0.25 * dr ^ (afl.getV(i) + afl.getV(i + 1)).kcross() * gAtt * afl.len[i];
117
118 /*3*/
119 hDFQ -= 0.25 * (afl.getV(i) + afl.getV(i + 1)) * qAtt * afl.len[i];
120 hDMQ -= 0.25 * dr ^ (afl.getV(i) + afl.getV(i + 1)) * qAtt * afl.len[i];
121 }
122
123 const double rho = W.getPassport().physicalProperties.rho;
124
125 hydroDynamForce = rho * (hDFGam + hDFdelta * (1.0 / dt) + hDFQ);
126 hydroDynamMoment = rho * (hDMGam + hDMdelta / dt + hDMQ);
127
128 if ((W.getPassport().physicalProperties.nu > 0.0) && (W.getCurrentStep() > 0))
129 for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
130 {
131 Point2D rK = 0.5 * (afl.getR(i + 1) + afl.getR(i)) - afl.rcm;
132 viscousForce += rho * (afl.viscousStress[i] * afl.tau[i]);
133 viscousMoment += rho * (afl.viscousStress[i] * afl.tau[i]) & rK;
134 }
135
136 W.getTimers().stop("Force");
137}// GetHydroDynamForce()
138
139
140// Вычисление скорости центра масс
142{
143 if (W.getPassport().physicalProperties.typeAccel.second == 3)
144 {
145 switch ((int)(W.getPassport().physicalProperties.timeAccel))
146 {
147 case 0:
148 return { -1.0, 0.0 };
149 case 1:
150 return { 0.0, -1.0 };
151 case 2:
152 return { 0.0, 0.0 };
153 default:
154 return { 0.0, 0.0 };
155 }
156 }
157
158 return VelocityOfCenterOfMass(currTime);
159}//VeloOfAirfoilRcm(...)
160
161
162// Вычисление положения центра масс
164{
165 return PositionOfCenterOfMass(currTime);
166}//PositionOfAirfoilRcm(...)
167
168// Вычисление угловой скорости профиля вокруг центра масс
170{
171 if (W.getPassport().physicalProperties.typeAccel.second == 3)
172 {
173 switch ((int)(W.getPassport().physicalProperties.timeAccel))
174 {
175 case 0:
176 return 0.0;
177 case 1:
178 return 0.0;
179 case 2:
180 return -1.0;
181 default:
182 return 0.0;
183 }
184 }
185
186 return AngularVelocity(currTime);
187}//AngularVelocityOfAirfoil(...)
188
189 //Вычисление угла поворота профиля
191{
192 return RotationAngle(currTime);
193}//AngleOfAirfoil(...)
194
195
196
197
198
199
200
201// Вычисление скоростей начал панелей
203{
204 Point2D veloRcm = VeloOfAirfoilRcm(currTime);
205 double angVelo = AngularVelocityOfAirfoil(currTime);
206
207 std::vector<Point2D> vel(afl.getNumberOfPanels(), { 0.0, 0.0 });
208 for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
209 {
210 vel[i][0] = (afl.getR(i) - afl.rcm).kcross()[0] * angVelo;
211 vel[i][1] = (afl.getR(i) - afl.rcm).kcross()[1] * angVelo;
212 vel[i] += veloRcm;
213 }
214
215 afl.setV(vel);
216
217 circulation = 2.0 * afl.area * angVelo;
218 circulationOld = 2.0 * afl.area * WcmOld;
219}//VeloOfAirfoilPanels(...)
220
222{
223 double t = W.getCurrentTime();
225
226 //Point2D airfoilVelo = VeloOfAirfoilRcm(t);
227 Point2D aflRcmOld = afl.rcm;
228 double aflPhiOld = afl.phiAfl;
229 afl.Move(PositionOfAirfoilRcm(t + dt) - aflRcmOld);
230 afl.Rotate(AngleOfAirfoil(t + dt) - aflPhiOld);
231
232 Vcm = VeloOfAirfoilRcm(t + dt);
233 Phi = AngleOfAirfoil(t + dt);
235}//Move()
236
237
239{
240 /*
241 mechParamsParser->get("timeAccel", timeAccel);
242 W.getInfo('i') << "time of accelerated movement: " << "timeAccel = " << timeAccel << std::endl;
243
244 mechParamsParser->get("initPosition", initPosition);
245 W.getInfo('i') << "initial position: " << "initPosition = " << initPosition << std::endl;
246
247 //mechParamsParser->get("targetVelocity", targetVelocity);
248 //W.getInfo('i') << "target Velocity: " << "targetVelocity = " << targetVelocity << std::endl;
249
250 mechParamsParser->get("targetAmplitude", targetAmplitude);
251 W.getInfo('i') << "target Amplitude: " << "targetAmplitude = " << targetAmplitude << std::endl;
252 */
253
254 /*
255 mechParamsParser->get("Comega", Comega);
256
257 W.getInfo('i') << "frequency " << "Comega = " << Comega << std::endl;
258
259 mechParamsParser->get("CA", CA);
260
261 W.getInfo('i') << "Amplitude CA = " << CA << std::endl;
262 */
263}//ReadSpecificParametersFromDictionary()
Заголовочный файл с описанием класса Airfoil.
Заголовочный файл с описанием класса Boundary.
Заголовочный файл с описанием класса MeasureVP.
Заголовочный файл с описанием класса MechanicsRigidGivenLaw.
Заголовочный файл с описанием класса StreamParser.
Заголовочный файл с описанием класса Velocity.
Заголовочный файл с описанием класса Wake.
Заголовочный файл с описанием класса World2D.
double phiAfl
Поворот профиля
Definition Airfoil2D.h:100
std::vector< double > len
Длины панелей профиля
Definition Airfoil2D.h:94
void setV(const Point2D &vel)
Установка постоянной скорости всех вершин профиля
Definition Airfoil2D.h:145
const Point2D & getR(size_t q) const
Возврат константной ссылки на вершину профиля
Definition Airfoil2D.h:113
double area
Площадь профиля
Definition Airfoil2D.h:103
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
Point2D rcm
Положение центра масс профиля
Definition Airfoil2D.h:97
size_t getNumberOfPanels() const
Возврат количества панелей на профиле
Definition Airfoil2D.h:163
std::vector< double > gammaThrough
Суммарные циркуляции вихрей, пересекших панели профиля на прошлом шаге
Definition Airfoil2D.h:276
virtual void Move(const Point2D &dr)
Перемещение профиля
std::vector< double > viscousStress
Нейросеть для коэффициентов I0 и I3 диффузионной скорости
Definition Airfoil2D.h:268
virtual void Rotate(double alpha)
Поворот профиля
Sheet sheets
Слои на профиле
Definition Boundary2D.h:96
Абстрактный класс, определяющий вид механической системы
Definition Mechanics2D.h:72
Point2D hydroDynamForce
Вектор гидродинамической силы и момент, действующие на профиль
Point2D VcmOld
Скорость и отклонение с предыдущего шага
const World2D & W
Константная ссылка на решаемую задачу
Definition Mechanics2D.h:79
void Initialize(Point2D Vcm0_, Point2D Rcm0_, double Wcm0_, double Phi0_)
Задание начального положения и начальной скорости
Point2D viscousForce
Вектор силы и момент вязкого трения, действующие на профиль
double circulationOld
Циркуляция скорости по границе профиля с предыдущего шага
double hydroDynamMoment
Airfoil & afl
Definition Mechanics2D.h:87
Point2D Vcm
Текущие скорость центра и угловая скорость
double circulation
Текущая циркуляция скорости по границе профиля
const Boundary & boundary
Definition Mechanics2D.h:91
std::function< Point2D(double)> PositionOfCenterOfMass
std::function< double(double)> AngularVelocity
virtual void GetHydroDynamForce() override
Вычисление гидродинамической силы, действующей на профиль
virtual Point2D VeloOfAirfoilRcm(double currTime) override
Вычисление скорости центра масс профиля
std::function< double(double)> RotationAngle
virtual Point2D PositionOfAirfoilRcm(double currTime) override
Вычисление положения центра масс профиля
virtual void Move() override
Перемещение профиля в соответствии с законом
virtual double AngularVelocityOfAirfoil(double currTime) override
Вычисление угловой скорости профиля
virtual void VeloOfAirfoilPanels(double currTime) override
Вычисление скоростей начал панелей
std::function< Point2D(double)> VelocityOfCenterOfMass
MechanicsRigidGivenLaw(const World2D &W_, size_t numberInPassport_)
Конструктор
virtual double AngleOfAirfoil(double currTime) override
Вычисление угла поворота профиля
virtual void ReadSpecificParametersFromDictionary() override
Чтение параметров конкретной механической системы
PhysicalProperties physicalProperties
Структура с физическими свойствами задачи
Definition Passport2D.h:289
const double & freeVortexSheet(size_t n, size_t moment) const
Definition Sheet2D.h:100
Класс, опеделяющий текущую решаемую задачу
Definition World2D.h:74
VMlib::TimersGen & getTimers() const
Возврат ссылки на временную статистику выполнения шага расчета по времени
Definition World2D.h:276
const Passport & getPassport() const
Возврат константной ссылки на паспорт
Definition World2D.h:251
TimeDiscretizationProperties timeDiscretizationProperties
Структура с параметрами процесса интегрирования по времени
void stop(const std::string &timerLabel)
Останов счетчика
Definition TimesGen.cpp:68
void start(const std::string &timerLabel)
Запуск счетчика
Definition TimesGen.cpp:55
double getCurrentTime() const
Definition WorldGen.h:100
size_t getCurrentStep() const
Возврат константной ссылки на параметры распараллеливания по MPI.
Definition WorldGen.h:99
auto length2() const -> typename std::remove_const< typename std::remove_reference< decltype(this->data[0])>::type >::type
Вычисление квадрата нормы (длины) вектора
Definition numvector.h:386
std::pair< std::string, int > typeAccel
Способ разгона потока
Definition Passport2D.h:84
double nu
Коэффициент кинематической вязкости среды
Definition Passport2D.h:99
double timeAccel
Время разгона потока
Definition Passport2D.h:87
double rho
Плотность потока
Definition Passport2D.h:75
double dt
Шаг по времени
Definition PassportGen.h:67