Pyomo DAE 工具箱无法适当地离散域

Pyomo DAE toolbox cannot discretize the domain appropriately

我正在使用 Pyomo DAE 工具箱求解偏微分方程,一个自变量的域长度(比如 m.x)非常小(例如 1e-6)。

在我看来,DAE 工具箱无法适当地离散化域,因为离散化的 m.x 只有 2 个点(我使用 ContinuousSet.get_finite_elements() 方法来检查)即使我指定了 10 个有限选项中的元素点(参见下面的代码)。

m.x = ContinuousSet(bounds=(0, 1e-6))

disc=TransformationFactory('dae.finite_difference')
disc.apply_to(m, nfe=10, wrt=m.x, scheme='BACKWARD')

我增加了m.x的上限为

m.x = ContinuousSet(bounds=(0, 1e-5))

并尝试再次将其离散化。这次我在x域得到了10分

然而,当我增加有限元点数为

m.x = ContinuousSet(bounds=(0, 1e-5))
disc.apply_to(m, nfe=100, wrt=m.x, scheme='BACKWARD')

返回的离散域x仍有10分

我想知道 DAE 工具箱是否存在 1e-6 容差或限制。如果有,我该如何自定义这个值?

提前致谢!

是的,目前对域名长度有限制。离散化转换目前将新的离散化点四舍五入到小数点后 6 位。这是因为我看到由于浮点四舍五入的细微差异而多次添加相同的离散化点的问题。正如@QtotheC 提到的,最好的解决方案是修改缩放比例,使 ContinuousSet 的边界在 (0,1) 左右。

要包含的小数点数目前不是用户可以修改的选项,但您始终可以进入源代码并更改数字 here and here