我正在尝试使用Modelica.Media包对自然对流案例进行建模,并建立了一个简单的6x6固定体积区域网格(随附代码),该网格实现了质量和能源节约。这些区域连接到无流动边界条件模型,并通过流动模型进行通信。
但是,当进行模拟时,我在所有步骤中得到了一组非线性方程,与每个区域的状态p,h,Xi的计算有关。
您知道我可以进行设置以避免这种情况吗?也许有不同的初始条件集?任何帮助深表感谢!
model Zone
replaceable package Medium = Modelica.Media.Interfaces.PartialMedium annotation(choicesAllMatching = true);
Medium.BaseProperties medium(p(start=101325, fixed=false),
T(start=293.15, fixed=false));
Test.Port portT(redeclare package Medium = Medium);
Test.Port portB(redeclare package Medium = Medium);
Test.Port portL(redeclare package Medium = Medium);
Test.Port portR(redeclare package Medium = Medium);
parameter Medium.AbsolutePressure P_ambient = 101325;
Medium.Temperature T_ambient = Units.Conversions.from_degC(20);
Medium.MassFraction X_ambient[Medium.nX] = Medium.X_default;
...
initial equation
medium.p = P_ambient;
medium.T = T_ambient;
medium.Xi = X_ambient[1:Medium.nXi];
equation
...
m = V * medium.d;
U = m * medium.u;
mXi = m * medium.Xi;
der(m) = portL.mf + portR.mf + portT.mf + portB.mf;
der(U) = portL.hf + portR.hf + portT.hf + portB.hf + portL.q + portR.q + portT.q + portB.q;
der(mXi) = portL.mXif + portR.mXif + portT.mXif + portB.mXif;
在流模型上,我正在使用
portI.mf = mf;
portI.hf = semiLinear(portI.mf, portI.h, portJ.h);
portI.mXif = semiLinear(portI.mf, portI.Xi, portJ.Xi);
portI.q = q;
portI.mf + portJ.mf = 0;
portI.hf + portJ.hf = 0;
portI.q + portJ.q = 0;
portI.mXif + portJ.mXif = zeros(Medium.nXi);
连接器
Medium.Temperature T;
flow Units.HeatFlowRate q;
Medium.AbsolutePressure p;
flow Medium.MassFlowRate mf;
Medium.SpecificEnthalpy h;
flow Medium.EnthalpyFlowRate hf;
Medium.MassFraction Xi[Medium.nXi];
flow Medium.MassFlowRate mXif[Medium.nXi];
答案 0 :(得分:1)
我刚刚发现了问题,我的方程组还不完整,初始化根本没有帮助。