Rate This Document
Findability
Accuracy
Completeness
Readability

Compilation and Installation

Procedure

  1. Use PuTTY to log in to the server as the root user.
  2. Go to the FVCOM installation package directory.
    cd /path/to/FVCOM
  3. Decompress the installation package.
    tar -xvf fvcom-4.1.tar.gz
  4. Go to the directory generated after the decompression.
    cd FVCOM4.1
  5. Copy the make.inc_example file and rename it to make.inc.
    cp Examples/Estuary/make.inc_example FVCOM_source/make.inc
  6. Create a soft link for the make.inc file.
    ln -sf FVCOM_source/make.inc ./
  7. Edit the make.inc file.
    1. Open the make.inc file.
      vi make.inc
    2. Press i to enter the edit mode and modify the content in lines 51, 79, 80, 97, and 99.

      Line 51:

      TOPDIR = /path/to/FVCOM/FVCOM4.1/FVCOM_source

      Delete the space next to /path/to/FVCOM/FVCOM4.1/FVCOM_source.

      Lines 79 and 80:

      LIBDIR = -L$(INSTALLDIR)/lib -L../METIS_source/metis -L./libs/julian
      INCDIR = -I$(INSTALLDIR)/include -I../METIS_source/metis -I./libs/julian

      Delete the comment tag (#).

      In line 97, modify the IOLIBS content that is not commented out using #.

      IOLIBS = -L/path/to/NETCDF/lib -L/path/to/HDF5/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz -lcurl -lm

      In line 98, modify the IOINCS content that is not commented out using #.

      IOINCS = -I/path/to/NETCDF/include -I/path/to/HDF5/include

      Comment out and add the content in the following figure:

      After performing 7.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  8. Create a compilation environment variable file.
    1. Create an environment variable file.
      vi env-fvcom.sh
    2. Press i to enter the edit mode and add the following content:
      export CXX=mpicxx
      export CC=mpicc
      export MPI_HOME=/path/to/HMPI
      export PATH=$MPI_HOME/bin:$PATH
      export LD_LIBRARY_PATH=$MPI_HOME/lib:$LD_LIBRARY_PATH
      export HDF5=/path/to/HDF5
      export PATH=$HDF5/bin:$PATH
      export LD_LIBRARY_PATH=$HDF5/lib:$LD_LIBRARY_PATH
      export NETCDF=/path/to/NETCDF
      export PATH=$NETCDF/bin:$PATH
      export LD_LIBRARY_PATH=$NETCDF/lib:$LD_LIBRARY_PATH
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  9. Load the environment variables.
    source env-fvcom.sh
  10. Go to the METIS installation directory.
    cd ./METIS_source
  11. Decompress the METIS installation package.
    tar -zxvf metis.tgz
    cd metis
    sed -i 's/log2/log2_function/g' *.*
  12. Create the related directories.
    mkdir -p /path/to/FVCOM/FVCOM4.1/FVCOM_source/libs/install/lib
    mkdir -p /path/to/FVCOM/FVCOM4.1/FVCOM_source/libs/install/include
    mkdir -p /path/to/FVCOM/FVCOM4.1/FVCOM_source/libs/install/bin
  13. Compile and install the METIS library.
    make
    make install
  14. Go to the julian installation directory.
    cd ../../FVCOM_source/libs
  15. Decompress the julian.tgz installation package.
    tar -zxvf julian.tgz
  16. Go to the directory generated after the decompression.
    cd julian
  17. Compile and install the julian library.
    make
    make install
  18. Go to the FVCOM installation directory.
    cd /path/to/FVCOM/FVCOM4.1/FVCOM_source
  19. Edit the mod_newinp.F file.
    1. Open the mod_newinp.F file.
      vi mod_newinp.F
    2. Press i to enter the edit mode.
      Add the following information in bold below the first contains statement.
      !----------------------------------------
      ! functions
      !----------------------------------------
      contains
      Character( Len = 256 ) Function N_Fmt( c , n )
      Character( Len = * ) , Intent( IN ) :: c
      Integer , Intent( IN ) :: n
      integer :: i , j
      character( len = 16 ) :: cn
      i = index( c , '<' )
      j = index( c , '>' )
      write( cn , '(g0)' ) n
      N_Fmt = c(:i-1) // Trim(adjustL(cn)) // c(j+1:)
      End Function N_Fmt

      Modify the content in lines 352, 421, 494, and 567.

      Line 352:

      write(*,N_Fmt('(A20,<size>F10.4)',SIZE))trim(argname)//': ',fval(1:SIZE)

      Line 421:

      write(*,N_Fmt('(A20,<size>I10)',SIZE))trim(argname)//': ',ival(1:SIZE)

      Line 494:

      write(*,N_Fmt('(A20,<size>L10)',SIZE))trim(argname)//': ',cval(1:SIZE)

      Line 567:

      write(*,N_Fmt('(A20,<size>A10)',SIZE))trim(argname)//': ',sval(1:SIZE)

      After performing 19.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  20. Modify the mod_scal.F, internal_step.F, adv_t.F, and adv_s.F files. Modify the statement that starts with IF(BACKWARD_ADVECTION in the file. Change == to .eqv and /= to .neqv.
    sed -i 's/\/=\.TRUE\./\.neqv\.\.TRUE\./g' mod_scal.F
    sed -i 's/==\.TRUE/\.eqv\.\.TRUE/g' internal_step.F
    sed -i 's/==\.FALSE\./\.eqv\.\.FALSE\./g' adv_t.F
    sed -i 's/==\.FALSE\./\.eqv\.\.FALSE\./g' adv_s.F
  21. Edit the mod_utils.F file.
    1. Open the mod_utils.F file.
      vi mod_utils.F
    2. Press i to enter the edit mode and change the ISNAN function to IEEE USENAN.
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  22. Compile and install the FVCOM main program.
    make

    After the installation is successful, you can run the ll command to view the generated executable file fvcom in the current directory.