#!/bin/bash set -x plots="FINNMARK" res="1x1" copy_phase="T" # Copy all files to the right place first_phase="F" # Simulate for 5 days second_phase="F" # Interpolate with existing data, then spin up archive="F" #module load nco module load cesm indir=/usit/abel/u1/jennybj outdir=/work/users/jennybj for plotn in $plots; do if [ ${copy_phase} = "T" ] then ## copy surface data and domain files cd /work/users/jennybj mkdir -p inputdata/share/domains/domain.clm/ cp ${indir}/domain_file/domain.lnd.${plotn}.${res}.nc ${outdir}/inputdata/share/domains/domain.clm/domain.lnd.${res}_${plotn}_navy.nc #!! need to modify "namelist_defaults_usr_files.xml" to set up the correct file name and directory for "fpftdyn" #!! requirement: lnd/clm2/surfdata_map/surfdata.pftdyn_${clm_usr_name}_simyr1850-2005.nc #!! lnd/clm2/surfdata_map/surfdata.pftdyn_rcp${rcp}_${clm_usr_name}_simyr${sim_year_range}.nc ## for constant pft cover, 2000 or 1850 simulation mkdir -p inputdata/lnd/clm2/surfdata_map cp ${indir}/inputdata/lnd/clm2/surfdata_map/surfdata_${res}_${plots}_simyr2000.nc ${outdir}/inputdata/lnd/clm2/surfdata_map/surfdata_${res}_${plotn}_simyr2000_cesm1_2_x_clm4_5.nc ## for constant 2000 or 1850 simulation # mkdir -p inputdata/atm/cam/chem/trop_mozart_aero/aero # cp ${indir}/mkmapdata/aerdep/aerosoldep_monthly_2000_mean_${plotn}_1x1.nc ${outdir}/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_2000_mean_1x1_${plotn}.nc mkdir -p inputdata/lnd/clm2/snicardata cp ${indir}/mkmapdata/aerdep/aerosoldep_monthly_1849-2006_${plotn}_${res}.nc ${outdir}/inputdata/lnd/clm2/snicardata/aerosoldep_monthly_1849-2006_${res}_${plotn}.nc if [ ${res} = "1x1" ] then mkdir -p /work/users/jennybj/inputdata/atm/datm7/CLM1PT_data/1x1_${plotn} cp ${indir}/inputdata/atm/1x1_${plotn}/clm1pt_${plotn}_* ${outdir}/inputdata/atm/datm7/CLM1PT_data/1x1_${plotn}/ # rename clm1pt_FINNMARK_1 1 * # rename clm1pt_FINNMARK_2 2 * fi fi if [ ${first_phase} = "T" ] then cd ${indir}/cesm/cesm1_2_2/scripts ./create_newcase -case ${indir}/cesm_case/1x1_${plotn} -user_compset 2000_DATM%1PT_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV -mach abel -res CLM_USRDAT #-mpilib mpich2 cd ${indir}/cesm_case/1x1_${plotn} # NEED TO DO THIS? # sed -i -e 's/12.1.2/12.1.3/g' env_mach_specific ## # sed -i -e 's/2.2.1/2.4.2/g' env_mach_specific ## # sed -i "34i module unload craype-interlagos" env_mach_specific # default 20TR run, RUN_STARTDATE=1850-01-01; RCP8 run, RUN_STARTDATE=2005-01-01 ./xmlchange -file env_run.xml -id RUN_STARTDATE -val 0001-01-01 # xmlchange -file env_run.xml -id PIO_BUFFER_SIZE_LIMIT -val 0 ./xmlchange -file env_run.xml -id DIN_LOC_ROOT -val /work/users/jennybj/inputdata ./xmlchange -file env_run.xml -id DATM_PRESAERO -val pt1_pt1 ./xmlchange -file env_run.xml -id DATM_CLMNCEP_YR_ALIGN -val 0001 ./xmlchange -file env_run.xml -id DATM_CLMNCEP_YR_START -val 1981 ./xmlchange -file env_run.xml -id DATM_CLMNCEP_YR_END -val 2010 ./xmlchange -file env_run.xml -id CLM_USRDAT_NAME -val 1x1_${plotn} ./cesm_setup # CHECK IF NEED TO ADD -mkl in SLIBS in the Macros file # TO INCLUDE MODIFIED CODE # cp /home/uio/huit/noresm/cases/norway_plot405/SourceMods/src.clm/CNDVMod.F90 ./SourceMods/src.clm/ ./1x1_${plotn}.build # create user_datm.streams.txt.CLM1PT.CLM_USRDAT cp ${indir}/user_datm.streams.txt.CLM1PT.CLM_USRDAT ${indir}/cesm_case/1x1_${plotn}/ ./preview_namelist ## modify run file # CHANGE time, cpu=1, project... can be done in the file directly # sed -i -e 's/#PBS -A/#PBS -A nn2806k/g' 1x1_${plotn}.run # sed -i -e 's/#PBS -l walltime=05:00:00/#PBS -l walltime=00:15:00/g' 1x1_${plotn}.run ## modify user_nl_clm sed -i "21i ndepmapalgo = 'nn'" user_nl_clm sed -i "22i popdensmapalgo = 'nn'" user_nl_clm # sed -i "23i stream_year_first_popdens = 2000" user_nl_clm # sed -i "24i stream_year_last_popdens = 2000" user_nl_clm sed -i "23i lightngmapalgo = 'nn'" user_nl_clm ## modify user_nl_datm sed -i "14i taxmode = 'cycle'" user_nl_datm # ./1x1_${plotn}.submit fi if [ ${second_phase} = "T" ] then #### second phase module switch PrgEnv-cray/5.2.40 PrgEnv-intel module load cray-netcdf ## prepare initial files for CLM run cp /work/users/jennybj/1x1_${plotn}/run/1x1_${plotn}.clm2.r.0001-01-06-00000.nc /usit/abel/u1/jennybj/cesm/cesm1_2_2/models/lnd/clm/tools/clm4_5/interpinic/ cd /usit/abel/u1/jennybj/cesm/cesm1_2_2/models/lnd/clm/tools/clm4_5/interpinic cp 1x1_${plotn}.clm2.r.0001-01-06-00000.nc initial_1x1_${plotn}.clm2.r.0001-01-06-00000.nc ./interpinic -i clmi.I2000CLM45CRUBGC.2000-01-01.0.9x1.25_gx1v6_simyr2000_c130517.nc -o initial_1x1_${plotn}.clm2.r.0001-01-06-00000.nc cp initial_1x1_${plotn}.clm2.r.0001-01-06-00000.nc /work/users/jennybj/1x1_${plotn}/run/ # cd /work/huit/noresm/norway_plot${plotn}/run ## modify use_clm_nl cd /usit/abel/u1/jennybj/cesm_case/1x1_${plotn} sed -i "24i finidat = '/work/users/jennybj/1x1_${plotn}/run/initial_1x1_${plotn}.clm2.r.0001-01-06-00000.nc'" user_nl_clm ## modify run file # CHANGE again time, cpu etc... sed -i -e 's/#PBS -l walltime=05:00:00/#PBS -l walltime=00:45:00/g' 1x1_${plotn}.run # CHANGE this ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears ./xmlchange -file env_run.xml -id STOP_N -val 20 # xmlchange -file env_run.xml -id REST_OPTION -val nyears ./xmlchange -file env_run.xml -id RESUBMIT -val 2 # ./1x1_${plotn}.submit fi if [ ${archive} = "T" ] then cd /work/huit/archive scp -r 1x1_${plotn} huit@norstore.uio.no:/projects/NS2806K/huit/noresm/archive/ fi done