Version 4.0: June 2018 (add hybrid vertical coordinate)
Version 4.1: April 2019
Version 4.2: April 2020
Version 4.3: May 2021
Version 4.4: April 2022
Version 4.5: April 2023
4.5.1: July 2023
4.5.2: December 2023
Version 4.6: May 2024
WRF installation on a Linux-based machine
Weather Research & Forecasting Model (WRF) is a state of the art mesoscale numerical weather prediction system designed for both atmospheric research and operational forecasting applications [1].
#!/bin/bash source gcc_env.sh echo"==========================================================================================" echo" All tests are from http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_tests.tar " gfortran --version gcc --version cpp --version echo"==========================================================================================" echo"=============================== Fortran_C_tests.tar =====================================" echo"==========================================================================================" # Unpack the test files by entering the following input into the terminal: # tar -xf Fortran_C_tests.tar
# TEST #1: FIXED FORMAT FORTRAN TEST gfortran TEST_1_fortran_only_fixed.f ./a.out # SUCCESS test 1 fortran only fixed format
# TEST #2: FREE FORMAT FORTRAN TEST gfortran TEST_2_fortran_only_free.f90 ./a.out # Assume Fortran 2003: has FLUSH, ALLOCATABLE, derived type, and ISO C Binding # SUCCESS test 2 fortran only free format
# TEST #3: C gcc TEST_3_c_only.c ./a.out # SUCCESS test 3 c only
# TEST #4: FORTRAN CALLING A C FUNCTION (GCC AND GFORTRAN HAVE DIFFERENT DEFAULTS, # SO WE FORCE BOTH TO ALWAYS USE 64 BIT (-M64) WHEN COMBINING THEM) gcc -c -m64 TEST_4_fortran+c_c.c gfortran -c -m64 TEST_4_fortran+c_f.f90 gfortran -m64 TEST_4_fortran+c_f.o TEST_4_fortran+c_c.o ./a.out # C function called by Fortran # Values are xx = 2.00 and ii = 1 # SUCCESS test 4 fortran calling c
# TEST #5: CSH ./TEST_csh.csh # SUCCESS csh test # TEST #6: PERL ./TEST_perl.pl # SUCCESS perl test # TEST #7: SH ./TEST_sh.sh # SUCCESS sh test
# To unpack the tar file, type: # wget -c https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_NETCDF_MPI_tests.tar # tar -xf Fortran_C_NETCDF_MPI_tests.tar
# Test #1: Fortran + C + NetCDF
# The NetCDF-only test requires the include file from the NETCDF package be in this directory. Copy the file here: cp${NETCDF}/include/netcdf.inc .
# Compile the Fortran and C codes for the purpose of this test # (the -c option says to not try to build an executable). Type the following commands: gfortran -c 01_fortran+c+netcdf_f.f gcc -c 01_fortran+c+netcdf_c.c gfortran 01_fortran+c+netcdf_f.o 01_fortran+c+netcdf_c.o \ -L${NETCDF}/lib -lnetcdff -lnetcdf ./a.out
# The following should be displayed on your screen: # C function called by Fortran # Values are xx = 2.00 and ii = 1 # SUCCESS test 1 fortran + c + netcdf
echo"=================================================================" # Test #2: Fortran + C + NetCDF + MPI
# The NetCDF+MPI test requires include files from both of these packages be in this directory, # but the MPI scripts automatically make the mpif.h file available without assistance, # so no need to copy that one. Copy the NetCDF include file here: cp${NETCDF}/include/netcdf.inc .
# Note that the MPI executables mpif90 and mpicc are used below when compiling. Issue the following commands: mpif90 -c 02_fortran+c+netcdf+mpi_f.f mpicc -c 02_fortran+c+netcdf+mpi_c.c mpif90 02_fortran+c+netcdf+mpi_f.o \ 02_fortran+c+netcdf+mpi_c.o \ -L${NETCDF}/lib -lnetcdff -lnetcdf mpirun ./a.out
# The following should be displayed on your screen: # C function called by Fortran # Values are xx = 2.00 and ii = 1 # status = 2 # SUCCESS test 2 fortran + c + netcdf + mpi echo"================================================================="
#!/bin/bash # WRF will not compile using GCC version 6 or higher. # It will only work with version 4.8.5. # The GCC6 module loads automatically when you log in. # If you unload it, the system will default to GCC 4.8.5.
./compile -j 4 em_real 2>&1 | tee compile.log #./compile em_real 2>&1 | tee compile.log
# # #It should fail on the first time (namely main/real.exe is not created) # # #with the following error: # # #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # #real_em.f90:32.7:
# # # USE module_initialize_real, ONLY : wrfu_initialize, find_my_parent, find_my_ # # 1 # # #Fatal Error: Can't open module file 'module_initialize_real.mod' for reading at (1): No such file or # # #directory # # #nup_em.f90:90.7:
# # # USE module_initialize_real, only : wrfu_initialize # # # 1 # # #Fatal Error: Can't open module file 'module_initialize_real.mod' for reading at (1): No such file or # # #directory # # #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# # #Then it should end successfully when running the # # #command a second time (do not understand why but it works...)