noresm:settingupcamonlinuxpc

This is an old revision of the document!


Setting up CAM on your own linux PC

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.2 compiles with gfortran.

1) INSTALL NETCDF (4.2): Follow instructions on http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/Quick-Instructions.html#Quick-Instructions

I created library directories on /home/alfg/LIBS/.

For example /home/alfg/LIBS/netcdf-4.2.gfortran. These directories are use as “prefix=” in the installation guide..

When installing:

* Use instructions on how to build with hdf5

* Use the instructions about shared libraries. (There are also instructions about static libraries)

* Remember to set the LD_LIBRARY_PATH variable as described. Otherwise it does not work.

=⇒ Some exceptions

(Build order is wrong) http://mail.lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/2013-May/006818.html

(Have to do separately)

  • make
  • make check
  • make install

Add the following to your .bashrc file:

  • export FC=gfortran
  • export CC=gcc
  • export CFLAGS=-O0
  • export CXX=g++
  • export CXXFLAGS=-O0

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 http://www.unidata.ucar.edu/software/netcdf/docs/getting.html a) make b) make check c) make install

4) Get fortran netcdf api (http://www.unidata.ucar.edu/downloads/netcdf/netcdf-fortran/index.jsp) and follow http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html

The steps for building and installing CAM are well described at http://www.cesm.ucar.edu/models/cesm1.0/cam/docs/ug5_1/ug.html

You need the following settings in your .bashrc file:

  • export camcfg=/path/to/CESM_1_2_0/cesm1_2_0/models/atm/cam/bld
  • export CSMDATA=/path/to/cam/input/data

This command compiles CAM on my machine

$camcfg/configure -dyn fv -debug -hgrid 10×15 -fc gfortran -nospmd -nosmp -test -fc_type gnu

(note that if you copy/paste the above line, the “x” will sometimes change to a strange “star”-sign in “10×15”, make sure it is the letter “x”)

As long as $camcfg is defined, you can execute this from any directory..

Some cam-oslo code has been preliminary ported to work in CAM 5.3

This code can be accessed with git using the command:

git clone ssh://username@hexagon.bccs.uib.no/work/shared/noresm/repos/cam_oslo.git

Execute the command from ~/CESM_1_2_0/cesm1_2_0/models/atm/cam/src/physics/ so that a cam_oslo directory is created there.

All instructions on building/compiling this is in the README file in the cam_oslo directory.

Some first test show that the following information is useful:

gdb hangs forever on backtrace commmand sometimes. Adding set print frame-arguments none to your ~/.gdbinit file solves that problem on the expense of less information on “bt” command.

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://stackoverflow.com/questions/11786958/how-to-print-fortran-arrays-in-gdb)

If you want an other configuration than the standard configuration, you must add a use-case. The use case is an xml-file which is added to the /cesm1_2_0/models/atm/cam/bld/namelist_files/use_cases/ directory.

Below is an example of a use-case which writes some more frequent output (every hour) to history files.

The file says that we have 5 different history files. The first one is the monthly output with max one time step. The other files are output every hour (-1) with max number of samples 30 in each file.

For each of the different files (1-5) we have specified the fields we want to output. For example in the second, we output QREFHT, TREFHTMN etc..

Fields which end in “:I” are instantaneous values as opposed to time averages.

Save the xml-file to the use_cases directory as “my_case.xml” and run the command

$camcfg/build-namelist -test -config config_cache.xml -use_case my_case

Start file content

<?xml version=“1.0”?>

<namelist_defaults>

<mfilt>1,30,30,30,30</mfilt> <nhtfrq>0,-1,-1,-1,-1</nhtfrq>

<fincl2>'QREFHT','TREFHTMN','TREFHTMX','TREFHT','PRECT','PRECC','PRECSC','PRECSL ','PSL','T','Z3','U','V','PS','TS','SST','PHIS','CLDTOT'</fincl2> <fincl3>'U850:I','V850:I','T850:I','Q850:I','OMEGA850:I','U:I','V:I','T:I','PS:I','PSL:I','Q:I','PHIS:I'</fincl3> <fincl4>'PRECT','LHFLX','SHFLX','FLDS','FLNS','FSNS','PRECC','PRECSC','PRECSL'</fincl4> <fincl5>'TREFHT:I','QREFHT:I','TS:I','SST:I','PS:I'</fincl5>

</namelist_defaults>

End file content

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • noresm/settingupcamonlinuxpc.1382961381.txt.gz
  • Last modified: 2022-05-31 09:23:24
  • (external edit)