Radiative Transfer Modelling software is fun stuff! Decoding cryptic fortran docs is such a great time. So here's me spoiling all that fun for you, (hopefully) making it easy. Or at least easier.

I got it all going on a dual-core 64-bit AMD processor running a fresh install of Ubuntu 12.04. Most of this should be applicable to other platforms and linux-based operating system. Maybe even some other unix-based systems.

The Software[edit | edit source]

  • RRTM, by Atmospheric and Environmental Research, Inc.
  • SMARTS, The Simple Model of the Atmospheric Radiative Transfer of Sunshine by Dr. Christian Gueymard.
  • SBDART, Santa Barbara DISORT

Atmospheric Radiative Transfer.

System[edit | edit source]

Installing Fortran Compilers[edit | edit source]

All three RTM programs are written in Fortran, so you'll need a Fortran compiler! And actually make that three different Fortran compilers because you're awesome.

fort77[edit | edit source]

SBDART is written in FORTRAN77, so we need a compiler which compiles FORTRAN77 code. No kidding. Ubuntu doesn't have one by default so we need to install it.

  1. Check if you already have it! Open up a terminal (ctrl-alt-t) and type the following command: f77. If the output looks like this:
The program 'fort77' is currently not installed. You can install it by typing:
sudo apt-get install fort77

Then you don't have it yet; proceed with the following instructions. If it says

gfortran: fatal error: no input files
compilation terminated

then you're already done here!

  1. Install it! Type sudo apt-get install gfortran into the terminal.
  2. Input your password at the prompt. I assume that your account has administrative power over the computer. If you installed Ubuntu yourself, you should have no issue. If you're using a machine administrated by someone else, you may need to talk to them.
  3. You may encounter a confirmation asking you to confirm that you do, indeed, wish to download and install the compiler, something like
After this operation, 2,986 kB of additional disk space will be used.
Do you want to continue [Y/n]?

If that's still true, type 'Y' and hit enter. fort77 (and its dependencies) will install. That's it. Yep, installing programs in Ubuntu rocks.

gfortran[edit | edit source]

Guess what? gfortran installs in exactly the same way as fort77!

  1. Check if it's there gfortran
  2. If not, install it sudo apt-get install gfortran

Boom.

(Tip: basically anything you want in linux installs this way. SBDART doesn't because it's a very obscure piece of software which isn't in Ubuntu's repository. But a shocking wealth of software is readily available from the repository!)

PGILinux Fortran[edit | edit source]

I had no luck compiling RRTM with either gfortran or fort77, but they have a makefile specifically for The Portland Group's fortran compiler. It's not free, but there is a free trial period; good enough for our purposes. (note to self: look into the license I agreed to and see if there are any extra stipulations on the use of the trial version...)

  1. Create a PGI account.
  2. Download the compiler. I went with PGI Accelerator Fortran Workstation with Target 64-bit & 32-bit, for linux, obviously. It's massive. Find something to do while it downloads.
  3. Extract the files somewhere, and then open a terminal and navigate there. I extracted them into a folder in my home directory that I named pgi, so for me that meant opening up a terminal (ctrl-alt-t), and typing cd ~/pgi.
  4. The installer must be run with "root privileges", so you have to put sudo before the command. sudo./install... enter your password...
  5. The EULA will show up in the terminal. Press Spacebar to move down page-by-page, and when you are satisfied, either accept or decline the terms at the end.
  6. Assuming you accepted, You should now have a choice of type of installation. Choose the first (by entering the number 1), unless you think you might need a network install. That would be out of the scope of this document.
  7. Leave the default installation directory (again unless you feel it needs to be changed, in which case I can't help you and you could have easily written this document); press enter.
  8. I am running on an AMD processor, so I chose to install the ACML. I don't know if it will actually work since my operating system is running on a virtual machine, but it doesn't seem to hurt... I'll leave this one up to your judgement, however do note that there is an additional license agreement for the ACML.
  9. The next screen was asking about ACML versions... I left it at the default (just hit enter)
  10. I also have a nvidia video card (again, maybe this is not applicable anyway since I'm in a virtual machine), so chose to also install the CUDA stuff. Don't really know what it is... using the GPU to run parts of your code maybe? Again, there is yet another license agreement for CUDA.
  11. I also installed the OpenACC drivers. The OpenACC site was down, but the Wikipedia page on it said it was about parallel computing, so I figured I'd get it, even though I think I'll be using OpenMP for the purposes it fills. Guess what? There's another license to agree to!
  12. Java, I chose yes... and I'm starting to remember that I'm only getting this compiler so I can compile one already-made program once and then it expires in two weeks... accept another license...
  13. Hey, now it's finally installing!
  14. Do you wish to update/create links in the 2012 directory? (y/n) I picked y
  15. It then installs all that extra crap I agreed to...
  16. Do you wish to install MPICH1? (y/n) Since I'm already installing everything, y
  17. Remote execution method? (rsh,ssh) ssh
  18. Do you want the files in the install directory to be read-only? (y/n) y
Installation complete.

Celebrate!

And then test it

phil@ubuntu:~/pgi$ pgf90
No command 'pgf90' found, did you mean:
Command 'pdf90' from package 'pdfjam' (universe)
pgf90: command not found

Nooooooooooo

Don't panic, bash just doesn't know where to find it yet. Let's try it with the absolute path:

phil@ubuntu:~/pgi$ /opt/pgi/linux86-64/12.4/bin/pgf90
pgf90-Warning-No files to process

Ok, now is the time to celebrate.

I decided not to bother adding that directory to my PATH or anything, since I just need it for this one build. So we're done!

No, not actually. We need to get our license files.

Get the hostid by opening a terminal and typing ifconfig eth0. My output looked like this:

phil@ubuntu:/opt/pgi/linux86-64/12.4/bin$ /sbin/ifconfig eth0
eth0	 Link encap:Ethernet HWaddr 00:0c:29:30:4c:1e
				 inet addr:192.168.65.128 Bcast:192.168.65.255 Mask:255.255.255.0
				 inet6 addr: fe80::20c:29ff:fe30:4c1e/64 Scope:Link
				 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
				 RX packets:608040 errors:0 dropped:0 overruns:0 frame:0
				 TX packets:310314 errors:0 dropped:0 overruns:0 carrier:0
				 collisions:0 txqueuelen:1000
				 RX bytes:913047840 (913.0 MB) TX bytes:17318408 (17.3 MB)

It's that HWaddr part that we need, in my case 00:0c:29:30:4c:1e. Keep that code handy, and head over to https://www.pgroup.com/license/trialkey.php and copy it in. You should get a page with a link called "Save trial keys as a file on my computer". Click it, and you should be presented with the option to save a file called license.dat. Save it.

Now move it to the right place...

sudo cp ~/Downloads/license.dat /opt/pgi/license.dat

(you may have to enter a password for sudo, since /opt is protected)

And now, finally, at long last, we're there. Done.

Installing SBDART[edit | edit source]

Get the code[edit | edit source]

Get the SBDART source code. It's all in one file. Either right-click that link and Save link as..., or open it up in the browser, and then select File -> Save As.... Save it somewhere convenient, like on your desktop. Or somewhere better, like inside a folder called sbdart in your home directory.

Compile SBDART[edit | edit source]

If you don't already have a terminal open, hit ctrl-alt-t to get one. Navigate to the directory where you put the sbdart code (so cd ~/Desktop if you saved it on the desktop, or cd ~/sbdart if you saved it in a folder called sbdart in your home directory. If this is confusing, you may wish to brush up on your linux terminal skills.)

I like to double-check I'm in the right place by typing ls, which should simply return sbdart.f if you're in the right directory (there may be other things listed there as well, just make sure sbdart.f is in there!).

To compile sbdart, enter this command:

f77 sbdart.f -o sbdart

It should output a couple hundred lines of stuff very quickly to the terminal, and then leave you back at a prompt after a couple moments. Get a directory listing again to see if it worked (ls), and if you now see sbdart sbdart.f, then you're done!

Installing SMARTS[edit | edit source]

SMARTS is a little trickier than SBDART to get up and running (the source code is more than just a single file like SBDART!), but still very simple.

Grab the code[edit | edit source]

First you'll need to register with NREL. They'll email you a username and password to download the source.

Then you can grab the code here. At this time of writing, the current version is 2.9.5, which is available for linux in a 3MB.tar.gz file.

Make it go[edit | edit source]

Extract that file somewhere, like say a new folder called smarts in your home directory.

Make the executable, executable!

After I extracted SMARTS, I found I couldn't execute the program. This is what my try looked like:

phil@ubuntu:~/smarts/SMARTS_295_Linux$./smarts295
bash:./smarts295: No such file or directory

Bizarre. It's there -- I can see it with ls. ll shows that it's set to executable, so doing chmod +x smarts295 had no effect. I don't know why it doesn't work, but they give us the source code, so grab the gfortran compiler (see above) and let's go!

Navigate into the Source_code directory. For me that meant

cd ~/smarts/SMARTS_295_Linux/Source_code

Compile

gfortran smarts295.f -o smarts

It should complete in a couple moments. Move our new executable back out of the Source_code folder

mv smarts../

Go up a level to try it out...

cd../

Hold your breath... ./smarts

phil@ubuntu:~/smarts/SMARTS_295_Linux$./smarts

***********************************
Welcome to SMARTS, version 2.9.5!			
***********************************
$$$ SMARTS_295> Use standard mode with default input file?
[If YES (or Y), execution will start immediately
using the default input file smarts295.inp.txt]
(Y/N) ==>

Hooray, we're done, it seems to work!

Installing RRTM[edit | edit source]

There are four versions of RRTM, as you can see here. We wanted the Short-Wave version, and the stand-alone model, so RRTM_SW. Get the code via the Code and Examples link on the left frame. Here is a direct link to that page (it's frame-less so that link loses all the page navigation).

Grab the source code and makefiles. They'll prompt you for your email address, name, etc. If you really don't want to part with that info, they don't validate the fields (you could just enter a, b, c. But be nice).

Extract that archive somewhere. I made a new folder in my home directory called (you guessed it) rrtm.

Copy the appropriate makefile up a level in order to use it

phil@ubuntu:~$ cd ~/rrtm/rrtm_sw/makefiles
phil@ubuntu:~/rrtm/rrtm_sw/makefiles$ cp make_rrtm_sw_linux_pgi../
phil@ubuntu:~/rrtm/rrtm_sw/makefiles$ cd../
phil@ubuntu:~/rrtm/rrtm_sw$ ls
linux_pgi_pgf90_dbl.o make_rrtm_sw_linux_pgi src
makefiles			 rrtm_sw_instructions	update_rrtm_sw_v2.5.txt

At this point make sure you've installed the PGLinux Fortran compiler. See a couple sections up in this document for help with that.

If you remember, bash didn't know where to find the executable pgf90 after we installed it, and since we haven't fixed that issue, it's easier to just edit the makefile. Lets open it up in gedit:

phil@ubuntu:~$ cd ~/rrtm/rrtm_sw/
phil@ubuntu:~/rrtm/rrtm_sw$ gedit make_rrtm_sw_linux_pgi

Now find the lines where it says FC = pgf90 and CDOTO = $(PLATFORM)_$(FC)_dbl.o

###############################
# Set variables
###############################

PLATFORM = linux_pgi
VERSION = v2.5

FC = pgf90
FCFLAG = -fast -r8 -i8
OUTPUT = rrtm_sw_$(PLATFORM)_$(VERSION)
CPATH = src
CDOTO = $(PLATFORM)_$(FC)_dbl.o

And change them to FC = /opt/pgi/linux86-64/12.4/bin/pgf90 and CDOTO = $(PLATFORM)_pgf90_dbl.o, respectively.

###############################
# Set variables
###############################

PLATFORM = linux_pgi
VERSION = v2.5

FC = /opt/pgi/linux86-64/12.4/bin/pgf90
FCFLAG = -fast -r8 -i8
OUTPUT = rrtm_sw_$(PLATFORM)_$(VERSION)
CPATH = src
CDOTO = $(PLATFORM)_pgf90_dbl.o

And finally....

phil@ubuntu:~/rrtm/rrtm_sw$ make -f make_rrtm_sw_linux_pgi

-----------------
	rrtm_sw_linux_pgi_v2.5 Makefile
-----------------

This Makefile was designed for the linux_pgi platform.

It uses the /opt/pgi/linux86-64/12.4/bin/pgf90 compiler, with the following options:
			-fast -r8 -i8

The object files used are as follows:

			rrtm.o RDI1MACH.o rtrdis.o rrtatm.o setcoef.o taumoldis.o ErrPack.o util_linux_pgi.o extra.o LINPAK.o disort.o cldprop.o k_g.o


rrtm_sw_linux_pgi_v2.5 make in progress...

NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
PGF90-W-0155-The type of FLOAT is now double precision with -r8 (src/setcoef.f: 140)
	0 inform, 1 warnings, 0 severes, 0 fatal for setcoef
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.45 hours.
PGF90-W-0155-The type of FLOAT is now double precision with -r8 (src/disort.f: 473)
	0 inform, 1 warnings, 0 severes, 0 fatal for disort
NOTE: your trial license will expire in 14 days, 7.45 hours.
NOTE: your trial license will expire in 14 days, 7.44 hours.
PGF90-W-0155-The type of FLOAT is now double precision with -r8 (src/cldprop.f: 155)
	0 inform, 1 warnings, 0 severes, 0 fatal for cldprop
NOTE: your trial license will expire in 14 days, 7.44 hours.
NOTE: your trial license will expire in 14 days, 7.44 hours.
NOTE: your trial license will expire in 14 days, 7.44 hours.

=================
	Makefile done
=================
phil@ubuntu:~/rrtm/rrtm_sw$ ls
linux_pgi_pgf90_dbl.o make_rrtm_sw_linux_pgi~ src
makefiles			 rrtm_sw_instructions	 update_rrtm_sw_v2.5.txt
make_rrtm_sw_linux_pgi rrtm_sw_linux_pgi_v2.5
phil@ubuntu:~/rrtm/rrtm_sw$./rrtm_sw_linux_pgi_v2.5
INVALID INPUT_RRTM

WOOOOOOOOOOOOHOOOOOOOOOOO!!!! Now is celebration time.

FA info icon.svg Angle down icon.svg Page data
Authors Philip Schleihauf
License CC-BY-SA-3.0
Language English (en)
Related 0 subpages, 2 pages link here
Impact 1,730 page views
Created May 14, 2012 by Philip Schleihauf
Modified February 6, 2023 by Felipe Schenone
Cookies help us deliver our services. By using our services, you agree to our use of cookies.