#!/bin/bash # for compilation CFG_TYPE='cfgs' # data DATA_NAME='' # restart list RST_LST='icb ice trc' # Agrif USE_AGRIF=0 NZOOM_AGRIF=0 # length simulation ITEND=992 ; STOCK=$((ITEND/2)) ITEND1=1984 ; STOCK1=$((ITEND1/2)) # processor set up JPNI_REF=4 ; JPNJ_REF=8 ; NPROC_REF=$((JPNI_REF*JPNJ_REF)) JPNI_MPP=8 ; JPNJ_MPP=4 ; NPROC_MPP=$((JPNI_MPP*JPNJ_MPP)) # namelist setup # define set_namelist_common function (could the REF setting) define_namelist_common() { set_namelist namelist_cfg nn_it000 1 set_namelist namelist_cfg nn_itend $ITEND set_namelist namelist_cfg nn_stock $STOCK set_namelist namelist_cfg jpni $JPNI_REF set_namelist namelist_cfg jpnj $JPNJ_REF set_namelist namelist_cfg ln_ctl .false. set_namelist namelist_cfg sn_cfctl%l_config .true. set_namelist namelist_cfg sn_cfctl%l_runstat .true. set_namelist namelist_cfg sn_cfctl%l_trcstat .true. set_namelist namelist_cfg ln_linssh .true. } # SHOULD this be in all_function with CONFIG as argument (need to see how it will work for AGRIF)? # define set_namelist_REF function (that overwrite the default value set in common) define_namelist_ref() { set_namelist namelist_cfg cn_exp \"${CONFIG}_ST_REF\" } # SHOULD this be in all_function with CONFIG and STOCK as argument (need to see how it will work for AGRIF)? # define set_namelist_RST function (that overwrite the default value set in common) define_namelist_rst() { set_namelist namelist_cfg cn_exp \"${CONFIG}_ST_RST\" set_namelist namelist_cfg nn_it000 $((STOCK+1)) set_namelist namelist_top_cfg ln_rsttr .true. set_namelist namelist_top_cfg nn_rsttr 2 } # SHOULD this be in all_function with CONFIG and JPNI_MPP JPNJ_MPP as argument (need to see how it will work for AGRIF)? # define set_namelist_MPP function (that overwrite the default value set in common) define_namelist_MPP() { set_namelist namelist_cfg cn_exp \"${CONFIG}_ST_MPP\" set_namelist namelist_cfg jpni $JPNI_MPP set_namelist namelist_cfg jpnj $JPNJ_MPP } # SHOULD this be in all_function with CONFIG and L_NPROC, STOCK RST_LST as argument (need to see how it will work for AGRIF)? link_restart() { for (( i=1; i<=$NPROC; i++)) ; do L_NPROC=$(( $i - 1 )) L_NPROC=`printf "%04d\n" ${L_NPROC}` NSTOCK8d=`printf '%08d\n' ${$STOCK}` ln -sf ../REF/${CONFIG}_ST_REF_${NSTOCK8d}_restart_${L_NPROC}.nc restart_${L_NPROC}.nc for rst in $RST_LST; do ln -sf ../REF/${CONFIG}_ST_REF_${NSTOCK8d}_restart_${rst}_${L_NPROC}.nc restart_${rst}_${L_NPROC}.nc done done }