1简介
SUNDIALS (SUite of Nonlinear and DIfferential/ALgebraic equation Solvers)是由美国劳伦斯利福摩尔国立实验室(Lawrence Livermore National Laboratory)开发的C语言函数库,主要用于求解大规模非线性微分/代数方程。最新的2.6.x(2015.9.9.)包括以下求解器:
CVODE solves initial value problems for ordinary differential equation (ODE) systems.
CVODES solves ODE systems and includes sensitivity analysis capabilities (forward and adjoint).
ARKODE solves initial value ODE problems with additive Runge-Kutta methods, include support for IMEX methods.
IDA solves initial value problems for differential-algebraic equation (DAE) systems.
IDAS solves DAE systems and includes sensitivity analysis capabilities (forward and adjoint).
KINSOL solves nonlinear algebraic systems.
In addition, SUNDIALS provides a Matlab interface to CVODES, IDAS, and KINSOL, sundialsTB.
其中主要的求解器经过了数十年的不断开发和完善,如下图所示:
本质上,SUNDIALS将之前开发的FORTRAN函数包进行C翻译而不是C++翻译。根据说明,这种做法有以下几点理由:
First, a general movement away from Fortran and toward C in scientific computing is apparent.
Second, the pointer, structure, and dynamic memory allocation features in C are extremely useful in software of this complexity, with the great variety of method options offered.
Finally, we prefer C over C++ for kinsol because of the wider availability of C compilers, the potentially greater efficiency of C, and the greater ease of interfacing the solver to applications written in Fortran.
SUNDIALS还提供了可选择的并行计算能力。
1编译
1.1准备
Win7 SP1 64位旗舰版。
Visual Studio 2013 SP3 win64,先安装。
SUNDIALS:http://computation.llnl.gov/casc/sundials/download/download.php。
建议下载2.5.0版本(不具有ARKODE求解器),笔者测试时(2015.9.9.),用Cmake编译2.6.0时似乎有一些问题。
Cmake:http://www.cmake.org/download/。
笔者测试时(2015.9.9.),用Cmake 3.3.1。
1.2 Cmake编译SUNDIALS-2.5.0
1.2.1建立工作目录
笔者在C盘根目录建立如下路径:
即建立C:\sundials路径,并在其中分别建立三个文件夹:sundials-2.5.0-src、sundials-2.5.0-build、sundials-2.5.0-install。其中,sundials-2.5.0-src用于存放SUNDIALS解压缩文件:
sundials-2.5.0-build存放