1、初始化部分生成json文件

2、json文件中部分内容进行修改
feature/struct-menu-20241023
mzh 3 days ago
parent e563336453
commit 4dbce6b894

@ -29,9 +29,11 @@ CUIConfig *CFDStructDataSolverBasicModelManager::getParamUIConfig() {
void CFDStructDataSolverBasicModelManager::saveDataToDom(rapidjson::Document &dom) { void CFDStructDataSolverBasicModelManager::saveDataToDom(rapidjson::Document &dom) {
jsonAdd(dom, m_FlowModel, {"region", 0, "flowType"}); jsonAdd(dom, m_FlowModel, {"region", 0, "flowType"});
jsonAdd(dom, m_OverlayNetwork, {"region", 0, "chimeraMesh"}); jsonAdd(dom, m_OverlayNetwork, {"region", 0, "chimeraMesh"});
jsonAdd(dom, m_Rgasmean, {"region", 0, "refValue", "rgas_mean"}); jsonAdd(dom, m_Rgasmean, {"region", 0, "rgas_mean"});
jsonAdd(dom, m_Gmean, {"region", 0, "refValue", "gamma"}); jsonAdd(dom, m_Gmean, {"region", 0, "gamma"});
jsonAdd(dom, m_Prlmean, {"region", 0, "solver", "turbModel", "RANS", "params", "Prl"}); jsonAdd(dom, m_Prlmean, {"region", 0, "solver", "turbModel", "RANS", "params", "Prl"});
jsonAdd(dom, m_Prlmean, {"region", 0, "solver", "turbModel", "params", "Prl"});
jsonAdd(dom, m_Prtmean, {"region", 0, "solver", "turbModel", "RANS", "params", "Prt"}); jsonAdd(dom, m_Prtmean, {"region", 0, "solver", "turbModel", "RANS", "params", "Prt"});
} }
@ -45,11 +47,11 @@ void CFDStructDataSolverBasicModelManager::readDataFromDom(rapidjson::Document &
if (temp != QVariant()) { if (temp != QVariant()) {
m_OverlayNetwork = temp.toInt(); m_OverlayNetwork = temp.toInt();
} }
jsonRead(dom, temp, {"region", 0, "refValue", "rgas_mean"}); jsonRead(dom, temp, {"region", 0, "rgas_mean"});
if (temp != QVariant()) { if (temp != QVariant()) {
m_Rgasmean = temp.toDouble(); m_Rgasmean = temp.toDouble();
} }
jsonRead(dom, temp, {"region", 0, "refValue", "gamma"}); jsonRead(dom, temp, {"region", 0, "gamma"});
if (temp != QVariant()) { if (temp != QVariant()) {
m_Gmean = temp.toDouble(); m_Gmean = temp.toDouble();
} }

@ -47,10 +47,10 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverBasicModelManager : public
double m_Gmean = 0; double m_Gmean = 0;
// 层流普朗特数 // 层流普朗特数
double m_Prlmean = 0; double m_Prlmean = 0.72;
// 湍流普朗特数 // 湍流普朗特数
double m_Prtmean = 0; double m_Prtmean = 0.9;
CUIConfig *m_uiConfig = nullptr; CUIConfig *m_uiConfig = nullptr;
}; };

@ -73,7 +73,8 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverBoundaryConditionManager :
int m_id = 0; int m_id = 0;
// 边界名称 // 边界名称
QString m_BoundaryName = ""; // Boundary Name // 翻译器不接受名字为空
QString m_BoundaryName = "1"; // Boundary Name
// 所属计算域 // 所属计算域
QString m_ComputationalDomain = ""; // Computational Domain QString m_ComputationalDomain = ""; // Computational Domain

@ -31,6 +31,52 @@ CUIConfig *CFDStructDataSolverInitializationManager::getParamUIConfig() {
void CFDStructDataSolverInitializationManager::saveDataToDom(rapidjson::Document &dom) { void CFDStructDataSolverInitializationManager::saveDataToDom(rapidjson::Document &dom) {
// TODO // TODO
// 温度
jsonAdd(dom, 0,
{"region", 0, "initialize", "global", "temp"});
jsonAdd(dom, m_Pressure,
{"region", 0, "initialize", "global", "Press"});
{ // TODO计算得出---------------------------------
// x方向速度
jsonAdd(dom, m_Vx,
{"region", 0, "initialize", "global", "UVer"});
// y方向速度
jsonAdd(dom, m_Vy,
{"region", 0, "initialize", "global", "vVer"});
// z方向速度
jsonAdd(dom, m_Vz,
{"region", 0, "initialize", "global", "wVer"});
// 界面给出
// x方向速度
jsonAdd(dom, m_Vx,
{"region", 0, "initialize", "global", "InDirect", 0});
// y方向速度
jsonAdd(dom, m_Vy,
{"region", 0, "initialize", "global", "InDirect", 1});
// z方向速度
jsonAdd(dom, m_Vz,
{"region", 0, "initialize", "global", "InDirect", 2});
}
// 函数名
jsonAdd(dom, "",
{"region", 0, "initialize", "global", "strFunName"});
// 用户自定义
jsonAdd(dom, 0,
{"region", 0, "initialize", "global", "isUser"});
// 用户文件
jsonAdd(dom, "",
{"region", 0, "initialize", "global", "strUserFile"});
// 用户lua文件函数名
jsonAdd(dom, "",
{"region", 0, "initialize", "global", "funName"});
//
jsonAdd(dom, m_ReferenceValuesFrom,
{"region", 0, "initialize", "global", "ComeId"});
// 静温度
jsonAdd(dom, 0,
{"region", 0, "initialize", "global", "StaticTemper"});
} }
void CFDStructDataSolverInitializationManager::readDataFromDom(rapidjson::Document &dom) { void CFDStructDataSolverInitializationManager::readDataFromDom(rapidjson::Document &dom) {
@ -81,13 +127,13 @@ CUIConfig *CFDStructDataSolverInitializationManager::genCylindricalUIConfig() {
{"type", "LineEdit"}, // 展向速度vr {"type", "LineEdit"}, // 展向速度vr
{"name", tr("Vr")}, {"name", tr("Vr")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE}, {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
{"value_origin", QVA_GLOBAL(&m_Vr)}, {"value_origin", QVA_GLOBAL(&m_Vx)},
}), }),
new CUIConfig({ new CUIConfig({
{"type", "LineEdit"}, // 周向速度Vtheta {"type", "LineEdit"}, // 周向速度Vtheta
{"name", tr("Vtheta")}, {"name", tr("Vtheta")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE}, {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
{"value_origin", QVA_GLOBAL(&m_Vtheta)}, {"value_origin", QVA_GLOBAL(&m_Vy)},
}), }),
new CUIConfig({ new CUIConfig({
{"type", "LineEdit"}, // 轴向速度Vz {"type", "LineEdit"}, // 轴向速度Vz

@ -4,71 +4,57 @@
#ifndef CFDSTRUCTDATASOLVERINITIALIZATIONEMANAGER_H #ifndef CFDSTRUCTDATASOLVERINITIALIZATIONEMANAGER_H
#define CFDSTRUCTDATASOLVERINITIALIZATIONEMANAGER_H #define CFDSTRUCTDATASOLVERINITIALIZATIONEMANAGER_H
#include <CFDStructDataManagerBase.h>
#include "CFDStructDataManager_global.h" #include "CFDStructDataManager_global.h"
#include <CFDStructDataManagerBase.h>
class CUIConfig; class CUIConfig;
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverInitializationManager : public CFDStructDataManagerBase { class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverInitializationManager : public CFDStructDataManagerBase {
Q_OBJECT Q_OBJECT
public: public:
explicit CFDStructDataSolverInitializationManager(QObject* parent = nullptr); explicit CFDStructDataSolverInitializationManager(QObject *parent = nullptr);
~CFDStructDataSolverInitializationManager(); ~CFDStructDataSolverInitializationManager();
CUIConfig* getParamUIConfig(); CUIConfig *getParamUIConfig();
void saveDataToDom(rapidjson::Document& dom); void saveDataToDom(rapidjson::Document &dom);
void readDataFromDom(rapidjson::Document& dom); void readDataFromDom(rapidjson::Document &dom);
private: private:
// 生成界面配置 柱坐标系 // 生成界面配置 柱坐标系
CUIConfig* genCylindricalUIConfig(); CUIConfig *genCylindricalUIConfig();
// 生成界面配置 笛卡尔坐标系 // 生成界面配置 笛卡尔坐标系
CUIConfig* genCartesianUIConfig(); CUIConfig *genCartesianUIConfig();
signals: signals:
private: private:
// 参考值取自 // 参考值取自
int m_ReferenceValuesFrom = 0; // Reference Values From int m_ReferenceValuesFrom = 0; // Reference Values From
//坐标系 // 坐标系
int m_CoordinateSystem = 0; int m_CoordinateSystem = 0;
// 密度 // 密度
double m_Density; // Density double m_Density = 0; // Density
// // μ速度
// double m_MuVelocity; // Mu Velocity
// // v速度
// double m_VVelocity; // V Velocity
// // w速度
// double m_WVelocity; // W Velocity
// 压强 // 压强
double m_Pressure; // Pressure double m_Pressure = 0; // Pressure
// 湍流粘性比 // 湍流粘性比
double m_TurbulentViscosityRatio; // Turbulent Viscosity Ratio double m_TurbulentViscosityRatio = 0; // Turbulent Viscosity Ratio
// 湍流强度 // 湍流强度
double m_TurbulentIntensity; // Turbulent Intensity double m_TurbulentIntensity = 0; // Turbulent Intensity
//展向速度vr
double m_Vr = 0;
//周向速度Vtheta // 笛卡尔坐标系,三轴方向速度
double m_Vtheta = 0; // 展向速度vr
// x方向速度
// 轴向速度Vz
double m_Vz = 0;
//笛卡尔坐标系,三轴方向速度
double m_Vx = 0; double m_Vx = 0;
// 周向速度Vtheta
// y方向速度
double m_Vy = 0; double m_Vy = 0;
// double m_Vz = 0; // 轴向速度Vz
// z方向速度
double m_Vz = 0;
}; };
#endif // CFDSTRUCTDATASOLVERINITIALIZATIONEMANAGER_H #endif // CFDSTRUCTDATASOLVERINITIALIZATIONEMANAGER_H

@ -67,8 +67,14 @@ void CFDStructDataSolverNumericalMethodManager::saveDataToDom(rapidjson::Documen
{"region", 0, "numericMethod", "numMethodParm", "fineGridNum"}); {"region", 0, "numericMethod", "numMethodParm", "fineGridNum"});
jsonAdd(dom, m_turbulentCFL, jsonAdd(dom, m_turbulentCFL,
{"region", 0, "numericMethod", "numMethodParm", "cfl"}); {"region", 0, "numericMethod", "numMethodParm", "cfl"});
jsonAdd(dom, m_EntropyCorrectionType,
if (m_EntropyCorrectionType == 0) {
jsonAdd(dom, 1,
{"region", 0, "numericMethod", "numMethodParm", "EntropyFixVal"}); {"region", 0, "numericMethod", "numMethodParm", "EntropyFixVal"});
} else if (m_EntropyCorrectionType == 1) {
jsonAdd(dom, 3,
{"region", 0, "numericMethod", "numMethodParm", "EntropyFixVal"});
}
} }
void CFDStructDataSolverNumericalMethodManager::readDataFromDom(rapidjson::Document &dom) { void CFDStructDataSolverNumericalMethodManager::readDataFromDom(rapidjson::Document &dom) {

@ -131,9 +131,8 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverNumericalMethodManager : pu
// 熵修正类型 // 熵修正类型
/** /**
* @brief m_EntropyCorrectionType * @brief m_EntropyCorrectionType
* 0-Harten-Hyman * 1-Harten-Hyman
* 1-Harten-Yee * 3-Harten-Yee
*
*/ */
int m_EntropyCorrectionType = 0; int m_EntropyCorrectionType = 0;

Loading…
Cancel
Save