1、完成数值方法,将数据存入json中

feature/struct-menu-20241023
mzh 1 week ago
parent 106ba1b7e0
commit 4ab9f82503

@ -35,8 +35,16 @@ void CFDStructDataSolverNumericalMethodManager::saveDataToDom(rapidjson::Documen
{"region", 0, "numericMethod", "numMethodParm", "limiter"});
jsonAdd(dom, m_timeFormat,
{"region", 0, "numericMethod", "numMethodParm", "timeType"});
jsonAdd(dom, m_iterationMethod,
{"region", 0, "numericMethod", "numMethodParm", "iterType"});
// 此变量在ui中对应下拉框但仅有一个选项并且json值不为0所以该变量不需要读取
// jsonAdd(dom, m_iterationMethod,
// {"region", 0, "numericMethod", "numMethodParm", "iterType"});
if (m_timeFormat == 0) {
jsonAdd(dom, 2,
{"region", 0, "numericMethod", "numMethodParm", "iterType"});
} else if (m_timeFormat == 1) {
jsonAdd(dom, 1,
{"region", 0, "numericMethod", "numMethodParm", "iterType"});
}
jsonAdd(dom, m_relaxationFactor,
{"region", 0, "numericMethod", "numMethodParm", "lussor"});
jsonAdd(dom, m_multigridLevels,
@ -51,10 +59,78 @@ void CFDStructDataSolverNumericalMethodManager::saveDataToDom(rapidjson::Documen
{"region", 0, "numericMethod", "numMethodParm", "cfl"});
jsonAdd(dom, m_EntropyCorrectionType,
{"region", 0, "numericMethod", "numMethodParm", "EntropyFixVal"});
}
// TODO 时间格式,会随定常和非定常变化
// TODO 迭代方法,会随定常和非定常变化
// TODO 熵修正类型,未确定
void CFDStructDataSolverNumericalMethodManager::readDataFromDom(rapidjson::Document &dom) {
QVariant temp;
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "generalFmt"});
if (temp != QVariant()) {
m_fluxFormat = temp.toInt();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "twojamson"});
if (temp != QVariant()) {
m_secondOrderArtificialViscosity = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "fourjamson"});
if (temp != QVariant()) {
m_fourthOrderArtificialViscosity = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "accuracy"});
if (temp != QVariant()) {
m_spaceAccuracy = temp.toInt();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "limiter"});
if (temp != QVariant()) {
m_limiter = temp.toInt();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "timeType"});
if (temp != QVariant()) {
m_timeFormat = temp.toInt();
}
// 此变量在ui中对应下拉框但仅有一个选项并且json值不为0所以该变量不需要读取
// jsonRead(dom, m_iterationMethod,
// {"region", 0, "numericMethod", "numMethodParm", "iterType"});
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "lussor"});
if (temp != QVariant()) {
m_relaxationFactor = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "gridLevelNum"});
if (temp != QVariant()) {
m_multigridLevels = temp.toInt();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "cycleType"});
if (temp != QVariant()) {
m_cycleType = temp.toInt();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "coarseGridNum"});
if (temp != QVariant()) {
m_coarseGridCFL = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "fineGridNum"});
if (temp != QVariant()) {
m_fineGridCFL = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "cfl"});
if (temp != QVariant()) {
m_turbulentCFL = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "EntropyFixVal"});
if (temp != QVariant()) {
m_EntropyCorrectionType = temp.toInt();
}
}
CUIConfig *CFDStructDataSolverNumericalMethodManager::genJamesonModeUIConfig() {

@ -4,33 +4,33 @@
#ifndef CFDSTRUCTDATASOLVERNUMERICALMETHODEMANAGER_H
#define CFDSTRUCTDATASOLVERNUMERICALMETHODEMANAGER_H
#include <CFDStructDataManagerBase.h>
#include "CFDStructDataManager_global.h"
#include <CFDStructDataManagerBase.h>
class CUIConfig;
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverNumericalMethodManager : public CFDStructDataManagerBase
{
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverNumericalMethodManager : public CFDStructDataManagerBase {
Q_OBJECT
public:
public:
explicit CFDStructDataSolverNumericalMethodManager(QObject *parent = nullptr);
~CFDStructDataSolverNumericalMethodManager();
CUIConfig* getParamUIConfig();
CUIConfig *getParamUIConfig();
void saveDataToDom(rapidjson::Document &dom);
private:
void readDataFromDom(rapidjson::Document &dom);
private:
// 生成Jameson的界面配置
CUIConfig* genJamesonModeUIConfig();
CUIConfig *genJamesonModeUIConfig();
// 生成Roe界面配置
CUIConfig* genRoeModeUIConfig();
CUIConfig *genRoeModeUIConfig();
// 生成AUSMDY界面配置
CUIConfig* genAUSMDYModeUIConfig();
CUIConfig *genAUSMDYModeUIConfig();
// 生成AUSMPWP界面配置
CUIConfig* genAUSMPWPModeUIConfig();
signals:
private:
CUIConfig *genAUSMPWPModeUIConfig();
signals:
private:
// 通量格式
/**
* @brief m_fluxFormat
@ -69,16 +69,34 @@ private:
// 时间格式
/**
* @brief m_timeFormat
* 0-
* 1-
*/
* @brief m_timeFormat
* 0-
* 1-
*
* ------------------------------------
* ------------------------------------
* **
* 0-
* 1-
*
* **
* 0-
*/
int m_timeFormat = 0;
// 迭代方法
/**
* @brief m_iterationMethod
* 0-LUSGS
*
* ---------old----------
* ---------new-----------
*
* LUSGSjson2
*
*
* json1
*
*/
int m_iterationMethod = 0;
@ -105,7 +123,7 @@ private:
// 湍流CFL数
double m_turbulentCFL = 1.0;
//熵修正类型
// 熵修正类型
/**
* @brief m_EntropyCorrectionType
* 0-Harten-Hyman
@ -114,9 +132,8 @@ private:
*/
int m_EntropyCorrectionType;
//收敛稳定化
// 收敛稳定化
int m_ConvergenceStabilization = 0;
};
#endif // CFDSTRUCTDATASOLVERNUMERICALMETHODMANAGER_H

Loading…
Cancel
Save