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

发布于 2025-01-31 20:54:39 字数 577 浏览 3 评论 0原文

我正在尝试使用Gekko库解决PDE,该PDE涉及通过在一定时间与空间集成速度来计算体积流量。

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

在每个XPOS 1000点处离散U1。 我得到这个错误:

 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()仅与时间不可或缺?

I am trying to solve a PDE with gekko library which involves calculating volume flow rate by integrating velocity with the space at a certain time.

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

where u1 is discretized at each xpos 1000 points.
I get this error:

 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...

What should I do to solve this problem?
Does m.integral(u1,xpos) option works or m.integral() only works with integral with time only?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑叹一世浮沉 2025-02-07 20:54:39

scipy.integrate.trapz函数可与gekko一起起作用,因为它会产生符号结果,如下所示:问题有关解决1D Navier用可压缩的质量保护(液压阻尼器)的问题但是,这种符号形式与整合维度的复杂性增加。在关于早期问题的测试中,它仅限于150至200个空间离散步骤之间。在200或以上,我建议使用m.sum()分解方程式编程您自己的梯形方程式

The scipy.integrate.trapz function works with gekko because it produces a symbolic result as shown here: Problem on Solving a 1D Navier Stokes with Compressible Mass Conservation (Hydraulic Damper) However, this symbolic form increases in complexity with the integrating dimension. In tests on the earlier problem, it is limited to somewhere between 150 and 200 spatial discretization steps. At 200 or beyond, I recommend programming your own trapezoidal equation that uses m.sum() to break up the equation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文