Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
noresm:settingupcamonlinuxpc [2013-10-29 14:43:49] alfg [Compile CAM on your Linux PC] |
noresm:settingupcamonlinuxpc [2022-05-31 09:29:32] (current) |
||
---|---|---|---|
Line 3: | Line 3: | ||
CAM is the atmospheric component of NoRESM. It is possible to compile and run CAM on your own Linux PC. This makes it easier to debug simple tests using programs like ddd or gdb. CAM 5.3 compiles with gfortran. | CAM is the atmospheric component of NoRESM. It is possible to compile and run CAM on your own Linux PC. This makes it easier to debug simple tests using programs like ddd or gdb. CAM 5.3 compiles with gfortran. | ||
+ | ===== Obtain CAM 5.3 source code ===== | ||
+ | |||
+ | < | ||
+ | svn checkout | ||
+ | </ | ||
+ | |||
+ | You will be asked for a user name and password. You can easily get that from NCAR through http:// | ||
+ | |||
+ | (the first time it will use your unix user name.. Just type the wrong password, and then it will prompt you for another user name, then use the one provided by NCAR). | ||
+ | |||
+ | **To use the development version of CAM5-Oslo, check out NorESM (not CESM) from the noresm repository** | ||
+ | < | ||
+ | svn checkout https:// | ||
+ | </ | ||
===== Compile the netcdf libraries using gfortran ===== | ===== Compile the netcdf libraries using gfortran ===== | ||
Line 37: | Line 51: | ||
* export CXXFLAGS=-O0 | * export CXXFLAGS=-O0 | ||
- | The netcdf c-library complains about a non-successful compilation because it can not find Doxyfile. This is not important. | + | The netcdf c-library complains about a non-successful compilation because it can not find Doxyfile. This is not important. |
3) Get the netcdf source code (including the c-headers) from | 3) Get the netcdf source code (including the c-headers) from | ||
Line 45: | Line 59: | ||
c) make install | c) make install | ||
- | 4) Get fortran netcdf api (http:// | + | 4) Get fortran netcdf api (http:// |
http:// | http:// | ||
+ | |||
+ | |||
===== Compile CAM on your Linux PC ===== | ===== Compile CAM on your Linux PC ===== | ||
+ | |||
+ | When you have succesfully obtained netCDF libraries, you need to set some environent variables in order to tell CAM where to find these libraries, add the following to your .bashrc file (but change the path to the correct path). Make sure you have the netcdf.mod-file in " | ||
+ | |||
+ | < | ||
+ | export INC_NETCDF=/ | ||
+ | export LIB_NETCDF=/ | ||
+ | export MOD_NETCDF=/ | ||
+ | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: | ||
+ | </ | ||
The steps for building and installing CAM are well described at http:// | The steps for building and installing CAM are well described at http:// | ||
Line 56: | Line 81: | ||
* export CSMDATA=/ | * export CSMDATA=/ | ||
- | This command | + | This command |
< | < | ||
Line 62: | Line 87: | ||
</ | </ | ||
- | (note that if you copy/paste the above line, the " | + | **As long as $camcfg is defined, |
- | As long as $camcfg | + | Then you need the following commands **executed from the same directory |
+ | < | ||
+ | $camcfg/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | make | ||
+ | </ | ||
+ | |||
+ | The input data have been collected and put at norstore: | ||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | You should copy these files to somewhere on your computer. The CSMDATA environment variable should point to the " | ||
+ | < | ||
+ | alfg@pc4400: | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Finally run the model simply executing the command | ||
+ | < | ||
+ | ./cam | ||
+ | </ | ||
+ | |||
+ | |||
+ | NOTE: In CAM5.5 (upcoming versions) this same procedure is supposed to work with the following command (NOT VERIFIED): | ||
+ | < | ||
+ | $camcfg/ | ||
+ | </ | ||
===== Including cam-oslo code ===== | ===== Including cam-oslo code ===== | ||
- | Some cam-oslo code has been preliminary ported to work in CAM 5.3 | + | This assumes you checked out NorESM (and CESM) with subversion |
- | This code can be accessed | + | Works with latest version of oslo aerosol development branch |
+ | < | ||
+ | | ||
+ | </ | ||
- | < | ||
- | Execute | + | There are additional input needed for the CAM-Oslo code. They are available in the same input-directory as the normal CESM-input files. |
+ | As long as the whole input directory is copied and the CSMDATA-environmen-variable is set, you don't have to do anything. The input-directory at norstore is: | ||
+ | < | ||
+ | /projects/NS2345K/noresm/CAM5.3_PCLinux/CAM5.3Input10x15/csm/inputdata | ||
+ | </file> | ||
- | All instructions on building/ | ||
===== Debug the model using ddd or gdb ===== | ===== Debug the model using ddd or gdb ===== | ||
Line 86: | Line 145: | ||
ddd sometimes hangs forever on startup. If that happens you need to remove the ~/.ddd/init file | ddd sometimes hangs forever on startup. If that happens you need to remove the ~/.ddd/init file | ||
- | gdb has problems with printing info about allocatable arrays. (See bottom of this page (and links therein) http:// | + | gdb has problems with printing info about allocatable arrays. Allocatable arrays have to be displayed as " |
+ | |||
+ | It is sometimes useful to let the compiler tell you about additional errors. Assuming you use gfortran on your PC: See https:// | ||
Line 111: | Line 172: | ||
Save the xml-file to the use_cases directory as " | Save the xml-file to the use_cases directory as " | ||
+ | < | ||
$camcfg/ | $camcfg/ | ||
+ | </ | ||
< | < |