You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AppFlow/CFDStruct/CFDStructDataManager/CFDStructDataSolverBasicMod...

201 lines
11 KiB
C++

#include "CFDStructDataSolverBasicModelManager.h"
#include "CFDStructMain/CFDStructDefine.h"
#include "CFDStructSigsCenter.h"
#include "CUIProperty/CUIConfig.h"
CFDStructDataSolverBasicModelManager::CFDStructDataSolverBasicModelManager(QObject *parent) : CFDStructDataManagerBase(parent) {
m_uiConfig = nullptr;
}
CFDStructDataSolverBasicModelManager::~CFDStructDataSolverBasicModelManager() {
if (m_uiConfig != nullptr) {
delete m_uiConfig;
m_uiConfig = nullptr;
}
connect(m_cuiSigsCenter, &CUISigsCenter::sig_cuiPropertyChanged, this, [=](int semaphore) {
emit CFDStructSigsCenter::getInstance() -> sig_solverTimeModeDataChanged();
});
}
CUIConfig *CFDStructDataSolverBasicModelManager::getParamUIConfig() {
if (m_FluidProperties == 0)
return this->genFluidPropertiesOffUIConfig();
if (m_FluidProperties == 1)
return this->genFluidPropertiesOnUIConfig();
return this->genFluidPropertiesOnUIConfig();
}
void CFDStructDataSolverBasicModelManager::saveDataToDom(rapidjson::Document &dom) {
jsonAdd(dom, m_FlowModel, {"region", 0, "flowType"});
jsonAdd(dom, m_OverlayNetwork, {"region", 0, "chimeraMesh"});
jsonAdd(dom, m_Rgasmean, {"region", 0, "refValue", "rgas_mean"});
jsonAdd(dom, m_Gmean, {"region", 0, "refValue", "gamma"});
jsonAdd(dom, m_Prlmean, {"region", 0, "solver", "turbModel", "RANS", "params", "Prl"});
jsonAdd(dom, m_Prtmean, {"region", 0, "solver", "turbModel", "RANS", "params", "Prt"});
}
void CFDStructDataSolverBasicModelManager::readDataFromDom(rapidjson::Document &dom) {
QVariant temp;
jsonRead(dom, temp, {"region", 0, "flowType"});
if (temp != QVariant()) {
m_FlowModel = temp.toInt();
}
jsonRead(dom, temp, {"region", 0, "chimeraMesh"});
if (temp != QVariant()) {
m_OverlayNetwork = temp.toInt();
}
jsonRead(dom, temp, {"region", 0, "refValue", "rgas_mean"});
if (temp != QVariant()) {
m_Rgasmean = temp.toDouble();
}
jsonRead(dom, temp, {"region", 0, "refValue", "gamma"});
if (temp != QVariant()) {
m_Gmean = temp.toDouble();
}
jsonRead(dom, temp, {"region", 0, "solver", "turbModel", "RANS", "params", "Prl"});
if (temp != QVariant()) {
m_Prlmean = temp.toDouble();
}
jsonRead(dom, temp, {"region", 0, "solver", "turbModel", "RANS", "params", "Prt"});
if (temp != QVariant()) {
m_Prtmean = temp.toDouble();
}
}
/**
* @param 求解器中,基本模型,流体属性关闭时的属性界面设置
*
* @return 属性设置
*/
CUIConfig *CFDStructDataSolverBasicModelManager::genFluidPropertiesOffUIConfig() {
return new CUIConfig({
{"type", "Widget"},
},
{new CUIConfig({
// 下拉框:求解器类型
{"type", "ComboBox"},
{"name", tr("Solver Type")},
},
{new CUIConfig({
{"type", "Item"}, {"name", tr("Compressible Flow")} // 选项:可压缩流动
})}),
new CUIConfig({
// 下拉框:流动模型
{"type", "ComboBox"},
{"name", tr("Flow Model")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin", QVA_GLOBAL(&m_FlowModel)},
{"semaphore", 1},
},
{new CUIConfig({// 选项:外流
{"type", "Item"},
{"name", tr("Internal Flow")}}),
new CUIConfig({// 选项:内流
{"type", "Item"},
{"name", tr("External Flow")}}),
new CUIConfig({// 选项:多级叶轮机械
{"type", "Item"},
{"name", tr("Multistage Turbomachinery")}})}),
new CUIConfig({
// 方形勾选:重叠网络
{"type", "CheckBox"},
{"name", tr("Overlay Network")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin", QVA_GLOBAL(&m_OverlayNetwork)},
}),
new CUIConfig({
// 方形选择按钮:流体属性
{"type", "CheckBox"},
{"name", tr("Fluid Properties")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin", QVA_GLOBAL(&m_FluidProperties)},
{"semaphore", 1},
})});
}
CUIConfig *CFDStructDataSolverBasicModelManager::genFluidPropertiesOnUIConfig() {
return new CUIConfig({
{"type", "Widget"},
},
{new CUIConfig({
// 下拉框:求解器类型
{"type", "ComboBox"},
{"name", tr("Solver Type")},
},
{new CUIConfig({
{"type", "Item"}, {"name", tr("Compressible Flow")} // 选项:可压缩流动
})}),
new CUIConfig({
// 下拉框:流动模型
{"type", "ComboBox"},
{"name", tr("Flow Model")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin", QVA_GLOBAL(&m_FlowModel)},
},
{new CUIConfig({// 选项:外流
{"type", "Item"},
{"name", tr("Internal Flow")}}),
new CUIConfig({// 选项:内流
{"type", "Item"},
{"name", tr("External Flow")}}),
new CUIConfig({// 选项:多级叶轮机械
{"type", "Item"},
{"name", tr("Multistage Turbomachinery")}})}),
new CUIConfig({
// 方形勾选:重叠网络
{"type", "CheckBox"},
{"name", tr("Overlay Network")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin", QVA_GLOBAL(&m_OverlayNetwork)},
}),
new CUIConfig({
// 圆形选择按钮:流体属性
{"type", "CheckBox"},
{"name", tr("Fluid Properties")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin", QVA_GLOBAL(&m_FluidProperties)},
{"semaphore", 1},
}),
new CUIConfig({// 组,流体属性下的内容
{"type", "GroupBox"},
{"name", tr("Fluid Properties")}},
{
new CUIConfig({
// 气体成分
{"type", "LineEdit"},
{"name", tr("Gas Composition")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_STRING},
{"value_origin", QVA_GLOBAL(&m_GasComposition)},
}),
new CUIConfig({
// 气体常数
{"type", "LineEdit"},
{"name", tr("rgasmean")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
{"value_origin", QVA_GLOBAL(&m_Rgasmean)},
}),
new CUIConfig({
// 比热比
{"type", "LineEdit"},
{"name", tr("gmean")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
{"value_origin", QVA_GLOBAL(&m_Gmean)},
}),
new CUIConfig({
// 层流普朗特数
{"type", "LineEdit"},
{"name", tr("prlmean")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
{"value_origin", QVA_GLOBAL(&m_Prlmean)},
}),
new CUIConfig({
// 湍流普朗特数
{"type", "LineEdit"},
{"name", tr("prtmean")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
{"value_origin", QVA_GLOBAL(&m_Prtmean)},
}),
})});
}