spatialDistribution() - Modelica 中的运算符和非标量梯度

spatialDistribution()-Operator and non-scalar gradients in Modelica

我在 Dymola 中使用 spatialDistribution() 运算符并在使用 Hidden.PrintFailureToDifferentiate = true;

时收到以下消息

"Can only compute non-scalar gradients of functions specifying derivatives and not for: spatialDistribution"

我这样称呼接线员:

(time_rev,time_flow) = spatialDistribution(时间,时间,x/length,v_water>=0,{0.0,1.0}, {时间,时间});

并用它来计算我管道的出口温度。

有人知道问题出在哪里吗?我不太明白错误信息。

更完整的示例:

cp_in = //Calculates specific Heatcap 
cp_out = //Calculates specific Heatcap 
cp = (cp_in+cp_out)*0.5;
C = (Modelica.Constants.pi*(1/4))*diameter_i^2*fluidInlet.d*cp;
R= // Calculates Heatresistance 
//---------Conservation of mass flow and composition
//The usual stuff equal massflow,xi and p at both connectors
//----------Spatial
tau_nom = C*R;
v_water = //Calc Speed of water from Geometric data and inlet rho
der(x) = v_water;
(time_reversed,time_flow) = spatialDistribution(time,time,x/length,v_water>=0, {0.0,1.0}, {time,time});
 tau_delay= time - time_flow;
 tau_reversed= time - time_reversed; //Not used right now
if inlet.m_flow >= 0 then
  T_out = (T_amb + (T_in - heat.T)*exp(-tau_delay/tau_nom));
  heat.Q_flow = -inlet.m_flow*cp*(T_in - T_out);
  inlet.h = inStream(outlet.h);
else
  outlet.h = inStream(inlet.h);
  T_in = T_out;
  heat.Q_flow = -inlet.m_flow*cp*(T_in - T_out);
end if;

收到此错误消息的原因是 Dymola 无法计算梯度,这可能用作计算非线性方程组雅可比行列式的一部分。

如果您查看翻译日志,我认为 "Number of numerical Jacobians: " 是非零的。

非线性方程组的雅可比行列式缺失通常不是主要问题。

然而,非线性系统需要 spatialDistribution 的梯度似乎不正确,因为它表明延迟变量是以某种奇怪的方式隐式给出的。

可能空间分布的延迟应该可以解决这个问题,在这种情况下,如果您设置 Advanced.BreakDelayLoops=true,Dymola 2019 FD01 可能会解决这个问题; (但没有完整的模型很难说)。 (看来你有一个较早的版本,并且该标志在那里不起作用。)

我知道回答有点晚,但没有完整的模型很难调查。