1、边界条件写入json

feature/struct-menu-20241023
mzh 3 days ago
parent d26c42d58a
commit e563336453

@ -72,6 +72,7 @@ void CFDStructDataManagerBase::jsonAdd(rapidjson::Document &document,
}
if (index == -1) {
// 向数组中添加内容
} else {
// 扩展数组以适应指定索引
while (current->Size() <= index) {

@ -78,7 +78,121 @@ CUIConfig *CFDStructDataSolverBoundaryConditionManager::getParamUIConfig() {
}
void CFDStructDataSolverBoundaryConditionManager::saveDataToDom(rapidjson::Document &dom) {
// TODO
jsonAdd(dom, m_id, {"region", 0, "bc", m_id, "id"});
jsonAdd(dom, m_BoundaryName, {"region", 0, "bc", m_id, "name"});
if (m_WallType == 0) {
jsonAdd(dom, 1, {"region", 0, "bc", m_id, "type"});
} else if (m_WallType == 1) {
jsonAdd(dom, 4, {"region", 0, "bc", m_id, "type"});
} else if (m_WallType == 2) {
jsonAdd(dom, 5, {"region", 0, "bc", m_id, "type"});
} else if (m_WallType == 3) {
jsonAdd(dom, 6, {"region", 0, "bc", m_id, "type"});
} else if (m_WallType == 4) {
jsonAdd(dom, 7, {"region", 0, "bc", m_id, "type"});
} else if (m_WallType == 5) {
jsonAdd(dom, 13, {"region", 0, "bc", m_id, "type"});
} else if (m_WallType == 6) {
jsonAdd(dom, 13, {"region", 0, "bc", m_id, "type"});
} else if (m_WallType == 7) {
jsonAdd(dom, 8, {"region", 0, "bc", m_id, "type"});
} else if (m_WallType == 8) {
jsonAdd(dom, 16, {"region", 0, "bc", m_id, "type"});
}
jsonAdd(dom, m_WallType,
{"region", 0, "bc", m_id, "momentum", "type"});
jsonAdd(dom, m_WallTemperature,
{"region", 0, "bc", m_id, "momentum", "temp"});
jsonAdd(dom, m_WallHeatFlux,
{"region", 0, "bc", m_id, "momentum", "reliu"});
jsonAdd(dom, m_MachNumber,
{"region", 0, "bc", m_id, "momentum", "mach"});
jsonAdd(dom, m_Pressure,
{"region", 0, "bc", m_id, "momentum", "press"});
jsonAdd(dom, m_Temperature,
{"region", 0, "bc", m_id, "momentum", "temper"});
jsonAdd(dom, m_InflowDirectionX,
{"region", 0, "bc", m_id, "momentum", "temper", 0});
jsonAdd(dom, m_InflowDirectionY,
{"region", 0, "bc", m_id, "momentum", "temper", 1});
jsonAdd(dom, m_InflowDirectionZ,
{"region", 0, "bc", m_id, "momentum", "temper", 2});
jsonAdd(dom, m_TurbulentViscosityRatio,
{"region", 0, "bc", m_id, "momentum", "faro"});
jsonAdd(dom, m_TurbulentIntensity,
{"region", 0, "bc", m_id, "momentum", "fark"});
jsonAdd(dom, m_BoundaryType_sub,
{"region", 0, "bc", m_id, "momentum", "speedType"});
jsonAdd(dom, m_TotalPressure,
{"region", 0, "bc", m_id, "momentum", "totalP"});
jsonAdd(dom, m_StaticPressure,
{"region", 0, "bc", m_id, "momentum", "staticP"});
jsonAdd(dom, m_TotalTemperature,
{"region", 0, "bc", m_id, "momentum", "totalT"});
jsonAdd(dom, m_VelocityDirectionType,
{"region", 0, "bc", m_id, "momentum", "speedDir"});
jsonAdd(dom, m_DirectionVectorX,
{"region", 0, "bc", m_id, "momentum", "direction", 0});
jsonAdd(dom, m_DirectionVectorY,
{"region", 0, "bc", m_id, "momentum", "direction", 1});
jsonAdd(dom, m_DirectionVectorZ,
{"region", 0, "bc", m_id, "momentum", "direction", 2});
jsonAdd(dom, m_TurbulentViscosityRatio,
{"region", 0, "bc", m_id, "momentum", "faro"});
jsonAdd(dom, m_TurbulentIntensity,
{"region", 0, "bc", m_id, "momentum", "fark"});
jsonAdd(dom, m_staticPType,
{"region", 0, "bc", m_id, "momentum", "staticPType"});
jsonAdd(dom, m_StaticPressure,
{"region", 0, "bc", m_id, "momentum", "staticP"});
jsonAdd(dom, m_CorrespondingSurface,
{"region", 0, "bc", m_id, "boundaryId"});
jsonAdd(dom, m_PairingName,
{"region", 0, "bc", m_id, "interfaceName"});
jsonAdd(dom, m_CorrespondingSurface,
{"region", 0, "bc", m_id, "boundaryName"});
jsonAdd(dom, m_PairingName,
{"region", 0, "bc", m_id, "periodicName"});
jsonAdd(dom, m_PeriodicType,
{"region", 0, "bc", m_id, "matchType"});
jsonAdd(dom, 256,
{"region", 0, "bc", m_id, "translate", "unit"});
jsonAdd(dom, m_TranslationDistanceX,
{"region", 0, "bc", m_id, "translate", "value", 0});
jsonAdd(dom, m_TranslationDistanceY,
{"region", 0, "bc", m_id, "translate", "value", 1});
jsonAdd(dom, m_TranslationDistanceZ,
{"region", 0, "bc", m_id, "translate", "value", 2});
jsonAdd(dom, 256,
{"region", 0, "bc", m_id, "rotate", "center", "unit"});
jsonAdd(dom, m_RotationCenterX,
{"region", 0, "bc", m_id, "rotate", "center", "value", 0});
jsonAdd(dom, m_RotationCenterY,
{"region", 0, "bc", m_id, "rotate", "center", "value", 1});
jsonAdd(dom, m_RotationCenterZ,
{"region", 0, "bc", m_id, "rotate", "center", "value", 2});
jsonAdd(dom, m_per_rot_aixsX,
{"region", 0, "bc", m_id, "rotate", "axis", 0});
jsonAdd(dom, m_per_rot_aixsY,
{"region", 0, "bc", m_id, "rotate", "axis", 1});
jsonAdd(dom, m_per_rot_aixsZ,
{"region", 0, "bc", m_id, "rotate", "axis", 2});
jsonAdd(dom, m_RotationAngle,
{"region", 0, "bc", m_id, "rotate", "angle"});
jsonAdd(dom, m_InitialPressure,
{"region", 0, "bc", m_id, "momentum", "initPressure"});
jsonAdd(dom, m_FlowRate,
{"region", 0, "bc", m_id, "momentum", "massRate"});
jsonAdd(dom, m_PressureRelaxationFactor,
{"region", 0, "bc", m_id, "momentum", "pressureFactor"});
// 用户自定义部分
// jsonAdd(dom, m_UserDefined,{region[0] bc momentum pressureFactor});
jsonAdd(dom, 0,
{"region", 0, "bc", m_id, "momentum", "isUser"});
}
void CFDStructDataSolverBoundaryConditionManager::readDataFromDom(rapidjson::Document &dom) {
@ -423,7 +537,7 @@ CUIConfig *CFDStructDataSolverBoundaryConditionManager::genPressureInletModeSupe
{
new CUIConfig({
{"type", "Item"},
{"name", tr(" Specified Direction (Cylindrical Coordinate System)")},
{"name", tr("Specified Direction (Cylindrical Coordinate System)")},
}),
new CUIConfig({
{"type", "Item"},
@ -1573,6 +1687,8 @@ CUIConfig *CFDStructDataSolverBoundaryConditionManager::genPressureOutletUIConfi
{"type", "RadioComponent"},
{"widget", "Component"},
{"layout", "QHBoxLayout"},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin", QVA_GLOBAL(&m_staticPType)},
},
{
new CUIConfig({

@ -65,30 +65,33 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverBoundaryConditionManager :
private:
// 粘性模型
int m_Model;
int m_Model = 0;
// RANS模型
int m_RNSModel;
int m_RNSModel = 0;
// id
int m_id = 0;
// 边界名称
QString m_BoundaryName; // Boundary Name
QString m_BoundaryName = ""; // Boundary Name
// 所属计算域
QString m_ComputationalDomain; // Computational Domain
QString m_ComputationalDomain = ""; // Computational Domain
// 边界类型
int m_BoundaryType = 0; // Boundary Type
// 马赫数
double m_MachNumber; // Mach Number
double m_MachNumber = 0; // Mach Number
// // 密度
// double m_Density; // Density
// 压强
double m_Pressure;
double m_Pressure = 0;
// 温度
double m_Temperature; // Temperature
double m_Temperature = 0; // Temperature
// 来流方向
// double m_InflowDirection; // Inflow Direction
@ -97,25 +100,25 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverBoundaryConditionManager :
double m_InflowDirectionZ = 0;
// 湍流粘性比
double m_TurbulentViscosityRatio; // Turbulent Viscosity Ratio
double m_TurbulentViscosityRatio = 0; // Turbulent Viscosity Ratio
// 湍流强度
double m_TurbulentIntensity; // Turbulent Intensity
double m_TurbulentIntensity = 0; // Turbulent Intensity
// 总压
double m_TotalPressure; // Total Pressure
double m_TotalPressure = 0; // Total Pressure
// 总温
double m_TotalTemperature; // Total Temperature
double m_TotalTemperature = 0; // Total Temperature
// 静压
double m_StaticPressure; // Static Pressure
double m_StaticPressure = 0; // Static Pressure
// 配对名称
double m_PairingName; // Pairing Name
double m_PairingName = 0; // Pairing Name
// 对应面
int m_CorrespondingSurface; // Corresponding Surface
int m_CorrespondingSurface = 0; // Corresponding Surface
// 周期类型
int m_PeriodicType = 0; // Periodic Type
@ -139,16 +142,16 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverBoundaryConditionManager :
double m_per_rot_aixsZ = 0;
// 旋转角
double m_RotationAngle; // Rotation Angle
double m_RotationAngle = 0; // Rotation Angle
// 壁面类型
int m_WallType = 0; // Wall Type
// 壁面温度
double m_WallTemperature; // Wall Temperature
double m_WallTemperature = 0; // Wall Temperature
// 壁面热流
double m_WallHeatFlux; // Wall Heat Flux
double m_WallHeatFlux = 0; // Wall Heat Flux
// 配对名称
QString m_PairedName = "";
@ -179,6 +182,9 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverBoundaryConditionManager :
// 用户自定义
int m_UserDefined = 0;
// 静压类型
int m_staticPType = 0;
};
#endif // CFDSTRUCTDATASOLVERBOUNDARYCONDITIONMANAGER_H

@ -11,22 +11,22 @@ class CUIConfig;
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverComputingControlManager : public CFDStructDataManagerBase {
Q_OBJECT
public:
explicit CFDStructDataSolverComputingControlManager(QObject* parent = nullptr);
explicit CFDStructDataSolverComputingControlManager(QObject *parent = nullptr);
~CFDStructDataSolverComputingControlManager();
CUIConfig* getParamUIConfig();
void saveDataToDom(rapidjson::Document& dom);
CUIConfig *getParamUIConfig();
void saveDataToDom(rapidjson::Document &dom);
void readDataFromDom(rapidjson::Document& dom);
void readDataFromDom(rapidjson::Document &dom);
private:
// 生成界面配置
CUIConfig* genUIConfig();
CUIConfig *genUIConfig();
signals:
private:
// 数据保存频率
int m_DataSaveFrequency; // Data Save Frequency
int m_DataSaveFrequency = 0; // Data Save Frequency
// 数值计算核数
int m_NumericalComputationCores = 0;

@ -135,7 +135,7 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverNumericalMethodManager : pu
* 1-Harten-Yee
*
*/
int m_EntropyCorrectionType;
int m_EntropyCorrectionType = 0;
// 收敛稳定化
int m_ConvergenceStabilization = 0;

@ -27,19 +27,19 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverReferenceQuantityManager :
private:
// 参考值取自
int m_ReferenceValuesFrom; // Reference Values From
int m_ReferenceValuesFrom = 0; // Reference Values From
// 压强
double m_Pressure; // Pressure
double m_Pressure = 0; // Pressure
// 温度
double m_Temperature; // Temperature
double m_Temperature = 0; // Temperature
// 长度
double m_Length; // Length
double m_Length = 0; // Length
// 面积
double m_Area; // Area
double m_Area = 0; // Area
// 力矩矩心
QString m_TorqueCenterOfMoment = 0;

Loading…
Cancel
Save