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#include "Gmres2D.h"
54
55using namespace VM2D;
56
63
64
65//Вычисление гидродинамической силы, действующей на профиль
67{
68 W.getTimers().start("Force");
69
70 const double& dt = W.getPassport().timeDiscretizationProperties.dt;
71
72 hydroDynamForce = { 0.0, 0.0 };
73 hydroDynamMoment = 0.0;
74
75 viscousForce = { 0.0, 0.0 };
76 viscousMoment = 0.0;
77
78 Point2D hDFGam = { 0.0, 0.0 }; //гидродинамические силы, обусловленные присоед.завихренностью
79 Point2D hDFdelta = { 0.0, 0.0 }; //гидродинамические силы, обусловленные приростом завихренности
80 Point2D hDFQ = { 0.0, 0.0 }; //гидродинамические силы, обусловленные присоед.источниками
81
82 double hDMGam = 0.0; //гидродинамический момент, обусловленный присоед.завихренностью
83 double hDMdelta = 0.0; //гидродинамический момент, обусловленный приростом завихренности
84 double hDMQ = 0.0; //гидродинамический момент, обусловленный присоед.источниками
85
86
87 for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
88 {
89 /*Point2D*/ Vcm = VeloOfAirfoilRcm(W.getCurrentStep() * dt);
90 /*Point2D*/ VcmOld = VeloOfAirfoilRcm((std::max(W.getCurrentStep(), (size_t)1) - 1) * dt);
91
92 /*double*/ Wcm = AngularVelocityOfAirfoil(W.getCurrentStep() * dt);
93 /*double*/ WcmOld = AngularVelocityOfAirfoil((std::max(W.getCurrentStep(), (size_t)1) - 1) * dt);
94
95 Point2D rK = 0.5 * (afl.getR(i + 1) + afl.getR(i));
96
97 Point2D dr = rK - afl.rcm;
98
99 Point2D velK = { -Wcm * dr[1], Wcm * dr[0] };
100 velK += Vcm;
101
102 double gAtt = Wcm * (dr ^ afl.tau[i]) + (Vcm & afl.tau[i]);
103 double gAttOld = WcmOld * (dr ^ afl.tau[i]) + (VcmOld & afl.tau[i]);
104 double deltaGAtt = gAtt - gAttOld;
105
106 double qAtt = Wcm * (dr ^ afl.nrm[i]) + (Vcm & afl.nrm[i]);
107
109 double deltaK = boundary.sheets.freeVortexSheet(i, 0) * afl.len[i] - afl.gammaThrough[i] + deltaGAtt * afl.len[i];
110
111 /*1*/
112 hDFdelta += deltaK * Point2D({ -dr[1], dr[0] });
113 hDMdelta += 0.5 * deltaK * dr.length2();
114
115 /*2*/
116 hDFGam += 0.25 * (afl.getV(i) + afl.getV(i+1)).kcross() * gAtt * afl.len[i];
117 hDMGam += 0.25 * dr ^ (afl.getV(i) + afl.getV(i + 1)).kcross() * gAtt * afl.len[i];
118
119 /*3*/
120 hDFQ -= 0.25 * (afl.getV(i) + afl.getV(i + 1)) * qAtt * afl.len[i];
121 hDMQ -= 0.25 * dr ^ (afl.getV(i) + afl.getV(i + 1)) * qAtt * afl.len[i];
122 }
123
124 const double rho = W.getPassport().physicalProperties.rho;
125
126 hydroDynamForce = rho * (hDFGam + hDFdelta * (1.0 / dt) + hDFQ);
127 hydroDynamMoment = rho * (hDMGam + hDMdelta / dt + hDMQ);
128
129 if ((W.getPassport().physicalProperties.nu > 0.0) && (W.getCurrentStep() > 0))
130 for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
131 {
132 Point2D rK = 0.5 * (afl.getR(i + 1) + afl.getR(i)) - afl.rcm;
133 viscousForce += rho * (afl.viscousStress[i] * afl.tau[i]);
134 viscousMoment += rho * (afl.viscousStress[i] * afl.tau[i]) & rK;
135 }
136
137 W.getTimers().stop("Force");
138}// GetHydroDynamForce()
139
140
141// Вычисление скорости центра масс
143{
144 if (W.getPassport().physicalProperties.typeAccel.second == 3)
145 {
146 switch ((int)(W.getPassport().physicalProperties.timeAccel))
147 {
148 case 0:
149 return { -1.0, 0.0 };
150 case 1:
151 return { 0.0, -1.0 };
152 case 2:
153 return { 0.0, 0.0 };
154 default:
155 return { 0.0, 0.0 };
156 }
157 }
158
159 return VelocityOfCenterOfMass(currTime);
160}//VeloOfAirfoilRcm(...)
161
162
163// Вычисление положения центра масс
165{
166 return PositionOfCenterOfMass(currTime);
167}//PositionOfAirfoilRcm(...)
168
169// Вычисление угловой скорости профиля вокруг центра масс
171{
172 if (W.getPassport().physicalProperties.typeAccel.second == 3)
173 {
174 switch ((int)(W.getPassport().physicalProperties.timeAccel))
175 {
176 case 0:
177 return 0.0;
178 case 1:
179 return 0.0;
180 case 2:
181 return -1.0;
182 default:
183 return 0.0;
184 }
185 }
186
187 return AngularVelocity(currTime);
188}//AngularVelocityOfAirfoil(...)
189
190 //Вычисление угла поворота профиля
192{
193 return RotationAngle(currTime);
194}//AngleOfAirfoil(...)
195
196
197
198
199
200
201
202// Вычисление скоростей начал панелей
204{
205 Point2D veloRcm = VeloOfAirfoilRcm(currTime);
206 double angVelo = AngularVelocityOfAirfoil(currTime);
207
208 std::vector<Point2D> vel(afl.getNumberOfPanels(), { 0.0, 0.0 });
209 for (size_t i = 0; i < afl.getNumberOfPanels(); ++i)
210 {
211 vel[i][0] = (afl.getR(i) - afl.rcm).kcross()[0] * angVelo;
212 vel[i][1] = (afl.getR(i) - afl.rcm).kcross()[1] * angVelo;
213 vel[i] += veloRcm;
214 }
215
216 afl.setV(vel);
217
218 circulation = 2.0 * afl.area * angVelo;
219 circulationOld = 2.0 * afl.area * WcmOld;
220}//VeloOfAirfoilPanels(...)
221
223{
224 double t = W.getCurrentTime();
226
227 //Point2D airfoilVelo = VeloOfAirfoilRcm(t);
228 Point2D aflRcmOld = afl.rcm;
229 double aflPhiOld = afl.phiAfl;
230 afl.Move(PositionOfAirfoilRcm(t + dt) - aflRcmOld);
231 afl.Rotate(AngleOfAirfoil(t + dt) - aflPhiOld);
232
233 Vcm = VeloOfAirfoilRcm(t + dt);
234 Phi = AngleOfAirfoil(t + dt);
236}//Move()
237
238
240{
241 /*
242 mechParamsParser->get("timeAccel", timeAccel);
243 W.getInfo('i') << "time of accelerated movement: " << "timeAccel = " << timeAccel << std::endl;
244
245 mechParamsParser->get("initPosition", initPosition);
246 W.getInfo('i') << "initial position: " << "initPosition = " << initPosition << std::endl;
247
248 //mechParamsParser->get("targetVelocity", targetVelocity);
249 //W.getInfo('i') << "target Velocity: " << "targetVelocity = " << targetVelocity << std::endl;
250
251 mechParamsParser->get("targetAmplitude", targetAmplitude);
252 W.getInfo('i') << "target Amplitude: " << "targetAmplitude = " << targetAmplitude << std::endl;
253 */
254
255 /*
256 mechParamsParser->get("Comega", Comega);
257
258 W.getInfo('i') << "frequency " << "Comega = " << Comega << std::endl;
259
260 mechParamsParser->get("CA", CA);
261
262 W.getInfo('i') << "Amplitude CA = " << CA << std::endl;
263 */
264}//ReadSpecificParametersFromDictionary()
Заголовочный файл с описанием класса Airfoil.
Заголовочный файл с описанием класса Boundary.
Заголовочный файл с функциями для метода GMRES.
Заголовочный файл с описанием класса 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:301
const double & freeVortexSheet(size_t n, size_t moment) const
Definition Sheet2D.h:100
Класс, опеделяющий текущую решаемую задачу
Definition World2D.h:77
VMlib::TimersGen & getTimers() const
Возврат ссылки на временную статистику выполнения шага расчета по времени
Definition World2D.h:288
const Passport & getPassport() const
Возврат константной ссылки на паспорт
Definition World2D.h:263
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