ncep-coupler编译和安装

操作步骤

  1. 执行以下命令进入目录解压安装包。

    cd /path/to/hwrf/wrfrun/sorc/
    tar -xvf ../../HWRF_v4.0a_ncep-coupler.tar.gz

  2. 执行以下命令新建patch-ncep-coupler。

    vim patch-ncep-coupler

    输入以下内容并保存。

    diff -Nur ncep-coupler/arch/configure.defaults ncep-coupler_ok/arch/configure.defaults
    --- ncep-coupler/arch/configure.defaults	2018-07-21 04:54:54.012340000 +0800
    +++ ncep-coupler_ok/arch/configure.defaults	2023-07-21 15:22:56.291770420 +0800
    @@ -1,4 +1,30 @@
     ###########################################################
    +#ARCH   Linux aarch64, Bisheng compiler KML     # dmpar
    +#
    +LDFLAGS        =   -fopenmp -Wl,--build-id -ltirpc -Wl,-noinhibit-exec -L$(HMPI_LIB) -L$(KML_LIB) -lkm_l9 -lkm -lmathlib
    +
    +BYTE_ORDER     =   BIG_ENDIAN
    +SFC            =   mpifort -fopenmp
    +SF90           =   mpifort -fopenmp -ffree-form
    +SCC            =   mpicc -fopenmp
    +FFLAGS         =   -O3 -ffp-model=precise -fconvert=big-endian -DLINUX -I$(HMPI_INC)
    +DEBUG_FLAGS    =   -O0 -g -traceback -I$(HMPI_INC)
    +CPP            =   cpp -p
    +CPPFLAGS       =   -traditional-cpp -D$(BYTE_ORDER)
    +ARFLAGS        =   ru
    +
    +DM_FC          =   mpifort
    +DM_F90         =   mpifort -ffree-form
    +DM_CC          =   mpicc
    +
    +FC             =   $(DM_FC)
    +F90            =   $(DM_F90)
    +CC             =   $(DM_CC)
    +
    +CFLAGS         =
    +
    +ESSLLIB        =   -L$(KML_LIB)/kblas/omp -lkblas
    +###########################################################
     #ARCH	AIX  #dmpar
     #
    
    diff -Nur ncep-coupler/hwrf_wm3c/cpl3.f ncep-coupler_ok/hwrf_wm3c/cpl3.f
    --- ncep-coupler/hwrf_wm3c/cpl3.f	2018-09-19 21:51:27.636869000 +0800
    +++ ncep-coupler_ok/hwrf_wm3c/cpl3.f	2023-07-21 15:45:48.963770420 +0800
    @@ -34,7 +34,7 @@
                                 ! supports Sam's new amendment
    
           TYPE ARRAY2
    -        real(kind=kind_REAL),dimension(:,:),pointer:: ar
    +        real,dimension(:,:),pointer:: ar
           END TYPE ARRAY2
           TYPE IARRAY1
             integer,dimension(:),pointer:: ar
    @@ -44,8 +44,8 @@
           END TYPE IARRAY2
    
           TYPE PARR2
    -        real(kind=kind_REAL),dimension(:,:),pointer:: gar
    -        real(kind=kind_REAL),dimension(:,:),pointer:: lar
    +        real,dimension(:,:),pointer:: gar
    +        real,dimension(:,:),pointer:: lar
             logical:: lar_pointed=.false.
           END TYPE PARR2
           TYPE IPARR2
    @@ -54,7 +54,7 @@
             logical:: lar_pointed=.false.
           END TYPE IPARR2
    
    -      real(kind=kind_REAL),dimension(:),allocatable::
    +      real,dimension(:),allocatable::
          >lakeval_o,lakeval_w !(NSF_a2o,NSF_a2w resp., for the time being;
                               ! later with surf. filelds other than AM
                               ! fields and OM SST transmitted it could be
    @@ -104,7 +104,7 @@
           TYPE (IPARR2), dimension(:), allocatable::
          >MASK_a2                                      ! (0:nga-1)
           integer,dimension(:,:),pointer:: MASK_a_fluxes
    -      real(kind=kind_REAL),dimension(:,:),allocatable:: bf_a
    +      real,dimension(:,:),allocatable:: bf_a
           TYPE (PARR2) buf_a
    
           logical BG /.false./   ! to be assigned .true. for B-grid (NMMB)
    @@ -129,9 +129,9 @@
          >,UDPCUR_o,VDPCUR_o,WBC_o,DPM_o
          >,Stks_X_o,Stks_Y_o,KPPH_o             ! 3-comp. coupling Phase 4
     !<
    -      real(kind=kind_REAL),dimension(:,:),allocatable::
    +      real,dimension(:,:),allocatable::
          >SST_o0,SST_o_i,dQdT_o
    -      real(kind=kind_REAL),dimension(:,:),allocatable::
    +      real,dimension(:,:),allocatable::
          >buf1_o,buf2_o
           TYPE (IPARR2), dimension(:), allocatable::
          >MASK_o                                              ! (0:ngo-1)
    @@ -155,7 +155,7 @@
           TYPE (IARRAY2), dimension(:), allocatable:: force_extrap_w
                                                        ! (0:ngw-1)
           TYPE (PARR2) buf_w
    -      real(kind=kind_REAL),dimension(:,:),allocatable::
    +      real,dimension(:,:),allocatable::
          >buf1_w,buf2_w
           TYPE (IPARR2), dimension(:), allocatable::
          >MASK_w,ICE_w                                        ! (0:ngw-1)
    @@ -302,9 +302,9 @@
           integer cstep,iiunit,extrap_vrbs/1/
           integer (kind=kind_INTEGER) ibuf(2)
           integer nmin,nmax
    -      real(kind=kind_REAL) buf(1)
    +      real buf(1)
           real z,z1,z2,y1,y2,y3,fmean,fsigma,fmin,fmax
    -      real(kind=kind_REAL),dimension(:),allocatable:: cnt,cnt1
    +      real,dimension(:),allocatable:: cnt,cnt1
           real,dimension(:),allocatable:: fr,fr1
           character*20 cs
           character*4 prl,prg
    @@ -3751,7 +3751,7 @@
          >'ABORTED on abnormal return from INTERP(..VCUR..)',1)
    
           write (s1,'(3i3)') k,m1,m2
    -      call CPL_ANNOUNCE('to rotate CUR vector field on WMG '
    +      call CPL_ANNOUNCE('to rotate CUR vector field on WMG '//
          >', k,m1,m2: '//trim(s1),3)
    
     ! rotation: obtain x, y vector components at WM gridpoints
    @@ -3909,7 +3909,7 @@
          >'ABORTED on abnormal return from INTERP(..VDPCUR..)',1)
    
           write (s1,'(3i3)') k,m1,m2
    -      call CPL_ANNOUNCE('to rotate DPCUR vector field on WMG '
    +      call CPL_ANNOUNCE('to rotate DPCUR vector field on WMG '//
          >', k,m1,m2: '//trim(s1),3)
    
     ! rotation: obtain x, y vector components at WM gridpoints
    @@ -4940,10 +4940,10 @@
           implicit none
    
           integer kda,id,NSF,ng
    -      real(kind=kind_REAL),dimension(:,:):: buf1,buf2
    +      real,dimension(:,:):: buf1,buf2
    
           integer nx,ny,nx_l,ny_l,nxny_l1
    -      real(kind=kind_REAL),dimension(NSF):: lakeval
    +      real,dimension(NSF):: lakeval
           character*4,dimension(NSF):: sfn
           character*1,dimension(0:ng-1):: gn
           TYPE (PARR2), dimension(NSF,nda):: SFa
    @@ -5783,9 +5783,9 @@
           character*(*) s
           integer id,kg
           integer,optional:: kd,is,ie,js,je,nunit
    -      real(kind=kind_REAL),dimension(:,:),target,optional:: LAT,LON
    +      real,dimension(:,:),target,optional:: LAT,LON
    
    -      real(kind=kind_REAL),dimension(:,:),pointer:: X,Y
    +      real,dimension(:,:),pointer:: X,Y
           character*100 s1
     C
    
    @@ -6247,10 +6247,10 @@
    
           integer IM,JM,imin,jmin,imax,jmax,nmin,nmax
           logical mask(IM,JM)
    -      real(kind=kind_REAL) F(IM,JM),Fmean,Fsigma,Fmin,Fmax
    +      real F(IM,JM),Fmean,Fsigma,Fmin,Fmax
    
           integer i,j
    -      real(kind=kind_REAL) z0,z,z2
    +      real z0,z,z2
    
           real cpl_sum
           integer cpl_isum
    diff -Nur ncep-coupler/hwrf_wm3c/interp.f ncep-coupler_ok/hwrf_wm3c/interp.f
    --- ncep-coupler/hwrf_wm3c/interp.f	2018-07-21 04:54:54.012340000 +0800
    +++ ncep-coupler_ok/hwrf_wm3c/interp.f	2023-07-21 15:25:35.255770420 +0800
    @@ -50,7 +50,7 @@
    
           integer,intent(in):: IM1,JM1,IM2,JM2
                       !<- dimensions for G1 and G2 grid arrays
    -      real,dimension(IM1,JM1),intent(in):: lon1,lat1
    +      real,dimension(:,:),intent(in):: lon1,lat1
                       !<- arrays of longitudes and latitudes for G1 grid.
                       ! In fact, it may be coordinates x,y in any
                       ! coordinate system 

  3. 执行以下命令打人补丁patch-ncep-coupler。

    patch -p0 < ./patch-ncep-coupler

  4. 执行以下命令进入目录配置生成编译文件。

    cd ncep-coupler
    echo 1 | ./configure

  5. 执行以下命令进行编译。

    ./compile 2>&1 | tee -a build.log

  6. 执行以下命令查看二进制文件。

    ls -l cpl_exec/*.exe

    成功编译后将在目录cpl_exec中生成可执行文件。