AE9/AP9/SPM | 介绍与安装

前言

  AE9/AP9/SPM是由美国空军研究实验室(Air Force Research Laboratory)开发的,用于模拟近地空间辐射的模型。AE9/AP9/SPM分别用于模拟高能电子,高能质子和等离子体模型,给定卫星轨道根数或星历表,该模型将返回指定量的通量,注量或剂量,并为这些量选择适合的统计数据。AE9/AP9/SPM提供了两种安装模式:命令行版本和GUI版本。在国际合作者加入该项目之后,该模型被重命名为近地国际辐射环境(IRENE)。

下载

  AE9/AP9/SPM的项目地址位于VDL,该网站需要使用美国IP才可进行访问。我们选择使用Public AE9AP9 Account进行下载,而不使用VDL Account,因为后者需要年满18周岁的美国政府雇员,承包商或学术人员才能够申请注册。

  在填写Public AE9AP9 Account注册信息时,注意邮箱不能使用国内邮箱或者hotmail、yahoo,Zip Code填写为00000即可。注册完成之后,密码将会通过注册邮箱发送给你,由于不可知的原因你很有可能无法收到邮件,你可以向ae9ap9@vdl.afrl.af.mil发送邮件进行询问,在得到回复之后选择重置密码即可。

  AE9/AP9/SPM默认只提供Windows版本,源代码或者Linux版本需要发邮件索求之后自行编译。

第三方依赖

Warning
只有编译源代码才需要安装依赖,否则直接使用即可!

CMake

  CMake版本不低于2.6,推荐选择下载Binary distributions,源代码需要编译才能使用。

Visual Studio 2012

  下载旧版本的Visual Studio 2012或者2008。

Tip
A Windows-based FORTRAN compiler is also needed for a full source code compilation, but unfortunately, is not freely available. However, by default, the build process links to an included pre-compiled library of these FORTRAN-based routines.

  推荐下载Miniconda,并且更改源:

1
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

Qt and Qwt (optional)

  QTW是QT的一个第三方库,两者都可以直接下载安装。

HDF5 1.8.8

  HDF的全程是Hierarchical Data Format,可以存储不同类型的图像和数码数据的文件格式,文件后缀名为.hdf,下载二进制版本安装即可。

Boost 1.58.0

  Boost是为C++标准库提供扩展的程序库,下载解压后目录如图所示,依照参考资料5安装即可。

解压

  下载得到的是一个压缩文件,解压后目录结构为:

1
2
3
4
5
6
7
8
9
10
11
12
13
Ae9Ap9
bin
win32 - 预编译32位二进制文件(Windows XP/7)
win64 - 预编译64位二进制文件(Windows 7)
documents - 发行说明, 用户指南, 编译指南, 版权说明等
modelData - 模型数据文件
samples - 模型样例
unitTests - 模型的拓展数据集
source - 源代码根目录构建脚本(基础发行版中不存在源代码)
Ae9Ap9Mpi - Ae9Ap9 源代码
SpWx_Ae9Ap9 - Ae9Ap9 所依赖的空间天气模型的源代码
Ae9Ap9GuiMpi - GUI 应用源代码
buildAe9Ap9.py - Python 脚本, 用于linux, win32和win64平台的自动构建

编译

Warning
只有源代码才需要编译,否则直接使用即可!

  1. Taking note of the include and library paths for the third-party dependencies installed in the previous step, using a plain text editor, update these in the three build script configuration files:
    • Ae9Ap9/source/SpWx_Ae9Ap9/Common/internal_utils.cmake
      The configuration file contains several platform-specific sections of commands that set these paths.
    1
    2
    3
    4
    5
    Scroll down in the file to where these lines are showing:
    ##############################################################
    # config_include_lib_paths
    From here, all settings that may require modification are preceded with this line:
    # <<== END-USER MODIFIABLE ==>>

    Tip
    For Windows, use forward slashes (/) in path references.Note the set of the EXT_LIBS_ROOT variable, and its subsequent reference $(EXT_LIBS_ROOT), for ease of use in multiple places. For Windows, it is suggested to set EXT_LIBS_ROOT to C:/Program Files.

    • Ae9Ap9/source/Ae9Ap9Mpi/internal_utils.cmake
      This file is updated in the same way as the previous file, if the GUI application is desired.
    • Ae9Ap9/source/Ae9Ap9GuiMpi/trunk/Ae9Ap9Gui.pro
      The Ae9Ap9Gui source tree utilizes qmake (part of the Qt development environment) for the build process, and thus uses a slightly different file and syntax for defining the include and library paths. Important: on Linux systems, verify that the correct qmake version is being used; update the path environment variable as necessary.
      The Qt include and library paths will be automatically set properly with the installation of the Qt software. This file must only explicitly set paths for the Qwt include and library paths, as shown below. Note the platform-specific sections are also present here.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    win32 {
    INCLUDEPATH += c:\Qt\qwt-5.2.1\src
    LIBS += "c:\Qt\qwt-5.2.1\lib\libqwt5.a"
    }
    win64 {
    INCLUDEPATH += c:\Qt64\qwt-5.2.1\src
    LIBS += "c:\Qt64\qwt-5.2.1\lib\libqwt5.a"
    }
    unix {
    INCLUDEPATH += /nas/ExternalLibs/Qt/qwt-5.2/src
    LIBS += /nas/ExternalLibs/Qt/qwt-5.2/lib/libqwt.so
    }
  2. Automated Build
    The preferred method of building a source distribution of IRENE (AE9/AP9/SPM) on a supported platform is to utilize the python script called buildAe9Ap9.py, located in the Ae9Ap9/source directory of the distribution. This script will build the model library and the command-line and gui driver applications, then place them in a platform-specific subdirectory under Ae9Ap9/bin in the distribution.
    During the build process, the script will generate a log file called buildAe9Ap9.log in the Ae9Ap9/source directory; this can be used to identify any build errors encountered. At a command prompt in the Ae9Ap9/source directory, invoke the python build script, specifying the operating system name and, if needed, the mode (defaults to release): python buildAe9Ap9.py --os=<platform_name> [ --mode= ] [ --nompi ] [ --nogui ] where <platform_name> can be linux , win32 or win64, and can be release or debug.
    By default, both the single- and multi-threaded versions of the programs are built, unless the optional argument --nompi (required for win32 builds) is specified. The GUI application is also built by default; to skip this, specify the optional argument --nogui. For RedHat EL or CentOS 5.x installations only, the --gcc=gcc44 option should also be included.

Warning
debug mode increases program execution time by a factor of 10 to 20.

安装测试

CLI

  根据所用平台,在PowerShell中进入对应的二进制文件所在的目录(例如Ae9Ap9\bin\win64),输入命令:

1
.\CmdLineAe9Ap9.exe -i ..\..\samples\Ap9ShortInput.txt

  生成的输出文件位于Ae9Ap9\samples文件夹下,可以根据文件生成时间判断。我们可以通过验证生成的文件数量以及相应的文件内容是否与位于Ae9Ap9\samples\expectedOutput目录中以Ap9ShortOutput为前缀的文件是否相同来判断是否工作正常。

GUI

  在同一命令行中,可以运行Ae9Ap9Gui.exe来启动GUI程序

其他

  在Ae9Ap9\bin\win64目录下还有很多其他文件,其中只有CmdLineAe9Ap9.exeAe9Ap9Gui.exeTotalDose.exeIntegralPlasma.exeConvertToXlsx.py需要用到,其他的都是辅助程序。

参数 说明
-h 帮助,列出所有参数说明
-v 输出版本信息
-i 指定模型输入文件
-n 指定要使用的处理器数量(默认为1)
使用多线程时包括一个主处理器,会覆盖输入文件中的NumProc参数

Warning
在运行时不要更改输入输入文件,因为应用程序可能会多次访问该文件

下载地址

参考资料

  1. AE9/AP9/SPM
  2. QT第三方库:Qwt的安装与使用
  3. Windows下HDF5静态库的封装与测试
  4. 在windows平台使用CMAKE安装HDF5
  5. Windows环境下Boost的安装