数值计算软件(Software)

  AFEPack     计算和应用数学文献资源中心  

AFEPack:在过去的两年时间里,这个网页一直都没有更新。由于一些令人失望的经验,我对于推广使用 这个软件包并不抱太乐观的态度。由于 Linux 操作系统和 C++ 这两个东西对于我们大多数同行 和同学来说是两个巨大的困难,真正学会了我的这个软件包的使用者少之又少。如果期望从不熟 悉环境到能够使用这个包来进行研究工作,假设您确实有研究上的需求,因而有学习使用这个包 的动力,那么至少需要在半年时间中,每天都花上两个小时以上学习它,才有可能有所小成。在 当今这个日新月异的时代里,这个时间恐怕已经超出了大多数期望尽快发表 SCI 论文而能够付出 的可接受时间尺度。这个包的用户对象是研究人员,是那些为了能够研究新的算法而需求而设计 的,如果您期望使用鼠标完成您的工作,那么这个包绝非正确的选择。

说了这么多吓人的话,您如果还能坚持读下去,我也期望对能够坚持学习下去的用户,描述一下 如果您能够真正的掌握这个包的开发方式的话,可能会见到的光明前景。一般来说,在这个包的 帮助下,您写一个复杂的偏微分方程组的有限元程序的工作,在一到两个小时内完成是并不困难 的。而且您的程序天生会具有相当大的可重用性:解一个新的问题常常只需要在旧程序上进行少 许修改就能完成,而很多并不是太高要求的问题都可以在库中附带的例子上进行不多的修改即可 解决。

一个问题是,两年没有更新的网页为什么现在要进行更新呢?事实上,这次终于进行的更新也 只是进行了少许的修改,更新主要的目的是期望为了在我基本上终止对这个包的进一步开发的 时候,为它的发展最后加入一点动力。AFEPack 在 2006 年的八月申请了一个 计算机软件版权号,它现在对于其能力所能够覆盖的问题,基本上能够比较完好的解决了,但 是对于其能力不能覆盖的问题,是不可能在其现在的基本数据结构下进行简单的修改和补充就 能够解决的。我现在将精力放在了新一代的软件包的开发上,期望能够在整个的自适应算法上 有比较全面的发展,这个新的包的结构虽然在我看来非常美丽,但是也很难以理解。

当我写到这里的时候,正精确地是 2007 年新年钟声敲响的时候,感慨良多。随着现在计算机 硬件的计算能力的飞速发展,事实上来说,在过去的十几年间,我们的计算机的速度和容量提 升了大约一千倍。我们作为来挖掘计算机的计算能力的研究人员,常常还在解决和十几年以前 同样规模的问题写文章,因此事实上来说,我们的计算能力其实是退步了。我们依赖 Windows, 依赖 Matlab,我们的研究生常常连两千阶的线性代数方程组都无法自己写程序解出来,我们越 来越远离底层,无法理解计算数学到底在干什么和要干什么,成为漂浮在厚厚的一层虚无飘渺 之上的白痴。

回首俯视窗外的山下,是香港沙田区美丽的夜景,万家团圆的灯火让身在异乡的游子感到分外的孤 独,而我这些或许脱离了时代环境需求的所谓研究不也是同样的心境么?期望理解 AFEPack 的 设计机理的过程,是让您从一个不同的视角来理解有限元作为一种计算方法的机会。

AFEPack是刘文斌教授和我开发的基础有限元和有限元自适应软件包,请在它的主页上了解详细的信息。 这是一个给基础数值技术研究人员使用的 C++ 库函数包,熟练的使用者能够通过这个包非常 大程度的提高工作效率。您可以在这里下载这个包的源码每天晚上的 snapshot。这个源码包以后若非修正 Bug,将不会再频繁更新。
AFEPack 安装的步骤:
  1. 请先安装 deal.II 软件包, 因为我使用了 deal.II 的线性代数包,所以您只需要编译 deal.II 的 base 和 lac 部分就可以了,具体操作如下:
    1. 下载 deal.II 的源码包;
    2. 将这个软件包解压缩到,比如在 /usr/local/deal.II 下面;
    3. 进入 /usr/local/deal.II,运行 ./configure ;
    4. 编译:make base lac;
    5. 将 deal.II 的头文件和库文件链接到系统目录下,在我的机器上为:
          [rli@circus /usr/local/include]$ ln -s ../deal.II/base/include/base .
      [rli@circus /usr/local/include]$ ln -s ../deal.II/lac/include/lac .
      [rli@circus /usr/local/lib]$ ln -s ../deal.II/base/lib/lib* .
      [rli@circus /usr/local/lib]$ ln -s ../deal.II/lac/lib/lib* .
  2. 然后您就可以编译 AFEPack 了,先获得 AFEPack 的源码包,并进行解压,比如 解压到 /usr/local/AFEPack 下面;
  3. 请您在 AFEPack 的源码目录中,运行 ./configure;
    如果包括 deal.II 的头文件或者库文件找不到,可以使用指定 EXTRA_INCDIR 和 EXCTRA_LIBDIR 这两个环境变量来指定 deal.II 的头文件和库文件的路径:
    env EXTRA_INCDIR="-Ipath/to/dealii/head/file" EXTRA_LIBDIR="-Lpath/to/dealii/libs" ./configure
    如果还有问题,可能是因为GNU 开发工具包的版本的问题,您可以首先将过去运行 automake 和 autoconf 等的缓冲目录删除(名为 autom4*),然后使用命令序列:
    aclocal
    automake
    autoconf
    重新产生出 configure 脚本;
    configure 脚本接收 --help 参数的时候可以给您帮助信息;
  4. 运行 make 进行编译;
    编译过程也可以分开进行,您可以到 library、template 目录中分别运行 make 进行编译;
    目录 example 下的内容编译的时候会有问题,您可以在做完下一步以后再在 exmaple 目录下运行 make 进行编译;
    在 example/tools 下会编译出来很多很有用的可执行程序,帮助您做很多数据 文件的格式转换,很值得试一下;
  5. 将头文件和编译得到的库文件链接到系统目录下:
        [rli@circus /usr/local/include]$ ln -s ../AFEPack/library/include AFEPack 
    [rli@circus /usr/local/lib]$ ln -s ../AFEPack/library/lib/lib* .
    您使用 make install 也可以做这件事。
  6. 现在您就能够使用 AFEPack 提供的功能进行编程了,具体情况请参阅文档。
您现在可以到 example 目录中编译和研究我提供的一些使用 AFEPack 进行开发的小例子, 这些例子对于帮助您学习使用 AFEPack 进行编程,是非常有用处的。很多问题 直接通过对这些小例子中的某一个进行简单的修改就可以解决。

这个软件的开发在我的博士后研究期间得到 EPSRC 的支持,但是开发的动机是出于研究的兴趣, 没有任何商业上的企图,现在已经没有经费的支持,所以文档更新的不是太及时,我也不能对于 其稳定性和正确性提供任何保证,但如果有什么问题请给我发 email,我会尽力给您帮助的。如果您有兴趣参与这个软件的开发,我也非常欢迎。

我现在使用 AFEPack 进行研究工作中的开发的程序包括:
如果您也从事相应的研究工作,我可以提供大部分的源程序以供参考。 如果您有使用 AFEPack 进行开发的实例,希望您告诉我。如果比较成功,让我分享您的喜悦; 如果还有问题,或许我可以提供一些帮助。

AFEPack 支持的相关软件下载:
AFEPack 还支持将计算结果输出成为 Tecplot 使用的数据格式,不过这个软件不是免费的, 请您自己安排购买该软件。

AFEPack 近期更新日志:
## ChangeLog

* Use the boost::iostream::filtering_istream to permit shell script style
  comments in the text library file in the template data. So for user please
  put boost to some directory can be found be the compiler!

* A bug in renumerateElement is corrected.

* Lasy mode is added to adapt the code for really large scale computation.
  Under such case, we only handle the node basis functions and the element
  image building is not implemented at all. The user should make the vertices
  of the element to be stored in correct order. In the class IrregularMesh,
  a method lazyRegularize is provided to generate a mesh only store the 
  information of elements and nodes. Dirty tricks!

* Add the POSIX threads support. The support mainly includes the interface
  to call a member function or a non-member function by a new thread.
  Class ThreadManager will take care of the threads. Functions provided
  by POSIX thread library are still avaible in the thread functions. You
  should guarantee the code is thread safe yourself.

* Add the order-0 Raviart-Thomas element on rectangle and twin-triangle.

* in FEMFunction::writeEasyMeshData and FEMFunction::writeOpenDXData,
  the bug to save incorrect data when the nodes is not sorted is removed.

* class DBMesh is revised that the bug in setting boundary marker is
  removed.

* A serious bug removed from Element::buildGeometryImage.

* Rename the AMGSolver::init member function as AMGSolver::reinit which
  is more nature.

* Add the support to vector value basis function finite element space.
  This is a big upgrade of the whole library. A list of files are revised
  including TemplateElement, FEMSpace, BilinearOperator, etc. There is
  only one vector value template element in the library currently, which
  is the order-0 Raviart-Thomas element on triangles.
  
	
* A bug is removed from file Operator.template.h in function
        template <class value_type, int DIM>
        void Operator::L2Project(FEMFunction <value_type, DIM> & f0, 
	                         FEMFunction <value_type, DIM> & f1, 
                                 Method method, 
                                 int algebric_accuracy);

* All examples are revised and a list of simple tools provided in the example
  directory.

* Add an example to solve a viscous Burgers equation using class MovingMesh.

* Modified the prototype of some member function of class AMGSolver,
  AMGOptimizer, AMGPreconditioner. The original ones have some problems
  in a "const" modifier.

* Debug the Makefile problem in directory "template".

* Add the mechenism to use Algebraic Multigrid Method as a pre-conditioner
  of the solvers in deal.II.

* Add the optimization mechenism for finite element space. With this 
  mechenism, the efficiency of the numerical integration can be improved 
  if it should be taken for more than one time because it can save the 
  integration information in memory.

* Add the class DGFEMSpace to handle Discontinuous Garlerkin Finite
  Element Space.

* Add the class MovingMesh as the derivative class of Mesh which can
  be used as a general mesh while with a provided monitor, the mesh
  can move according the monitor.

* Since version 1.5, the package is planed to be released. The package
  now is comparative stable while there must be a lot of bugs still that
  it at most is an Alpha version. :-)

计算和应用数学文献中心

* 这是为了能够使得我们研究小组的成员能够共享信息,减少重复劳动而开发的 文献资源共享网页。
* 这个网页是使用 PHP + MySql 建立的,我使用了软件WiKindx的源码,然后 进行了汉化和一些扩展使得它适合多用户环境。
* 如果您不是我们研究小组的成员,我们也欢迎您加入这个网页的建设。
* 如果您不参加提供文献资源,您也可以从我们的这个网页上查到您想要的文献。