source: CMIP5/rcp45/v5.rcp85NP1/COMP/oasis.driver @ 1656

Last change on this file since 1656 was 1656, checked in by lfairhead, 12 years ago

v5.rcp45NP1 registration of CMIP5 IPSL
IPSLCM5B configuration rcp85 simulation

File size: 3.0 KB
Line 
1#!/bin/ksh
2#-----------------------------------
3CPL_Initialize ()
4{
5    IGCM_debug_PushStack "CPL_Initialize"
6 
7    echo INITIALIZE CPL !!!
8
9    RESOL_CPL=$( echo $RESOL | awk "-F-" '{print $1}' )
10
11    #D- MPI context used to launch the coupled model
12    LIBMPI=$(cat ${SUBMIT_DIR}/../.libmpi)
13    echo LIBMPI=${LIBMPI}
14
15    #D- MPISUSPEND=ON required for MPMD mode used by oasis
16    export MPISUSPEND=ON
17
18    IGCM_sys_build_run_file ${LIBMPI}
19
20    CPL_OkDay="n"
21    CPL_OkMonth="n"
22
23    for CPL_Frequency in ${config_CPL_WriteFrequency} ; do
24        case ${CPL_Frequency} in
25            *D|*d) CPL_OkDay="y"   ;;
26            *M)    CPL_OkMonth="y" ;;
27        esac
28    done
29
30    IGCM_debug_PopStack "CPL_Initialize"
31
32}
33
34#-----------------------------------
35CPL_Update ()
36{
37    IGCM_debug_PushStack "CPL_Update"
38
39    ############ Update Time and Counters ##############
40    ##-- Calcul de la duree du job (en secondes)
41    (( D_JOB_SEC = 3600 * 24 * PeriodLengthInDays ))
42
43    # nleapy configuration
44    case ${config_UserChoices_CalendarType} in
45        leap|gregorian)
46            CPL_calendar=1;;
47        noleap)
48            CPL_calendar=0;;
49        360d)
50            CPL_calendar=30;;
51        *)
52            CPL_calendar=30
53    esac
54
55    ############ Update Other Parameters  ##############
56    ## Read Output_mode option in oasis.card --> Put "y" to have coupling variables in ouptut files
57    CPL_OutputMode="n"
58    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/oasis.card UserChoices OutputMode
59    eval CPL_OutputMode=\${oasis_UserChoices_OutputMode} > /dev/null 2>&1
60    echo CPL_OutputMode = ${CPL_OutputMode}
61    CPL_OutputVar='EXPORTED'
62    if [ ${CPL_OutputMode} = y ] ; then
63        CPL_OutputVar='EXPOUT'
64    fi
65
66    ############ Update Parameter Files   ##############
67    sed -e "s/<initial_date>/${PeriodDateBegin}/" \
68        -e "s/<calendar_type>/${CPL_calendar}/" \
69        -e "s/<total_time>/${D_JOB_SEC}/" \
70        -e "s/<lib_mpi>/${LIBMPI}/" \
71        -e "s/<nproc_atm>/${NUM_PROC_ATM}/g" \
72        -e "s/<nproc_oce>/${NUM_PROC_OCE}/g" \
73        -e "s/<output_mode>/${CPL_OutputVar}/g" \
74        namcouple > namcouple.tmp
75    IGCM_sys_Mv namcouple.tmp namcouple
76
77    # Unused files we want to remove
78    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=trace
79    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=gweights
80    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=mweights
81    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=anaisout
82
83    IGCM_debug_PopStack "CPL_Update"
84}
85
86#-----------------------------------
87CPL_Finalize ()
88{
89    IGCM_debug_PushStack "CPL_Finalize"
90
91    DATE_CPL=$(echo ${PeriodDateBegin} | sed -e "{ s/^\(.\{4\}\)/\1-/;s/\(-.\{2\}\)/\1-/; }");
92    DATE_CPL=${DATE_CPL}"T00:00:00"
93   
94    echo ${DATE_CPL} ${CPL_OutputMode} ${CPL_OkDay} ${CPL_OkMonth}
95
96    if [ "${CPL_OutputMode}" = "y" ] ; then
97
98        [[ ${CPL_OkDay}   = "y" ]] && date >TEMPO_1D_cpl_atm.nc
99        [[ ${CPL_OkMonth} = "y" ]] && date >TEMPO_1M_cpl_atm.nc
100        [[ ${CPL_OkDay}   = "y" ]] && date >TEMPO_1D_cpl_oce.nc
101        [[ ${CPL_OkMonth} = "y" ]] && date >TEMPO_1M_cpl_oce.nc
102
103    fi
104
105    echo FINALIZE CPL !!!
106
107    IGCM_debug_PopStack "CPL_Finalize"
108}
Note: See TracBrowser for help on using the repository browser.