Get our free book (in Spanish or English) on rainwater now - To Catch the Rain.
Installing RRTM for use with MATLAB on a Windows machine
|This page was developed by the Queen's University Applied Sustainability Research Group.|
RRTM (Rapid Radiative Transfer Model) provided by ARM is an open-source program which predicts the radiative transfer in the atmosphere in a series of 16 discrete wavelength bands. This is useful for solar energy modeling in general and solar photovoltaic modeling specifically.
- The program can be downloaded at: http://rtweb.aer.com/rrtm_frame.html
- In order to install it the PGI Accelerate compiler is required, which can be found on a 14 day trial at: http://www.pgroup.com/
This compiler runs in the cygwin environment, which is required for the compiling of the code.
- Once the rrtm .tar.gz file has been downloaded, uncompress it to c:/rrtm_sw (for ease of addressing later)
Inside this file is the makefiles directory, containing "make" files for Linux, sun and sgi systems, and the src directory, containing the fortran source code of rrtm.
A make file is a set of system commands which directs the complier in what order and where to compile the program. The file "make_rrtm_sw_linux_pgi" is close to what can be run on a windows machine, but requires some modifications. Instead download Makefile WIN.odt from this site, File:Makefile WIN.odt which is modified to work on windows. This file should be copied into a raw text file called "makefile" located in the rrtm_sw directory.
- Download "make_rrtm_sw_WIN" into the base (c:/rrtm_sw) folder.
- Open PGI accelerate bash shell and enter "cd /cygdrive/c/rrtm_sw" to make the base folder the working directory
- input "make" into the bash shell. This will call the makefile in the rrtm_sw directory and compile rrtm. Note that everytime this is run it will create the folder "linux_pgi_pgf90_dbl.o". This folder must be erased before the makefile is re-run.
- three files: "rrtm_sw_linux_pgi_v2.5", "rrtm_sw_linux_pgi_v2.dwf", and "rrtm_sw_linux_pgi_v2.pdb" will be created. In order to run rrtm, enter "./ rrtm_sw_linux_pgi_v2.5" into the cygwin bash shell.
This methodology has successfully recreated the "input_rrtm_sw_trp" test case on a Windows 7X64 machine
Using RRTM as a batch program with MATLAB
The file which has been compiled will only run properly if run through the cygwin environment. In order to run batch processes of this program through MATLAB, MATLAB must first call the cygwin bash shell, and execute the program through this shell. This call can be completed in one line with the system command:
system('C:\cygwin\bin\bash --login -c "cd /cygdrive/c/rrtm_sw ; ./rrtm_sw_linux_pgi_v2.5"')
- C:\cygwin\bin\bash --login -c This sets the current working directory to the location of the CYGWIN bash shell. Therefore if cygwin is located elsewhere, this should be modified
- "cd /cygdrive/c/rrtm_sw ; ./rrtm_sw_linux_pgi_v2.5" are two lines of bash shell code, separated by a semi-colon which acts as a line break. The first sets the working directory of cygwin to the location of the rrtm code (again this should be modified depending on the location on your machine.) The second line of code calls the rrtm program.