COMPILING WRF-Chem
Compiling WRF-Chem: Building the WRF-chem code to allow a user to include dust, chemical species and aerosols when running a WRF simulation.
***************************************************************************
Purpose: To familiarize the user with the methodology by which the WRF-Chem code is compiled. The methodology is similar to which the WRF model and the WRF Preprocessing System (WPS) are compiled.
***************************************************************************
With the c-shell environment the user needs to set the WRF_CHEM environment variable setenv WRF_CHEM 1
If the optional kinetic pre-processor is to be compiled, then several other environmental variables need to be set. These include the WRF_KPP environmental variable:
setenv WRF_KPP 1 (optional) the path to the flex library (libfl.a) setenv FLEX_LIB_DIR /usr/lib (optional)
And the path to the YACC c code compiler with the -d compile flag included
setenv YACC ‘/usr/bin/yacc –d’ (optional)
If the k-shell is being used, then use the export command instead of setenv
export WRF_CHEM=1
export WRF_KPP=1 (optional)
export FLEX_LIB_DIR=/usr/lib (optional)
export YACC=‘/usr/bin/yacc –d’ (optional)
For example, if a user wants to use the ifort compiler, the user will select option 19 from the following configure choices:
Please select from among the following supported platforms.
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 XT CLE
44. (serial) 45. (smpar) 46. (dmpar) 47. (dm+sm) CRAY CCE (ftn/gcc): Cray XE and XC30
48. (serial) 49. (smpar) 50. (dmpar) 51. (dm+sm) INTEL (ftn/icc): Cray XC30
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
For older code versions, the YELLOWSTONE and SGI MPT options are for a computer called YELLOWSTONE and for a computer that has the SGI version of the message passing installed. While your system administrator will know for certain if the SGI MPT is installed for your computer, it is best to assume that it is not installed and to compile without that option at first.
ENVCOMPDEFS = -DWRF_CHEM
WRF_CHEM = 1
And if compiling with KPP, the configure.wrf file will contain the additional information about the KPP settings:
ENVCOMPDEFS = -DWRF_CHEM -DBUILD_CHEM=1 -DWRF_KPP
WRF_CHEM = 1
compile em_real >& compile.log
If you see a message like: "WARNING: There is no 4D array named emis_ant" , then the emissions arrays are not included in some of the WRF modules. This is a result of compiling the chemistry code without removing the non-chemistry compiled modules. Issue a 'clean -a' command to fully clean the WRF code. Then repeat the configure and compile commands.
If you see a message like: "/usr/lib/libnetcdf.a(nc4attr.o): In function `nc_del_att':" , then the netCDF library settings are not correct. This is a result of a bad environment setting or a bad netCDF library. Use the same libraries that were used to compile WRF. If you have not confirmed that WRF (without chemistry) can compile with your settings, do so now. The WRF-Chem model should compile if the WRF model compiles without chemistry as the IO routines do not change.
If you see a message like: "dec_jpeg2000.c(4): catastrophic error: cannot open source file "jasper/jasper.h", then the GRIB environmental settings are turned on. This error is a result of the WPS environment settings being turned on when trying to compile WRF. If you have not confirmed that the JASPER settings for the WPS are removed or turned off, do so now. The WRF-Chem model should compile once the JASPER and other WPS-related environment settings are turned off.
compile emi_conv >& emcompile.log
This concludes WRF/chem tutorial instructions regarding compiling WRF-Chem