有没有人有 fortran DAE 求解器的驱动程序 - COLDAE?

计算科学 正则 搭配
2021-12-18 10:17:55

Coldae 是 U Ascher 和 R Spiteri 的求解器作者,位于http://www.cs.ubc.ca/~ascher/coldae.f

它可以使用搭配解决多达索引 2 的 DAE。

我是 Fortran 新手,很难编写驱动程序,它是定义函数、雅可比、边界条件、猜测等的子例程的集合。

我需要的一个例子:https ://people.sc.fsu.edu/~jburkardt/f77_src/colnew/colnew_prb.f 。由同一作者为名为“COLNEW”的旧求解器解决的示例问题。

1个回答

在您提供的源代码的第 473 行:

contrl - is the actual driver of the package. This routine contains the strategy for nonlinear equation solving.

此代码是用 Fortran 77 编写的,因此您无法从模块中受益。这意味着您可能需要从头开始创建一个主程序,准备参数以按特定顺序调用您需要的子例程,并将 Coldae 与您的主程序一起编译。认为自己很幸运,代码似乎有据可查。

我可以建议你,至少,遵循 Fortran 教程(StackOverflow 上有一个很好的文档)并仔细阅读源代码中的注释,作者还包含了他们的参考,所以你也应该看看,你可以如果您不知道代码来自何处,则不希望理解代码。

该代码为您提供了有关驱动程序中所需的用户子例程的非常详细的信息。一种可能的方法是选择一个简单的 DAE 问题,编写相应fsubdfsub等,然后将它们插入到主子程序(您的驱动程序)中。

另外,看看这个例子(注意他们使用的软件不同,但用户子程序与 COLDAE 使用的非常相似)。

C     *************    user supplied subroutines   *************
C
C
C     the following subroutines must be declared external in the
C     main program which calls coldae.
C
C
C     fsub  - name of subroutine for evaluating f(x,z(u(x)),y(x)) =
C                               t
C             (f ,...,f        )  at a point x in (aleft,aright). 
C               1      ncomp+ny
C
C     dfsub - name of subroutine for evaluating the jacobian of
C             f(x,z(u),y) at a point x.  
C
C     gsub  - name of subroutine for evaluating the i-th component of
C             g(x,z(u(x))) = g (zeta(i),z(u(zeta(i)))) at a point x =
C                             i
C             zeta(i) where 1.le.i.le.mstar. 
C
C     dgsub - name of subroutine for evaluating the i-th row of
C             the jacobian of g(x,z(u(x))).  
C
C     guess - name of subroutine to evaluate the initial
C             approximation for  z(u(x)), y(x) and for dmval(u(x))= vector
C             of the mj-th derivatives of u(x). 
C
C**********************************************************************