noresm:settingupcamonlinuxpc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
noresm:settingupcamonlinuxpc [2013-10-30 12:05:05]
alfg [Including cam-oslo code]
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 =====
 +
 +<file>
 +svn checkout  https://svn-ccsm-release.cgd.ucar.edu/model_versions/cesm1_2_0
 +</file>
 +
 +You will be asked for a user name and password. You can easily get that from NCAR through http://www.cesm.ucar.edu/models/cesm1.0/register/register_cesm1.0.cgi
 +
 +(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**
 +<file>
 +svn checkout https://svn.met.no/NorESM/noresm/branches/featureCAM5-OsloDevelopment_trunk2.0-4 myCamOsloDev
 +</file>
 ===== 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. The compilation needs also the following env-variables: CPPFLAGS=-I${dir}/include, LDFLAGS=-L${dir}/lib, where "dir" is directory you use for the "configure" scripts
  
 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://www.unidata.ucar.edu/downloads/netcdf/netcdf-fortran/index.jsp) and follow+4) Get fortran netcdf api (http://www.unidata.ucar.edu/downloads/netcdf/index.jsp) and follow
 http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html
 +
 +
  
 ===== 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 "MOD_NETCF". These environment variables are used by the CAM "configure" script!
 +
 +<file>
 +export INC_NETCDF=/home/alfg/LIBS/netcdf-4.2.gfortran/include
 +export LIB_NETCDF=/home/alfg/LIBS/netcdf-4.2.gfortran/lib
 +export MOD_NETCDF=/home/alfg/LIBS/netcdf-4.2.gfortran/include
 +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIB_NETCDF
 +</file>
  
 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 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
Line 56: Line 81:
   * export CSMDATA=/path/to/cam/input/data   * export CSMDATA=/path/to/cam/input/data
  
-This command compiles CAM on my machine+This command configures CAM (not including any CAM-Oslo code) on my machine. It creates a Makefile used later for compilation.
  
 <file> <file>
Line 62: Line 87:
 </file> </file>
  
-As long as $camcfg is defined, you can execute this from any directory..+**As long as $camcfg is defined, you can execute this from any directory..**
  
-===== Including cam-oslo code =====+Then you need the following commands **executed from the same directory as you executed "configure"** 
 +<file> 
 +$camcfg/build-namelist -test -config config_cache.xml 
 +</file>
  
-Some cam-oslo code has been preliminary ported to work in CAM 5.3+<file> 
 +make 
 +</file>
  
-This code can be accessed with git using the command+The input data have been collected and put at norstore 
 +<file> 
 +/projects/NS2345K/noresm/CAM5.3_PCLinux/CAM5.3Input10x15/csm/inputdata 
 +</file>
  
 +You should copy these files to somewhere on your computer. The CSMDATA environment variable should point to the "input-data" directory after the copying. For example I copied it to /disk1/alfg/csm/, so my $CSMDATA is
 <file> <file>
-git clone ssh://username@hexagon.bccs.uib.no/work/shared/noresm/repos/cam_oslo.git +alfg@pc4400:$ echo $CSMDATA 
 +/disk1/alfg/csm/inputdata
 </file> </file>
  
-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.+Finally run the model simply executing the command 
 +<file> 
 +./cam 
 +</file> 
 + 
 + 
 +NOTE: In CAM5.5 (upcoming versions) this same procedure is supposed to work with the following command (NOT VERIFIED):  
 +<file> 
 +$camcfg/configure -fc gfortran -fc_type gnu -debug -nospmd -nosmp -dyn fv -res 10x15 -ice sice -phys cam5 
 +</file> 
 + 
 +===== Including cam-oslo code ===== 
 + 
 +This assumes you checked out NorESM (and CESM) with subversion 
 + 
 +Works with latest version of oslo aerosol development branch 
 +<file> 
 + $camcfg/configure -dyn fv -debug -hgrid 10x15 -fc gfortran -nospmd -nosmp -test -fc_type gnu -chem trop_mam_oslo  
 +</file>
  
-All instructions on building/compiling this is in the README file in the cam_oslo directory. 
  
 There are additional input needed for the CAM-Oslo code. They are available in the same input-directory as the normal CESM-input files. There are additional input needed for the CAM-Oslo code. They are available in the same input-directory as the normal CESM-input files.
Line 93: 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://stackoverflow.com/questions/11786958/how-to-print-fortran-arrays-in-gdb) +gdb has problems with printing info about allocatable arrays. Allocatable arrays have to be displayed as "*((real_8 *)my_array + N)@M" where N is number of elements beyond first element and M is number of elements to show. (See bottom of this page (and links therein) http://stackoverflow.com/questions/11786958/how-to-print-fortran-arrays-in-gdb)  
 + 
 +It is sometimes useful to let the compiler tell you about additional errors. Assuming you use gfortran on your PC: See https://gcc.gnu.org/onlinedocs/gfortran/Code-Gen-Options.html for additional options. For example if you want to check just about everything, add "-fcheck=all" to the "FC_FLAGS" in the gfortran section. (Note: Running configure again re-generates the Makefile)
  
  
Line 118: Line 172:
 Save the xml-file to the use_cases directory as "my_case.xml" and run the command Save the xml-file to the use_cases directory as "my_case.xml" and run the command
  
 +<file>
 $camcfg/build-namelist -test -config config_cache.xml -use_case my_case $camcfg/build-namelist -test -config config_cache.xml -use_case my_case
 +</file>
  
 <file> <file>
  • noresm/settingupcamonlinuxpc.1383134705.txt.gz
  • Last modified: 2022-05-31 09:23:24
  • (external edit)