69Passport::Passport(
VMlib::LogStream& infoStream,
const std::string& _problemName,
const size_t _problemNumber,
const std::string& _filePassport,
const std::string& _mechanics,
const std::string& _defaults,
const std::string& _switchers,
const std::vector<std::string>& vars,
const std::vector<std::string>& paramList)
70:
PassportGen(infoStream, _problemName, _problemNumber, _filePassport, _mechanics, _defaults, _switchers, vars),
79 bool readAll = ((paramList.size() == 1) && (paramList[0] ==
""));
86 fileExistTest(
fileFullName, infoOrEmptyStream,
true, {
"txt",
"TXT"}) &&
93 std::stringstream varsStream(str);
95 std::stringstream mainStream;
98 std::stringstream mechanicsStream;
101 std::stringstream defaultsStream;
104 std::stringstream switchersStream;
108 GetParamsFromParser(mainStream, mechanicsStream, defaultsStream, switchersStream, varsStream, paramList);
120 std::istream& mainStream,
121 std::istream& mechanicsStream,
122 std::istream& defaultStream,
123 std::istream& switcherStream,
124 std::istream& varsStream,
125 const std::vector<std::string> paramList
130 bool readAll = ((paramList.size() == 1) && (paramList[0] ==
""));
131 std::vector<std::string> PR;
132 for (
const auto& s : paramList)
136 auto ifUpdate = [&](
const std::string& checkString) {
return (readAll || std::count(PR.begin(), PR.end(), UP(checkString))); };
142 std::unique_ptr<VMlib::StreamParser> parser;
149 if (ifUpdate(
"vInf") || ifUpdate(
"vRef"))
151 if (ifUpdate(
"vInf"))
160 info(
'e') <<
"Reference velocity should be non-zero!" << std::endl;
171 std::pair<std::pair<std::string, int>, std::string> velAccel;
173 if (velAccel.first.second != -1)
176 std::stringstream sstr(velAccel.second);
177 std::istream& istr(sstr);
179 std::unique_ptr<VMlib::StreamParser> parserAccel;
181 parserAccel.reset(
new VMlib::StreamParser(
info,
"parserAccel", istr, defaultStream, switcherStream, varsStream));
187 info(
'e') <<
"Velocity acceleration scheme <" << velAccel.first.first <<
"> is unknown" << std::endl;
192 if (!defParamAccelVel)
196 double tempTimeAccel;
199 info(
'e') <<
"timeAccel parameter is set twice!" << std::endl;
212 if (ifUpdate(
"timeStop"))
218 if (ifUpdate(
"nameLength"))
223 if (ifUpdate(
"saveVtx"))
225 std::pair<std::pair<std::string, int>, std::string> saveVtx;
227 if (saveVtx.first.second != -1)
230 std::stringstream sstr(saveVtx.second);
231 std::istream& istr(sstr);
233 std::unique_ptr<VMlib::StreamParser> parserSaveVtx;
235 parserSaveVtx.reset(
new VMlib::StreamParser(
info,
"parserSaveVtx", istr, defaultStream, switcherStream, varsStream));
240 std::stringstream ss;
241 ss << saveVtx.first.first;
251 info(
'e') <<
"Vtx file type <" << saveVtx.first.first <<
"> is unknown" << std::endl;
258 if (ifUpdate(
"saveVP"))
260 std::pair<std::pair<std::string, int>, std::string> saveVP;
262 if (saveVP.first.second != -1)
265 std::stringstream sstr(saveVP.second);
266 std::istream& istr(sstr);
268 std::unique_ptr<VMlib::StreamParser> parserSaveVP;
270 parserSaveVP.reset(
new VMlib::StreamParser(
info,
"parserSaveVP", istr, defaultStream, switcherStream, varsStream));
275 std::stringstream ss;
276 ss << saveVP.first.first;
286 info(
'e') <<
"VP file type <" << saveVP.first.first <<
"> is unknown" << std::endl;
297 const std::vector<std::string> varParams = { UP(
"nameLength"), UP(
"timeStop"), UP(
"dt"), UP(
"vInf"), UP(
"vRef"), UP(
"coefEpsAst"), UP(
"saveVtx"), UP(
"saveVP")};
299 if (std::count(varParams.begin(), varParams.end(), UP(s)) == 0)
301 info(
'e') <<
"Parameter \"" << s <<
"\" can not be changable (i.e., re-readable)!" << std::endl;
319 info(
'e') <<
"Rename 'eps' parameter in passport file: 'eps' -> 'sigma0'" << std::endl;
337 if (ifUpdate(
"coefEpsAst"))
349 parser->get(
"fastGmresMultipoleOrder",
numericalSchemes.gmresMultipoleOrder);
384 std::vector<std::string> airfoil;
388 size_t nAirfoil = airfoil.size();
390 for (
size_t i = 0; i < nAirfoil; ++i)
404 std::unique_ptr<VMlib::StreamParser> parserAirfoil;
406 parserAirfoil.reset(
new VMlib::StreamParser(
info,
"airfoil parser", aflStream, defaultStream, switcherStream, varsStream));
415 parserAirfoil->get(
"scale", tmpScale, &defaultTmpScale);
416 switch (tmpScale.size())
422 prm.
scale[0] = tmpScale[0];
423 prm.
scale[1] = tmpScale[1];
426 info(
'e') <<
"Error in _scale_ value for airfoil" << std::endl;
450 std::unique_ptr<VMlib::StreamParser> parserMechanicsList;
451 std::unique_ptr<VMlib::StreamParser> parserSwitchers;
455 std::string mechString;
462 std::string mechTypeAlias = mechanicsLine.first;
483 const std::vector<std::string> paramList
488 bool readAll = ((paramList.size() == 1) && (paramList[0] ==
""));
489 std::vector<std::string> PR;
490 for (
const auto& s : paramList)
494 auto ifUpdate = [&](
const std::string& checkString) {
return (readAll || std::count(PR.begin(), PR.end(), UP(checkString))); };
539 if (ifUpdate(
"saveVtx") &&
548 if (ifUpdate(
"saveVP") &&
565 const std::string str =
"passport info: ";
567 info(
'i') <<
"--- Passport info ---" << std::endl;
582 info(
'-') <<
"reviseParameters = {";
584 info(
'-') << s <<
"";
585 info(
'-') <<
"}" << std::endl;
608 info(
'-') <<
"velocityComputation = " <<
numericalSchemes.velocityComputation.first << std::endl;
632 info(
'_') <<
"airfoil[" << q <<
"]_file = " <<
airfoilParams[q].fileAirfoil << std::endl;
633 info(
'_') <<
"airfoil[" << q <<
"]_requiredNPanels = " <<
airfoilParams[q].requiredNPanels << std::endl;
634 info(
'_') <<
"airfoil[" << q <<
"]_basePoint = " <<
airfoilParams[q].basePoint << std::endl;
635 info(
'_') <<
"airfoil[" << q <<
"]_scale = " <<
airfoilParams[q].scale << std::endl;
636 info(
'_') <<
"airfoil[" << q <<
"]_angle = " <<
airfoilParams[q].angle << std::endl;
637 info(
'_') <<
"airfoil[" << q <<
"]_chord = " <<
airfoilParams[q].chord << std::endl;
638 info(
'_') <<
"airfoil[" << q <<
"]_inverse = " << (
airfoilParams[q].inverse ?
"true":
"false") << std::endl;
639 info(
'_') <<
"airfoil[" << q <<
"]_mechanicalSystem = " <<
airfoilParams[q].mechanicalSystem << std::endl;
640 info(
'_') <<
"airfoil[" << q <<
"]_addedMass = " <<
airfoilParams[q].addedMass << std::endl;
Заголовочный файл с описанием класса Passport (двумерный) и cоответствующими структурами
Заголовочный файл с описанием класса Preprocessor.
Заголовочный файл с описанием класса StreamParser.
bool rotateForces
Признак работы в "географической" системе координат
std::string wakesDir
Каталог с файлами вихревых следов
PhysicalProperties physicalProperties
Структура с физическими свойствами задачи
std::string defaultsFileFullName
bool calcCoefficients
Признак вычисления коэффициентов вместо сил
double rotateAngleVpPoints
Угол поворота точек VP.
WakeDiscretizationProperties wakeDiscretizationProperties
Структура с параметрами дискретизации вихревого следа
std::vector< std::string > varLine
std::string airfoilsDir
Каталог с файлами профилей
virtual void GetParamsFromParser(std::istream &mainStream, std::istream &mechanicsStream, std::istream &defaultStream, std::istream &switcherStream, std::istream &varsStream, const std::vector< std::string > paramList) override
Считывание всех параметров расчета из соответствующих потоков
virtual void PrintAllParams() override
Печать всех параметров расчета в поток логов
std::vector< AirfoilParams > airfoilParams
Список структур с параметрами профилей
std::string switchersFileFullName
std::string mechanicsFileFullName
std::string fileFullName
Имена файлов
void GetReviseParamsFromParser(const Passport &newPassport, const std::vector< std::string > paramList)
Считывание измененных параметров
Passport(VMlib::LogStream &infoStream, const std::string &_problemName, const size_t _problemNumber, const std::string &_filePassport, const std::string &_mechanics, const std::string &_defaults, const std::string &_switchers, const std::vector< std::string > &vars, const std::vector< std::string > ¶mList)
Конструктор
NumericalSchemes numericalSchemes
Структура с используемыми численными схемами
Класс, определяющий работу с потоком логов
TimeDiscretizationProperties timeDiscretizationProperties
Структура с параметрами процесса интегрирования по времени
LogStream info
Поток для вывода логов и сообщений об ошибках
PassportGen(LogStream &infoStream, const std::string &_problemName, const size_t _problemNumber, const std::string &_filePassport, const std::string &_mechanics, const std::string &_defaults, const std::string &_switchers, const std::vector< std::string > &vars)
Конструктор
Класс, позволяющий выполнять предварительную обработку файлов
std::string resultString
Строка, содержащая окончательный результат обработки файла
Класс, позволяющий выполнять разбор файлов и строк с настройками и параметрами
static std::vector< std::string > StringToVector(std::string line, char openBracket='(', char closeBracket=')')
Pазбор строки, содержащей запятые, на отдельные строки
static std::pair< std::string, std::string > SplitString(LogStream &info, std::string line, bool upcase=true)
Разбор строки на пару ключ-значение
static std::string VectorStringToString(const std::vector< std::string > &_vecString)
Объединение вектора (списка) из строк в одну строку
static std::string UpperCase(const std::string &line)
Перевод строки в верхний регистр
const int defaultRevisePassportStep
Шаг обновления паспорта и перечень перечитываемых параметров
const VMlib::Point2D defaultBasePoint
Базовое смещение профиля
const double defaultDistFar
Радиус убивания дальнего следа
const bool defaultCalcCoefficients
Признак расчета безразмерных коэффициентов вместо сил
const std::string defaultWakesDir
Каталог с файлами вихревых следов
const int defaultSaveVisStress
Шаг подсчета поля скорости и давления
const size_t defaultRequiredNPanels
Желаемое число панелей для разбиения геометрии
const double defaultVRef
Референсная скорость, равная нулю, что означает ее равенство скорости набегающего потока
const Point2D defaultScale
Коэффициент масштабирования профиля
const double defaultDelta
Расстояние, на которое рождаемый вихрь отодвигается от профиля
const bool defaultRotateForces
Признак работы в "географической" системе координат
const Point2D defaultAddedMass
Присоединенная масса
const bool defaultInverse
Признак разворота нормалей (для расчета внутреннего течения).
const int defaultSaveVPstep
const double defaultEpsCol
Радиус вихря по умолчанию
const double defaultTimeAccel
const double defaultChord
Хорда
const std::pair< std::string, int > defaultVelocityComputation
Способ вычисления скоростей вихрей
const std::string defaultFileSource("")
Файл с источниками
const std::vector< std::string > defaultAirfoil({})
Список профилей
const double defaultAngle
Угол атаки
const double defaultMaxGamma
Число вихрей, рождаемых на одной панели
const int defaultVortexPerPanel
Число вихрей, рождаемых на одной панели
const int defaultNameLength
Число разрядов в имени файла
const double rotateAngleVpPoints
Угол поворота точек VP.
const std::string defaultAirfoilsDir
Каталог с файлами профилей
const std::pair< std::pair< std::string, int >, std::string > defaultSaveVtx
Шаг подсчета поля скорости и давления
const std::pair< std::pair< std::string, int >, std::string > defaultVelAccel
Время разгона
const double defaultTimeStart
Начало расчета
const std::string defaultMechanicalSystem
const std::vector< std::string > defaultReviseParameters
const int defaultSaveVtxStep
const double defaultCoefEpsAst
Коэффициент при вычислении eps_ast по умолчанию
const std::pair< std::string, int > defaultBoundaryCondition
Способ удовлетворения граничного условия
const std::pair< std::string, int > defaultLinearSystemSolver
Способ решения линейной системы
const double defaultSigma0
Радиус вихря по умолчанию
const std::pair< std::pair< std::string, int >, std::string > defaultSaveVP
Шаг подсчета поля скорости и давления
const std::string defaultFileWake("")
Файл со следом
Структура, задающая параметры профиля
Point2D addedMass
Присоединенная масса
std::string mechanicalSystem
Point2D basePoint
Смещение центра масс (перенос профиля).
int mechanicalSystemType
Тип механической системы
std::string fileAirfoil
Имя файла с начальным состоянием профилей (без полного пути).
double angle
Угол поворота (угол атаки).
std::string mechanicalSystemParameters
Point2D scale
Коэффициент масштабирования
size_t requiredNPanels
Желаемое число панелей для разбиения геометрии
bool inverse
Признак разворота нормалей (для расчета внутреннего течения).
std::pair< std::string, int > typeAccel
Способ разгона потока
double accelCft(double currentTime) const
Функция-множитель, позволяющая моделировать разгон
double vRef
Референсная скорость
double timeAccel
Время разгона потока
Point2D vInf
Скоростью набегающего потока
double coefEpsAst
Коэффициент для вычислекния eps_ast.
std::pair< std::string, int > fileTypeVtx
Тип файлов для сохранения скорости и давления
int saveVPstep
Шаг вычисления и сохранения скорости и давления
int saveVtxStep
Шаг сохранения кадров в бинарные файлы
int nameLength
Число разрядов в имени файла
double timeStop
Конечное время
std::pair< std::string, int > fileTypeVP
Тип файлов для сохранения скорости и давления