Netcdf requirements for pom2k
To run pom2k, one also needs netcdf support which is quite different than the one needed for sbPOM. pom2k does not employ netcdf 4, so it is sufficient to install Netcdf version 3.6.3., as long as you compile it with gfortran compiler and add a few tweaks here and there. The compiler itself seems to be very important, because I have iterated a bit and tried various compilers and only gfortran managed to make peace between netcdf 3.6.3. and pom2k on my system (Ubuntu 11.10).
Since this is a continuation from the last post on this blog, I'll start at:
4. Installing netcdf 3.6.3. libraries
Netcdf 3.6.3. can be downloaded from here, and, luckily, there's an option to either download the source code and build it, or download the pre-built version built by gfortran. Note that this is the only one that really worked for my system. Using netcdf and pom2k compiled by any other compiler (f77, f90, f95...) failed at recognizing and deploying nf_ functions in pom2k (you can and should check this during make check of the netvdf building process).
If you decide to build netcdf libraries, which I would strongly suggest since it's simple once you actually know what you need, and the software is relatively well behaved, here is the procedure:
LIBS='-L/usr/local/ncdfp/include -pnetcdf' FC=gfortran CC=gcc CXX=g++ ./configure --disab --enable-parallel-tests --prefix=/usr/local/ncd363f --disable-shared --enable-fortran --enable-f77 --enable-f90
In principle one can do quite nicely without pnetcdf here, I just wanted to play around and see if it'll build properly. Don't forget to make check before doing a make install, and make sure all the fortran functions (prefixed by nf_) have run correctly).
I have installed this version in /usr/local/ncd363f in order to be able to point pom2k at it without having any conflicts with other netcdf builds I will require.
5. Resolving pom2k bugs
Once I have pointed the pom2k.n file to /usr/local/ncd363f/netcdf.inc and uncommented the netcdf output in pom2k.f (it comes with the entire netcdf output modules commented out, for some reason - as a C++ programmer I had to go through several fortran manuals to realize that the subroutine file (pom2k.n) is actually included at the end of the pom2k.f file, but it still didn't work.
Considering gfortran compiler isn't all that helpful with errors inside included files, bluntly copy-pasting the whole of the .n file code into the .f file did the trick. Going through the code, it turned out someone forgot to comment out a line of code (and end-if) around 213th line of the pom2k.n file.
Considering gfortran compiler isn't all that helpful with errors inside included files, bluntly copy-pasting the whole of the .n file code into the .f file did the trick. Going through the code, it turned out someone forgot to comment out a line of code (and end-if) around 213th line of the pom2k.n file.
Nema komentara:
Objavi komentar