当前位置:   article > 正文

WRF模型配置_!!! configure.wrf has been removed !!!

!!! configure.wrf has been removed !!!

1.相关说明

VMware:VMware Workstation 16 Pro
Ubuntu:ubuntu-14.04.6-desktop-amd64.iso
官方文档:How to Compile WRF: The Complete Process
参考视频:WRF配置(英文文字提要)
参考博客:Ubuntu中配置WRF
注:本笔记适合WRF小白,如有错误请留言

2.System Environment Tests

1.安装csh,gfortran,m4和build-essential
按ctrl+alt+t,打开命令行终端

test@test:~$ sudo apt-get install csh gfortran m4 build-essential
  • 1

当出现E: Unable to locate package错误时有两种方法,解决方法1:sudo apt-get update更新一下apt-get;解决方法2:当执行sudo apt-get update也继续报错时(我就是出现了这种情况),你需要去更新镜像源,我在系统设置中的软件与更新中,更新为国内镜像网站,但是更新的时候总是提示网络连接有问题,而我的网络连接是没有问题的,可以浏览各种网页,就是更新不了软件包,这个时候你需要打开,在命令行中输入sudo nano /etc/apt/sources.list,将http://cn.archive.ubuntu.com/ubuntu/替换成其他的,我把它替换成了http://mirrors.163.com/ubuntu/,就可以运行了。具体可参考Ubuntu软件更新过程中系统提示网络连接失败,如果更换了还是不行,可以试一试更换一下网络,有时候是网络不行。
注意这里需要你输入密码,输入密码在终端是不会显示的,只需直接输入按enter键即可。
2.system environment test
First and foremost, it is very important to have a gfortran compiler, as well as gcc and cpp. To test whether these exist on the system, type the following:

test@test:~$ which [文件]
  • 1

得出下面结果即可:

test@test:~$ which gfortran
/usr/bin/gfortran
test@test:~$ which cpp
/usr/bin/cpp
test@test:~$ which gcc
/usr/bin/gcc
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

3.check your gcc version. it is recommend using version 4.4.0 or later.
检查版本号

test@test:~$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  • 1
  • 2
  • 3
  • 4
  • 5

4.Create a new, clean directory called Build_WRF, and another one called TESTS.

test@test:~$ mkdir Build_WRF TESTS
  • 1

5.Below is a tar file that contains the tests. Download the tar file and place it in the TESTS directory.
切换到TESTS文件夹下

test@test:~$ cd TESTS/
  • 1

下载Fortran and C Tests Tar File

test@test:~/TESTS$ wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_tests.tar
  • 1

在TESTS文件夹下解压Fortran_C_tests.tar文件

test@test:~/TESTS$ tar -xvf Fortran_C_tests.tar
  • 1

There are 7 tests available, so start at the top and run through them, one at a time.
Test #1: Fixed Format Fortran Test: TEST_1_fortran_only_fixed.f

test@test:~/TESTS$ gfortran TEST_1_fortran_only_fixed.f
test@test:~/TESTS$ ./a.out
 SUCCESS test 1 fortran only fixed format
  • 1
  • 2
  • 3

Test #2: Free Format Fortran: TEST_2_fortran_only_free.f90

test@test:~/TESTS$ gfortran TEST_2_fortran_only_free.f90
test@test:~/TESTS$ ./a.out
 Assume Fortran 2003: has FLUSH, ALLOCATABLE derived type, and ISO C Binding
 SUCCESS test 2 fortran only free format
  • 1
  • 2
  • 3
  • 4

Test #3: C: TEST_3_c_only.c

test@test:~/TESTS$ gcc TEST_3_c_only.c
test@test:~/TESTS$ ./a.out
SUCCESS test 3 C only
  • 1
  • 2
  • 3

Test #4: Fortran Calling a C Function (our gcc and gfortran have different defaults, so we force both to always use 64 bit [-m64] when combining them): TEST_4_fortran+c_c.c, and TEST_4_fortran+x_f.f90

test@test:~/TESTS$ gcc -c -m64 TEST_4_fortran+c_c.c
test@test:~/TESTS$ gfortran -c -m64 TEST_4_fortran+c_f.f90
test@test:~/TESTS$ gfortran -m64 TEST_4_fortran+c_f.o TEST_4_fortran+c_c.o
test@test:~/TESTS$ ./a.out
   C function called by Fortran
   Values are xx =  2.00 and ii = 1 
 SUCCESS test 4 fortran calling c
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

Test #5:csh In the command line, type:

test@test:~/TESTS$ csh TEST_csh.csh
SUCCESS csh test
  • 1
  • 2

Test #6:perl In the command line, type:

test@test:~/TESTS$ ./TEST_perl.pl
SUCCESS perl test
  • 1
  • 2

Test #7:sh In the command line, type:

test@test:~/TESTS$ ./TEST_sh.sh
SUCCESS sh test
  • 1
  • 2

#退回原来的目录下

test@test:~/TESTS$ cd ..
  • 1

3.Building Libraries

Before getting started, you need to make another directory. Go inside your Build_WRF directory:

test@test:~$ cd Build_WRF/
test@test:~/Build_WRF$ mkdir LIBRARIES
  • 1
  • 2

Depending on the type of run you wish to make, there are various libraries that should be installed. Below are 5 libraries. Download all 5 tar files and place them in the LIBRARIES directory.
根据您希望进行的运行类型,应该安装不同的库。下面是5个库。下载所有5个tar文件并将它们放在LIBRARIES目录中。
mpich-3.0.4

test@test:~/Build_WRF$ cd LIBRARIES/
test@test:~/Build_WRF/LIBRARIES$ wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-3.0.4.tar.gz
  • 1
  • 2

netcdf-4.1.3

test@test:~/Build_WRF/LIBRARIES$ wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/netcdf-4.1.3.tar.gz
  • 1

jasper-1.900.1.tar.gz

test@test:~/Build_WRF/LIBRARIES$ wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz
  • 1

libpng-1.2.50.tar.gz

test@test:~/Build_WRF/LIBRARIES$ wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/libpng-1.2.50.tar.gz
  • 1

zlib-1.2.7.tar.gz

test@test:~/Build_WRF/LIBRARIES$ wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/zlib-1.2.7.tar.gz
  • 1

It is important to note that these libraries must all be installed with the same compilers as will be used to install WRF and WPS.
Before installing the libraries, these paths need to be set:Modify the .bashrc file in the home directory of current user to set the environment variables.

test@test:~/Build_WRF/LIBRARIES$ sudo nano ~/.bashrc
  • 1

输入密码,进入之后下拉到底部空白的地方,填写以下内容:

# WRF environment variables
export DIR=/home/test/Build_WRF/LIBRARIES 注意这里需要填写自己的路径
export CC=gcc
export CXX=g++
export FC=gfortran
export FCFLAGS=-m64
export F77=gfortran
export FFLAGS=-m64
export JASPERLIB=$DIR/grib2/lib
export JASPERINC=$DIR/grib2/include
export LDFLAGS=-L$DIR/grib2/lib
export CPPFLAGS=-I$DIR/grib2/include
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

输入完之后,按ctrl+x键,再按y键,再按enter键就可保存设置的环境变量,自动退出到命令终端中。
Then source the .bashrc file to make these settings active for current session.

test@test:~/Build_WRF/LIBRARIES$ source ~/.bashrc
  • 1

解压netcdf-4.1.3.tar.gz文件

test@test:~/Build_WRF/LIBRARIES$ tar -zxvf netcdf-4.1.3.tar.gz
  • 1

进入netcdf-4.1.3d目录,并使用显示的参数运行configure脚本,然后运行make和make install。

test@test:~/Build_WRF/LIBRARIES$ cd netcdf-4.1.3/
test@test:~/Build_WRF/LIBRARIES/netcdf-4.1.3$ ./configure --prefix=$DIR/netcdf --disable-dap --disable-netcdf-4 --disable-shared
  • 1
  • 2
test@test:~/Build_WRF/LIBRARIES/netcdf-4.1.3$ make
  • 1
test@test:~/Build_WRF/LIBRARIES/netcdf-4.1.3$ make install
  • 1

再次修改.bashrc文件,并在底部设置两个新的环境变量

test@test:~/Build_WRF/LIBRARIES/netcdf-4.1.3$ sudo nano ~/.bashrc
在打开窗口输入:export PATH=$DIR/netcdf/bin:$PATH
              export NETCDF=$DIR/netcdf
test@test:~/Build_WRF/LIBRARIES/netcdf-4.1.3$ source ~/.bashrc
test@test:~/Build_WRF/LIBRARIES/netcdf-4.1.3$ cd ..
test@test:~/Build_WRF/LIBRARIES$ 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

MPICH: This library is necessary if you are planning to build WRF in parallel. If your machine does not have more than 1 processor, or if you have no need to run WRF with multiple processors, you can skip installing MPICH.

test@test:~/Build_WRF/LIBRARIES$ tar -zxvf mpich-3.0.4.tar.gz
  • 1
test@test:~/Build_WRF/LIBRARIES$ cd mpich-3.0.4/
  • 1
test@test:~/Build_WRF/LIBRARIES/mpich-3.0.4$ ./configure --prefix=$DIR/mpich
  • 1
test@test:~/Build_WRF/LIBRARIES/mpich-3.0.4$ make
  • 1
test@test:~/Build_WRF/LIBRARIES/mpich-3.0.4$ make install
  • 1
test@test:~/Build_WRF/LIBRARIES/mpich-3.0.4$ sudo nano ~/.bashrc
在打开窗口输入:export PATH=$DIR/mpich/bin:$PATH
  • 1
  • 2
test@test:~/Build_WRF/LIBRARIES/mpich-3.0.4$ source ~/.bashrc
test@test:~/Build_WRF/LIBRARIES/mpich-3.0.4$ cd ..
test@test:~/Build_WRF/LIBRARIES$ 
  • 1
  • 2
  • 3

zlib: This is a compression library necessary for compiling WPS (specifically ungrib) with GRIB2 capability

test@test:~/Build_WRF/LIBRARIES$ tar -zxvf zlib-1.2.7.tar.gz
  • 1
test@test:~/Build_WRF/LIBRARIES$ cd zlib-1.2.7/
  • 1
test@test:~/Build_WRF/LIBRARIES/zlib-1.2.7$ ./configure --prefix=$DIR/grib2
  • 1
test@test:~/Build_WRF/LIBRARIES/zlib-1.2.7$ make
  • 1
test@test:~/Build_WRF/LIBRARIES/zlib-1.2.7$ make install
  • 1
test@test:~/Build_WRF/LIBRARIES/zlib-1.2.7$ cd ..
  • 1

libpng: This is a compression library necessary for compiling WPS (specifically ungrib) with GRIB2 capability

test@test:~/Build_WRF/LIBRARIES$ tar -zxvf libpng-1.2.50.tar.gz
  • 1
test@test:~/Build_WRF/LIBRARIES$ cd libpng-1.2.50/
  • 1
test@test:~/Build_WRF/LIBRARIES/libpng-1.2.50$ ./configure --prefix=$DIR/grib2
  • 1
test@test:~/Build_WRF/LIBRARIES/libpng-1.2.50$ make
  • 1
test@test:~/Build_WRF/LIBRARIES/libpng-1.2.50$ make install
  • 1
test@test:~/Build_WRF/LIBRARIES/libpng-1.2.50$ cd ..
  • 1

Jasper: This is a compression library necessary for compiling WPS (specifically ungrib) with GRIB2 capability

test@test:~/Build_WRF/LIBRARIES$ tar -zxvf jasper-1.900.1.tar.gz
test@test:~/Build_WRF/LIBRARIES$ cd jasper-1.900.1/
test@test:~/Build_WRF/LIBRARIES/jasper-1.900.1$ ./configure --prefix=$DIR/grib2
test@test:~/Build_WRF/LIBRARIES/jasper-1.900.1$ make
test@test:~/Build_WRF/LIBRARIES/jasper-1.900.1$ make install
test@test:~/Build_WRF/LIBRARIES/jasper-1.900.1$ cd ..
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

4.Library Compatibility Tests

返回到最前面的目录

test@test:~/Build_WRF/LIBRARIES$ cd ..
test@test:~/Build_WRF$ cd ..
test@test:~$ 
  • 1
  • 2
  • 3

验证这些库是否能够与将用于WPS和WRF构建的编译器一起使用
Below is a tar file that contans these tests. Download this tar file and place it in the TESTS directory, and then “cd” into the TESTS directory:
Fortran_C_NETCDF_MPI_tests.tar

test@test:~$ cd TESTS/
test@test:~/TESTS$ wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_NETCDF_MPI_tests.tar
test@test:~/TESTS$ tar -xvf Fortran_C_NETCDF_MPI_tests.tar
  • 1
  • 2
  • 3

Test #1: Fortran + C + NetCDF

test@test:~/TESTS$ cp ${NETCDF}/include/netcdf.inc .
test@test:~/TESTS$ gfortran -c 01_fortran+c+netcdf_f.f
test@test:~/TESTS$ gcc -c 01_fortran+c+netcdf_c.c
test@test:~/TESTS$ gfortran 01_fortran+c+netcdf_f.o 01_fortran+c+netcdf_c.o -L${NETCDF}/lib -lnetcdff -lnetcdf
test@test:~/TESTS$ ./a.out
   C function called by Fortran
   Values are xx =  2.00 and ii = 1 
 SUCCESS test 1 fortran + c + netcdf
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

Test #2: Fortran + C + NetCDF + MPI

test@test:~/TESTS$ cp ${NETCDF}/include/netcdf.inc .
test@test:~/TESTS$ mpif90 -c 02_fortran+c+netcdf+mpi_f.f
test@test:~/TESTS$ mpicc -c 02_fortran+c+netcdf+mpi_c.c
test@test:~/TESTS$ mpif90 02_fortran+c+netcdf+mpi_f.o 02_fortran+c+netcdf+mpi_c.o -L${NETCDF}/lib -lnetcdff -lnetcdf
test@test:~/TESTS$ mpirun ./a.out
   C function called by Fortran
   Values are xx =  2.00 and ii = 1 
 status =            2
 SUCCESS test 2 fortran + c + netcdf + mpi
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

5.Building WRF

我这里用的WRF版本是WRF-4.1.2.tar.gz,如果想安装其他版本可以到官网上去下载。我是先下载好,然后把它放入Build_WRF目录下,之后进行解压。

test@test:~/TESTS$ cd ..
test@test:~$ cd Build_WRF/
  • 1
  • 2

因为包已经下载好了,故不需要进行wget。

test@test:~/Build_WRF$ tar -zxvf WRF-4.1.2.tar.gz 
  • 1
test@test:~/Build_WRF$ cd WRF-4.1.2/
test@test:~/Build_WRF/WRF-4.1.2$ ./configure
checking for perl5... no
checking for perl... found /usr/bin/perl (perl)
Will use NETCDF in dir: /home/test/Build_WRF/LIBRARIES/netcdf
HDF5 not set in environment. Will configure WRF for use without.
PHDF5 not set in environment. Will configure WRF for use without.
Will use 'time' to report timing information


If you REALLY want Grib2 output from WRF, modify the arch/Config.pl script.
Right now you are not getting the Jasper lib, from the environment, compiled into WRF.

------------------------------------------------------------------------
Please select from among the following Linux x86_64 options:

  1. (serial)   2. (smpar)   3. (dmpar)   4. (dm+sm)   PGI (pgf90/gcc)
  5. (serial)   6. (smpar)   7. (dmpar)   8. (dm+sm)   PGI (pgf90/pgcc): SGI MPT
  9. (serial)  10. (smpar)  11. (dmpar)  12. (dm+sm)   PGI (pgf90/gcc): PGI accelerator
 13. (serial)  14. (smpar)  15. (dmpar)  16. (dm+sm)   INTEL (ifort/icc)
                                         17. (dm+sm)   INTEL (ifort/icc): Xeon Phi (MIC architecture)
 18. (serial)  19. (smpar)  20. (dmpar)  21. (dm+sm)   INTEL (ifort/icc): Xeon (SNB with AVX mods)
 22. (serial)  23. (smpar)  24. (dmpar)  25. (dm+sm)   INTEL (ifort/icc): SGI MPT
 26. (serial)  27. (smpar)  28. (dmpar)  29. (dm+sm)   INTEL (ifort/icc): IBM POE
 30. (serial)               31. (dmpar)                PATHSCALE (pathf90/pathcc)
 32. (serial)  33. (smpar)  34. (dmpar)  35. (dm+sm)   GNU (gfortran/gcc)
 36. (serial)  37. (smpar)  38. (dmpar)  39. (dm+sm)   IBM (xlf90_r/cc_r)
 40. (serial)  41. (smpar)  42. (dmpar)  43. (dm+sm)   PGI (ftn/gcc): Cray XC CLE
 44. (serial)  45. (smpar)  46. (dmpar)  47. (dm+sm)   CRAY CCE (ftn $(NOOMP)/cc): Cray XE and XC
 48. (serial)  49. (smpar)  50. (dmpar)  51. (dm+sm)   INTEL (ftn/icc): Cray XC
 52. (serial)  53. (smpar)  54. (dmpar)  55. (dm+sm)   PGI (pgf90/pgcc)
 56. (serial)  57. (smpar)  58. (dmpar)  59. (dm+sm)   PGI (pgf90/gcc): -f90=pgf90
 60. (serial)  61. (smpar)  62. (dmpar)  63. (dm+sm)   PGI (pgf90/pgcc): -f90=pgf90
 64. (serial)  65. (smpar)  66. (dmpar)  67. (dm+sm)   INTEL (ifort/icc): HSW/BDW
 68. (serial)  69. (smpar)  70. (dmpar)  71. (dm+sm)   INTEL (ifort/icc): KNL MIC
 72. (serial)  73. (smpar)  74. (dmpar)  75. (dm+sm)   FUJITSU (frtpx/fccpx): FX10/FX100 SPARC64 IXfx/Xlfx

Enter selection [1-75] : 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38

在这里停下来,填32,然后按enter键

------------------------------------------------------------------------
Compile for nesting? (0=no nesting, 1=basic, 2=preset moves, 3=vortex following) [default 0]: 1
  • 1
  • 2

这里填1即可,然后按enter键,得到下面结果

######################
------------------------------------------------------------------------
Settings listed above are written to configure.wrf.
If you wish to change settings, please edit that file.
If you wish to change the default options, edit the file:
     arch/configure.defaults
NetCDF users note:
 This installation of NetCDF supports large file support.  To DISABLE large file
 support in NetCDF, set the environment variable WRFIO_NCD_NO_LARGE_FILE_SUPPORT
 to 1 and run configure again. Set to any other value to avoid this message.
  

Testing for NetCDF, C and Fortran compiler

This installation of NetCDF is 64-bit
                 C compiler is 64-bit
           Fortran compiler is 64-bit
              It will build in 64-bit

 
 
************************** W A R N I N G ************************************
 
There are some IEEE Fortran 2003 features in WRF that your compiler does not
recognize. The IEEE function calls have been removed.
 
*****************************************************************************
*****************************************************************************
This build of WRF will use classic (non-compressed) NETCDF format
*****************************************************************************
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

对实际案例进行编译WRF

test@test:~/Build_WRF/WRF-4.1.2$ ./compile em_real >& compile.log &
[1] 101211
test@test:~/Build_WRF/WRF-4.1.2$ tail -f compile.log
  • 1
  • 2
  • 3

编译结果如下所示:

==========================================================================
build started:   20220222日 星期二 23:50:12 CST
build completed: 20220223日 星期三 00:04:45 CST
 
--->                  Executables successfully built                  <---
 
-rwxrwxr-x 1 test test 45616498  223 00:04 main/ndown.exe
-rwxrwxr-x 1 test test 45473006  223 00:04 main/real.exe
-rwxrwxr-x 1 test test 44965567  223 00:04 main/tc.exe
-rwxrwxr-x 1 test test 50220274  223 00:04 main/wrf.exe
 
==========================================================================
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

运行到这里会卡住,如果成功了,在~/Build_WRF/WRF/main文件夹里是否有wrf.exe等4个文件,看一下关闭终端然后接着做

6.Building WPS

我这里使用的WPS是WPS-4.1.tar.gz,如果想安装其他版本可以到官网上去下载。我是先下载好,然后把它放入Build_WRF目录下,之后进行解压。

test@test:~$ cd Build_WRF/
test@test:~/Build_WRF$ tar -zxvf WPS-4.1.tar.gz 
  • 1
  • 2
test@test:~/Build_WRF$ cd WPS-4.1/
test@test:~/Build_WRF/WPS-4.1$ ./clean
  • 1
  • 2

The next step is to configure WPS, however, you first need to set some paths for the ungrib libraries:

test@test:~/Build_WRF/WPS-4.1$ sudo nano ~/.bashrc
在后面输入:export WRF_DIR=../WRF-4.1.2
  • 1
  • 2
test@test:~/Build_WRF/WPS-4.1$ source ~/.bashrc
test@test:~/Build_WRF/WPS-4.1$ ./configure
Will use NETCDF in dir: /home/test/Build_WRF/LIBRARIES/netcdf
Using WRF I/O library in WRF build identified by $WRF_DIR: ../WRF-4.1.2
Found Jasper environment variables for GRIB2 support...
  $JASPERLIB = /home/test/Build_WRF/LIBRARIES/grib2/lib
  $JASPERINC = /home/test/Build_WRF/LIBRARIES/grib2/include
------------------------------------------------------------------------
Please select from among the following supported platforms.

   1.  Linux x86_64, gfortran    (serial)
   2.  Linux x86_64, gfortran    (serial_NO_GRIB2)
   3.  Linux x86_64, gfortran    (dmpar)
   4.  Linux x86_64, gfortran    (dmpar_NO_GRIB2)
   5.  Linux x86_64, PGI compiler   (serial)
   6.  Linux x86_64, PGI compiler   (serial_NO_GRIB2)
   7.  Linux x86_64, PGI compiler   (dmpar)
   8.  Linux x86_64, PGI compiler   (dmpar_NO_GRIB2)
   9.  Linux x86_64, PGI compiler, SGI MPT   (serial)
  10.  Linux x86_64, PGI compiler, SGI MPT   (serial_NO_GRIB2)
  11.  Linux x86_64, PGI compiler, SGI MPT   (dmpar)
  12.  Linux x86_64, PGI compiler, SGI MPT   (dmpar_NO_GRIB2)
  13.  Linux x86_64, IA64 and Opteron    (serial)
  14.  Linux x86_64, IA64 and Opteron    (serial_NO_GRIB2)
  15.  Linux x86_64, IA64 and Opteron    (dmpar)
  16.  Linux x86_64, IA64 and Opteron    (dmpar_NO_GRIB2)
  17.  Linux x86_64, Intel compiler    (serial)
  18.  Linux x86_64, Intel compiler    (serial_NO_GRIB2)
  19.  Linux x86_64, Intel compiler    (dmpar)
  20.  Linux x86_64, Intel compiler    (dmpar_NO_GRIB2)
  21.  Linux x86_64, Intel compiler, SGI MPT    (serial)
  22.  Linux x86_64, Intel compiler, SGI MPT    (serial_NO_GRIB2)
  23.  Linux x86_64, Intel compiler, SGI MPT    (dmpar)
  24.  Linux x86_64, Intel compiler, SGI MPT    (dmpar_NO_GRIB2)
  25.  Linux x86_64, Intel compiler, IBM POE    (serial)
  26.  Linux x86_64, Intel compiler, IBM POE    (serial_NO_GRIB2)
  27.  Linux x86_64, Intel compiler, IBM POE    (dmpar)
  28.  Linux x86_64, Intel compiler, IBM POE    (dmpar_NO_GRIB2)
  29.  Linux x86_64 g95 compiler     (serial)
  30.  Linux x86_64 g95 compiler     (serial_NO_GRIB2)
  31.  Linux x86_64 g95 compiler     (dmpar)
  32.  Linux x86_64 g95 compiler     (dmpar_NO_GRIB2)
  33.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (serial)
  34.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (serial_NO_GRIB2)
  35.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (dmpar)
  36.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (dmpar_NO_GRIB2)
  37.  Cray XC CLE/Linux x86_64, Intel compiler   (serial)
  38.  Cray XC CLE/Linux x86_64, Intel compiler   (serial_NO_GRIB2)
  39.  Cray XC CLE/Linux x86_64, Intel compiler   (dmpar)
  40.  Cray XC CLE/Linux x86_64, Intel compiler   (dmpar_NO_GRIB2)

Enter selection [1-40] : 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52

在运行处停下来的地方填1,enter即可,结果如下:

Enter selection [1-40] : 1
------------------------------------------------------------------------
Configuration successful. To build the WPS, type: compile
------------------------------------------------------------------------

Testing for NetCDF, C and Fortran compiler

This installation NetCDF is 64-bit
C compiler is 64-bit
Fortran compiler is 64-bit
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

metgrid.exe和geogrid.exe程序依赖于configure.wps文件,该文件将WPS构建系统从WRF模型引导到I / O库的位置:WRF_DIR = …/WRF-4.1.2

test@test:~/Build_WRF/WPS-4.1$ sudo nano configure.wps
  • 1

Above is the default setting. As long as the name of the WRF model’s top-level directory is “WRF” and the WPS and WRF directories are at the same level (which they should be if you have followed exactly as instructed on this page so far), then the existing default setting is correct and there is no need to change it. If it is not correct, you must modify the configure file and then save the changes before compiling.
以上是默认设置。只要WRF模型的顶级目录名为“WRF”,并且WPS和WRF目录处于同一级别(如果您完全按照本页上的说明进行操作,则应该是同一级别),那么现有的默认设置是正确的,无需更改。如果不正确,则必须修改配置文件,然后在编译之前保存更改。

test@test:~/Build_WRF/WPS-4.1$ ./compile >& compile.log &
[1] 109655
test@test:~/Build_WRF/WPS-4.1$ tail -f compile.log
make[1]:正在离开目录 `/home/test/Build_WRF/WPS-4.1/util/src'
if [ -h int2nc.exe ] ; then \
		/bin/rm -f int2nc.exe ; \
	fi ; \
	if [ -h ../int2nc.exe ] ; then \
		/bin/rm -f ../int2nc.exe ; \
	fi ; \
	if [ -e src/int2nc.exe ] ; then \
		ln -sf src/int2nc.exe . ; \
	fi
#运行到这里卡住,按Ctrl+C键结束进程:
^C[1]+  已完成               ./compile &> compile.log

test@test:~/Build_WRF/WPS-4.1$ ls -las *.exe
0 lrwxrwxrwx 1 test test 23  223 00:39 geogrid.exe -> geogrid/src/geogrid.exe
0 lrwxrwxrwx 1 test test 23  223 00:39 metgrid.exe -> metgrid/src/metgrid.exe
0 lrwxrwxrwx 1 test test 21  223 00:39 ungrib.exe -> ungrib/src/ungrib.exe
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

编译完成后,要检查编译是否成功,需要在WPS顶级目录中查找3个主要的可执行文件,然后确认它们的大小不为零。

7.Static geography data

WRF建模系统能够创建理想的模拟,尽管大多数用户对实际数据案例感兴趣。 要启动实际数据案例,必须创建域在地球上的物理位置以及该位置的静态信息。
这需要一个数据集,其中包括地形和土地用途分类等字段。 移至Build_WRF目录,下载文件并解压缩。 解压缩文件时,它将被称为“ geog”,将其重命名为“ WPS_GEOG”。
geog_10m.tar.gz

test@test:~/Build_WRF/WPS-4.1$ cd ..
test@test:~/Build_WRF$ tar -zxvf geog_10m.tar.gz
  • 1
  • 2

把解压出来的geog文件夹改名字成WPS_GEOG

test@test:~/Build_WRF$ mv geog WPS_GEOG
  • 1

The directory infomation is given to the geogrid program in the namelist.wps file in the &geogrid section. The complete data expands to approximately 10 GB. This data allows a user to run the geogrid.exe program.
目录信息在&geogrid部分的namelist.wps文件中提供给geogrid程序。 完整的数据将扩展到大约10 GB。 该数据允许用户运行geogrid.exe程序。

test@test:~/Build_WRF$ cd WPS-4.1/
test@test:~/Build_WRF/WPS-4.1$ nano namelist.wps
  • 1
  • 2

把geog_data_path = '/glade/p/work/wrfhelp/WPS_GEOG/'改成geog_data_path = ‘/home/test/Build_WRF/WPS_GEOG/’

8.Post processing

ARWpost is a Fortran program that reads WRF-ARW input and output file, then generates GrADS output files.
ARWpost是一个Fortran程序,它读取WRF-ARW输入和输出文件,然后生成GrADS输出文件。

Once the output files have been generated, GrADS can be used to produce horizontal or vertical cross-section plots of scalar fields(contours) or vector fields(barbs or arrows),vertical profiles and soundings.
一旦生成了输出文件,即可使用GrADS生成标量场(轮廓)或矢量场(倒钩或箭头),垂直剖面和测深的水平或垂直横截面图。

Is recommend the use of ARW post Version 3 or higher. This code is not dependent on the successful compilation of the WRFV3 code, and can therefore be installed anywhere, even if WRFV3 is not installed on this computer.
建议在版本3或更高版本中使用ARW。 此代码不依赖于WRFV3代码的成功编译,因此即使未在此计算机上安装WRFV3,也可以将其安装在任何位置。

Move to your Build_WRF directory, download the file and unpack it.
移至Build_WRF目录,下载文件并解压缩

test@test:~/Build_WRF/WPS-4.1$ cd ..
test@test:~/Build_WRF$ tar -zxvf ARWpost_V3.tar.gz
  • 1
  • 2

Once unpacked,move to AWRpost directory and look for the following files:
解压缩后,移至AWRpost目录并查找以下文件:
arch, clean, compile, configure, namelist.ARWpost, README, src, script and util.

test@test:~/Build_WRF$ cd ARWpost/
test@test:~/Build_WRF/ARWpost$ ls -las
总用量 60
4 drwxr-xr-x 6 test test 4096  32  2011 .
4 drwxrwxr-x 7 test test 4096  223 01:13 ..
4 drwxr-xr-x 2 test test 4096  223 01:13 arch
4 -rwxr-xr-x 1 test test  905  525  2007 clean
4 -rwxr-xr-x 1 test test  490 1216  2010 compile
8 -rwxr-xr-x 1 test test 4257  525  2007 configure
4 -rw-r--r-- 1 test test   12  525  2007 fields.plt
4 -rw-r--r-- 1 test test   19  525  2007 myLIST
4 -rw-r--r-- 1 test test 1150 1216  2010 namelist.ARWpost
8 -rw-r--r-- 1 test test 7189 1216  2010 README
4 drwxr-xr-x 2 test test 4096  223 01:13 scripts
4 drwxr-xr-x 2 test test 4096  223 01:13 src
4 drwxr-xr-x 2 test test 4096  32  2011 util
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

Assuming that the NETCDF variable is set, it is possible to configure the ARWpost.
假设已设置NETCDF变量,则可以配置ARWpost。

test@test:~/Build_WRF/ARWpost$ ./configure
Will use NETCDF in dir: /home/test/Build_WRF/LIBRARIES/netcdf
------------------------------------------------------------------------
Please select from among the following supported platforms.

   1.  PC Linux i486 i586 i686 x86_64, PGI compiler	
   2.  PC Linux i486 i586 i686 x86_64, Intel compiler	
   3.  PC Linux i486 i586 i686 x86_64, gfortran compiler 

Enter selection [1-3] : 3
------------------------------------------------------------------------
Configuration successful. To build the ARWpost, type: compile 
------------------------------------------------------------------------
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

Edit the Makefile file into the src directory and modify the -L$(NETCDF) line into the ARWpost.exe environment.
将Makefile文件编辑到src目录中,并将-L $(NETCDF)行修改到ARWpost.exe环境中。

test@test:~/Build_WRF/ARWpost$ cd src/
test@test:~/Build_WRF/ARWpost/src$ nano Makefile
  • 1
  • 2
ARWpost.exe: $(OBJS)
        $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $(OBJS)  \
                -L$(NETCDF)/lib -lnetcdf -lnetcdff -I$(NETCDF)/include  -lnetcdf
添加-lnetcdf -lnetcdff部分
  • 1
  • 2
  • 3
  • 4

Move to the ARWpost directory and modify the CFLAGS and CPP lines into the configure.arwp file.
移至ARWpost目录,然后将CFLAGS和CPP行修改为configure.arwp文件。

test@test:~/Build_WRF/ARWpost/src$ cd ..
test@test:~/Build_WRF/ARWpost$ nano configure.arwp
  • 1
  • 2

CPP = /lib/cpp -C -P -traditional 变为 CPP = /lib/cpp -P -traditional

CFLAGS = -m64变为CFLAGS = -fPIC -m64

Then compile the ARWpost. If successful, the executable ARWpost.exe will be created.
然后编译ARWpost。 如果成功,将创建可执行文件ARWpost.exe。

test@test:~/Build_WRF/ARWpost$ ./compile
  • 1
test@test:~/Build_WRF/ARWpost$ ls -ls *.exe
0 lrwxrwxrwx 1 test test 15  223 01:24 ARWpost.exe -> src/ARWpost.exe
  • 1
  • 2

到这里就结束了!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/556051
推荐阅读
相关标签
  

闽ICP备14008679号