我将动态模型设置为ODE的(僵硬)系统.我目前用CVODE解决了这个问题(来自Assimulo python包中的SUNDIALS包),一切都很好.
我现在想要为问题添加一个新的3D散热器(具有与温度相关的热参数).我的想法是使用现有的FEM或FVM框架为我提供一个界面,使我可以轻松地为(t, y)
常规提供3D块,并获得,而不是从头开始为3D热方程编写所有方程式.支持残差y'
.原理是使用FEM系统中的方程而不是求解器.CVODE可以利用稀疏性,但预计组合系统的解决速度将慢于FEM系统自身解决的速度,并为此量身定制.
# pseudocode of a residuals function for CVODE
def residual(t, y):
# ODE system of n equations
res[0] = <function of t,y>;
res[1] = <function of t,y>;
...
res[n] = <function of t,y>;
# Here we add the FEM/FVM residuals
for i in range(FEMcount):
res[n+1+i] = FEMequations[FEMcount](t,y)
return res
Run Code Online (Sandbox Code Playgroud)
我的问题是(a)这种方法是否合理,(b)是否有一个FEM或FVM库可以轻松地让我将其视为一个方程组,这样我就可以"将它"粘贴到我现有的一套ODE方程.
如果不能让两个系统共享同一个时间轴,那么我将不得不以步进模式运行它们,我在那里运行一个模型一小段时间,更新另一个模型的边界条件,运行那个,更新第一个模型的BC,等等.
我对精彩的图书馆FiPy有一些经验,我期望最终以上述方式使用该库.但我想知道其他系统在这种性质问题上的经验,以及我错过的其他方法.
编辑:我现在有一些看似有效的示例代码,显示了如何使用CVODE解决FiPy网格扩散残差.然而,这只是一种方法(使用FiPy),其余的问题和疑虑仍然存在.欢迎任何建议.
from fipy import *
from fipy.solvers.scipy import DefaultSolver
solverFIPY = DefaultSolver()
from assimulo.solvers import CVode as solverASSIMULO
from …
Run Code Online (Sandbox Code Playgroud) python finite-element-analysis differential-equations fipy assimulo
我尝试在Anaconda(Python 3.6.8)上设置pyFMI
安装了pyFMI站点上列出的所有必需软件包。fmu加载没有问题,但是当我尝试模拟fmu时出现错误:
Could not find cannot import name 'radau5'
Could not find cannot import name 'dopri5'
Could not find cannot import name 'rodas'
Could not find cannot import name 'odassl'
Could not find ODEPACK functions.
Could not find RADAR5
Could not find GLIMDA.
Traceback (most recent call last):
File "assimulo\solvers\../lib/sundials_callbacks_ida_cvode.pxi", line 240, in assimulo.solvers.sundials.cv_jac
File "C:\Users\d60378\AppData\Local\Continuum\anaconda3\lib\site-packages\pyfmi\simulation\assimulo_interface.py", line 733, in j
A = self._model._get_A(add_diag=True, output_matrix=self._A)
File "src\pyfmi\fmi.pyx", line 6041, in pyfmi.fmi.FMUModelBase2._get_A
File "src\pyfmi\fmi.pyx", line 7592, in pyfmi.fmi.FMUModelME2._get_directional_proxy
File "src\pyfmi\fmi.pyx", line …
Run Code Online (Sandbox Code Playgroud)