在Gekko上使用scipy. integration .trapz时出错



我正在尝试用gekko库解决一个PDE问题,该问题涉及通过将速度与特定时间的空间积分来计算体积流量。

Qgap==scipy.integrate.trapz(2*np.pi*xpos*np.array(u1))

,其中u1在每个xpos 1000点离散。我得到这个错误:

APM model error: string >       15000  characters
Consider breaking up the line into multiple equations

The may also be due to only using newline character CR
instead of CR LF (for Windows) or LF (for MacOS/Linux) 
To fix this problem, save APM file with appropriate newline characters

STOPPING...

我该怎么做才能解决这个问题?m.integral(u1,xpos)选项是否有效,还是m.integral()仅适用于积分时间?

scipy.integrate.trapz函数与gekko一起工作,因为它产生如下所示的符号结果:求解具有可压缩质量守恒的一维Navier Stokes问题(液压阻尼器)然而,这种符号形式随着积分维数的增加而增加复杂性。在先前问题的测试中,它被限制在150到200个空间离散步骤之间。在200或以上,我建议编写自己的梯形方程,使用m.sum()来分解方程

最新更新