source: CONFIG/IPSLCM/IPSLCM5/branches/IPSLCM5_v2/EXP00/COMP/oasis.driver @ 808

Last change on this file since 808 was 808, checked in by mafoipsl, 14 years ago
  • Adapt CPL card and driver to postprocess CPL exchanged fields. 4 files could be created (1D and 1M on atm/oce grids). More information here : IPSLCM5CplFields
  • ftrace and ice evolu not stored
File size: 2.8 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    export CPL_OkDay="n"
21    export 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    ############ Update Other Parameters  ##############
44    ## Read Output_mode option in ${compname}.card --> Put "y" to have coupling variables in ouptut files
45    export CPL_OutputMode="n"
46    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices OutputMode
47    eval CPL_OutputMode=\${${compname}_UserChoices_OutputMode} > /dev/null 2>&1
48    echo CPL_OutputMode = ${CPL_OutputMode}
49    CPL_OutputVar='EXPORTED'
50    if [ ${CPL_OutputMode} = y ] ; then
51        CPL_OutputVar='EXPOUT'
52    fi
53
54    ############ Update Parameter Files   ##############
55    sed -e "s/<initial_date>/${PeriodDateBegin}/" \
56        -e "s/<total_time>/${D_JOB_SEC}/" \
57        -e "s/<lib_mpi>/${LIBMPI}/" \
58        -e "s/<nproc_atm>/${NUM_PROC_ATM}/g" \
59        -e "s/<nproc_oce>/${NUM_PROC_OCE}/g" \
60        -e "s/<output_mode>/${CPL_OutputVar}/g" \
61        namcouple > namcouple.tmp
62    IGCM_sys_Mv namcouple.tmp namcouple
63
64    # Unused files we want to remove
65    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=trace
66    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=gweights
67    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=mweights
68    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=anaisout
69
70    IGCM_debug_PopStack "CPL_Update"
71}
72
73#-----------------------------------
74CPL_Finalize ()
75{
76    IGCM_debug_PushStack "CPL_Finalize"
77
78    DATE_CPL=$(echo ${PeriodDateBegin} | sed -e "{ s/^\(.\{4\}\)/\1-/;s/\(-.\{2\}\)/\1-/; }");
79    DATE_CPL=${DATE_CPL}"T00:00:00"
80   
81    echo ${DATE_CPL} ${CPL_OutputMode} ${CPL_OkDay} ${CPL_OkMonth}
82
83    if [ "${CPL_OutputMode}" = "y" ] ; then
84
85        [[ ${CPL_OkDay}   = "y" ]] && date >TEMPO_1D_cpl_atm.nc
86        [[ ${CPL_OkMonth} = "y" ]] && date >TEMPO_1M_cpl_atm.nc
87        [[ ${CPL_OkDay}   = "y" ]] && date >TEMPO_1D_cpl_oce.nc
88        [[ ${CPL_OkMonth} = "y" ]] && date >TEMPO_1M_cpl_oce.nc
89
90    fi
91
92    echo FINALIZE CPL !!!
93
94    IGCM_debug_PopStack "CPL_Finalize"
95}
Note: See TracBrowser for help on using the repository browser.