huangdzh@foxmail_com
New Member
This scripts (as bellow) is from another user whom I cannot find the name, I apologize for this.
Leo
build.csh
---------------------------------------------
#! /bin/csh -f
## 0.Note:
## This is the build script of CAM4_0.
## It will builds the executive file "cam" and creates a run script.
## 1.set enviroment of NetCDF et cl.
##
setenv LIB_NETCDF /usr/local/netcdf/lib
setenv INC_NETCDF /usr/local/netcdf/include
setenv MOD_NETCDF /usr/local/netcdf/include
setenv INC_MPI /usr/local/mpich/include
setenv LIB_MPI /usr/local/mpich/lib
#setenv LIB_PNETCDF /usr/local/netcdf/lib
#setenv INC_PNETCDF /usr/local/netcdf/include
#setenv ESMF_LIBDIR /usr/local/netcdf/include
#setenv LAPACK_LIBDIR /usr/local/netcdf/include
#
## 2.set enviroment of ROOT_Directory
## CAMROOT - root of CAM distribution - probably needs to be customized.
## CSMDATA - root of CAM Input Data distribution - needs to be customized unless running at NCAR.
##
set CAMROOT = /home/leo/models/CCSM4/ccsm4-2
setenv CSMDATA /home/leo/models/CCSM4/inputdata-1
setenv OMP_NUM_THREADS 1
#
## 3.set compile options.
## $usr_src specifies location of user-modified files: 'none' or a valid directory.
## $dycore is the dynamical core: 'eul', '', '' .
## $caseid if for notes to myself - keep it short!!!
## $hgrid: for eul or sld: ; for fv: .
## $nelapse is the number of timesteps to integrate,
## $ or the number of days if negative.
##
#set usr_src = "none"
#set usr_src = "/lustre/users/essljn/"
#set dycore = "homme"
#set dycore = "eul"
#set dycore = "sld"
set dycore = "fv"
set caseid = leo001
#
if ($dycore == "fv") then
# set hgrid = "1x1.25" ## no match
set hgrid = "1.9x2.5"
# set hgrid = "4x5"
# set hgrid = "10x15"
set nelapse = -61
else
# set hgrid = "128x256"
# set hgrid = "64x128"
set hgrid = "48x96"
# set hgrid = "128x256"
set nelapse = -61
endif
#
## Default namelist settings - will be placed in the namelist.
## $case is the case identifier for this run.
set case = ${dycore}${hgrid}_${caseid}
#
## 4.set a working directory
## $wrkdir is a working directory where the model will be built and run.
## $blddir is the directory where the model will be compiled and make.
## $rumdir is the directory where the model will be run.
## $cfgdir is the directory containing the CAM configuration scripts.
set wrkdir = /home/leo/models/CCSM4/ccsm4-2/$case
set blddir = $wrkdir
set rundir = $wrkdir
set cfgdir = $CAMROOT/models/atm/cam/bld
#
## Ensure that the build and run directory exist.
##
mkdir -p $blddir || echo " Cannot create $ blddir " && exit
mkdir -p $rundir || echo " Cannot create $ rundir " && exit
#cp $0 $rundir/buildscript.csh
#
## 5.configure and build model
##
if ( ! -x $blddir/cam) then
cd $blddir || echo " cd $blddir failed " && exit
$cfgdir/configure -test
-dyn $dycore
-hgrid $hgrid
-ntasks 4
-nosmp
|| echo " configure failed " && exit
echo " begin gmake... "
gmake -j4 >&! makeout.txt
|| echo " build failed - see $blddir/makeout.txt for details " && exit
echo "gmake done."
rm -rf *.o *.mod
else
echo " Found $blddir/cam - not building a new one "
endif
#
## 6.build namelist and check the inputdata
cd $blddir || echo " cd $blddir failed " && exit
touch namelistout.txt
echo " building the namelist..."
$cfgdir/build-namelist -test
-case $case
-runtype startup
-namelist "&camexp stop_option='ndays' stop_n=61
fincl2='T850:A','T300:A','V200:A','V850:A','U200:A','U850:A','Z500:A' /"
>&! namelistout.txt
|| echo " build namelist failed - see $blddir/namelistout.txt for details " && exit
echo "build-namelist done."
echo " --"
echo " see $blddir/namelistout.txt to check the inputdata "
echo " --"
#
## 7.create the run script in $rundir
#
cat >! $rundir/run.csh > output.txt
mpirun -np 4 $blddir/cam >&! runoutput.txt
# echo "End:: "`date` `perl -e 'print time();'` >> output.txt
#
EOF
chmod +x $rundir/run.csh
# END
Leo
build.csh
---------------------------------------------
#! /bin/csh -f
## 0.Note:
## This is the build script of CAM4_0.
## It will builds the executive file "cam" and creates a run script.
## 1.set enviroment of NetCDF et cl.
##
setenv LIB_NETCDF /usr/local/netcdf/lib
setenv INC_NETCDF /usr/local/netcdf/include
setenv MOD_NETCDF /usr/local/netcdf/include
setenv INC_MPI /usr/local/mpich/include
setenv LIB_MPI /usr/local/mpich/lib
#setenv LIB_PNETCDF /usr/local/netcdf/lib
#setenv INC_PNETCDF /usr/local/netcdf/include
#setenv ESMF_LIBDIR /usr/local/netcdf/include
#setenv LAPACK_LIBDIR /usr/local/netcdf/include
#
## 2.set enviroment of ROOT_Directory
## CAMROOT - root of CAM distribution - probably needs to be customized.
## CSMDATA - root of CAM Input Data distribution - needs to be customized unless running at NCAR.
##
set CAMROOT = /home/leo/models/CCSM4/ccsm4-2
setenv CSMDATA /home/leo/models/CCSM4/inputdata-1
setenv OMP_NUM_THREADS 1
#
## 3.set compile options.
## $usr_src specifies location of user-modified files: 'none' or a valid directory.
## $dycore is the dynamical core: 'eul', '', '' .
## $caseid if for notes to myself - keep it short!!!
## $hgrid: for eul or sld: ; for fv: .
## $nelapse is the number of timesteps to integrate,
## $ or the number of days if negative.
##
#set usr_src = "none"
#set usr_src = "/lustre/users/essljn/"
#set dycore = "homme"
#set dycore = "eul"
#set dycore = "sld"
set dycore = "fv"
set caseid = leo001
#
if ($dycore == "fv") then
# set hgrid = "1x1.25" ## no match
set hgrid = "1.9x2.5"
# set hgrid = "4x5"
# set hgrid = "10x15"
set nelapse = -61
else
# set hgrid = "128x256"
# set hgrid = "64x128"
set hgrid = "48x96"
# set hgrid = "128x256"
set nelapse = -61
endif
#
## Default namelist settings - will be placed in the namelist.
## $case is the case identifier for this run.
set case = ${dycore}${hgrid}_${caseid}
#
## 4.set a working directory
## $wrkdir is a working directory where the model will be built and run.
## $blddir is the directory where the model will be compiled and make.
## $rumdir is the directory where the model will be run.
## $cfgdir is the directory containing the CAM configuration scripts.
set wrkdir = /home/leo/models/CCSM4/ccsm4-2/$case
set blddir = $wrkdir
set rundir = $wrkdir
set cfgdir = $CAMROOT/models/atm/cam/bld
#
## Ensure that the build and run directory exist.
##
mkdir -p $blddir || echo " Cannot create $ blddir " && exit
mkdir -p $rundir || echo " Cannot create $ rundir " && exit
#cp $0 $rundir/buildscript.csh
#
## 5.configure and build model
##
if ( ! -x $blddir/cam) then
cd $blddir || echo " cd $blddir failed " && exit
$cfgdir/configure -test
-dyn $dycore
-hgrid $hgrid
-ntasks 4
-nosmp
|| echo " configure failed " && exit
echo " begin gmake... "
gmake -j4 >&! makeout.txt
|| echo " build failed - see $blddir/makeout.txt for details " && exit
echo "gmake done."
rm -rf *.o *.mod
else
echo " Found $blddir/cam - not building a new one "
endif
#
## 6.build namelist and check the inputdata
cd $blddir || echo " cd $blddir failed " && exit
touch namelistout.txt
echo " building the namelist..."
$cfgdir/build-namelist -test
-case $case
-runtype startup
-namelist "&camexp stop_option='ndays' stop_n=61
fincl2='T850:A','T300:A','V200:A','V850:A','U200:A','U850:A','Z500:A' /"
>&! namelistout.txt
|| echo " build namelist failed - see $blddir/namelistout.txt for details " && exit
echo "build-namelist done."
echo " --"
echo " see $blddir/namelistout.txt to check the inputdata "
echo " --"
#
## 7.create the run script in $rundir
#
cat >! $rundir/run.csh > output.txt
mpirun -np 4 $blddir/cam >&! runoutput.txt
# echo "End:: "`date` `perl -e 'print time();'` >> output.txt
#
EOF
chmod +x $rundir/run.csh
# END