source: CONFIG/UNIFORM/v6/IPSLCM6CHT/GENERAL/DRIVER/oasis.driver @ 2456

Last change on this file since 2456 was 2456, checked in by acosce, 9 years ago

Add new configuration IPSLCM6CHT

File size: 3.7 KB
Line 
1#!/bin/ksh
2#-----------------------------------
3CPL_Initialize ()
4{
5    IGCM_debug_PushStack "CPL_Initialize"
6 
7    echo INITIALIZE CPL !!!
8
9# Local function to find parameters in LMDZ .def files
10    lmdzgrep () {
11        grep $1 $2 |grep -v "#" | awk "-F=" '{print $2}' | awk "-F " '{print $1}'
12    }
13
14    #RESOL_CPL=$( echo $RESOL | awk "-F-" '{print $1}' )
15    RESOL_CPL=${RESOL_OCE}x${RESOL_ATM}
16    IGCM_debug_Print 1 "RESOL_CPL      : ${RESOL_CPL}"
17
18    CPL_OkDay="n"
19    CPL_OkMonth="n"
20
21    for CPL_Frequency in ${config_CPL_WriteFrequency} ; do
22        case ${CPL_Frequency} in
23            *D|*d) CPL_OkDay="y"   ;;
24            *M)    CPL_OkMonth="y" ;;
25        esac
26    done
27
28    IGCM_debug_PopStack "CPL_Initialize"
29
30}
31
32#-----------------------------------
33CPL_Update ()
34{
35    IGCM_debug_PushStack "CPL_Update"
36
37    ############ Update Time and Counters ##############
38    ##-- Calcul de la duree du job (en secondes)
39    (( D_JOB_SEC = 3600 * 24 * PeriodLengthInDays ))
40
41    ############ Update Other Parameters  ##############
42    ## Read Output_mode option in oasis.card --> Put "y" to have coupling variables in ouptut files
43    CPL_OutputMode="n"
44    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/oasis.card UserChoices OutputMode
45    eval CPL_OutputMode=\${oasis_UserChoices_OutputMode} > /dev/null 2>&1
46    echo CPL_OutputMode = ${CPL_OutputMode}
47    CPL_OutputVar='EXPORTED'
48    if [ ${CPL_OutputMode} = y ] ; then
49        CPL_OutputVar='EXPOUT'
50    fi
51
52    FreqCoupling=${oasis_UserChoices_FreqCoupling:-86400}
53
54    ## Calculate lag for transfer of fields from atmosphere -> ocean.
55    ## LagAtm="1day in sec"/day_step * iphysiq/nsplit_phys
56    ## First get day_step, iphyisq and nsplit_phys from LMDZ parameter files
57    day_step=$(    lmdzgrep day_step gcm.def )
58    iphysiq=$(     lmdzgrep iphysiq gcm.def )
59    nsplit_phys=$( lmdzgrep nsplit_phys physiq.def )
60
61    IGCM_debug_Print 3 "Parametre de calcul Lag LMDZ recuperes " ${day_step} ${iphysiq} ${nsplit_phys}
62
63    [[ ${nsplit_phys} -eq 0 || "X${nsplit_phys}" = "X" ]] && nsplit_phys=1
64
65    IGCM_debug_Print 3 "Parametre de calcul Lag LMDZ mis a jour " ${day_step} ${iphysiq} ${nsplit_phys}
66                                                             
67    (( LagAtm = 86400 / day_step * iphysiq / nsplit_phys ))
68
69    (( LagOce = 86400 / ORCA_NPDT_JOUR ))
70
71    ## Use of Lucia ##
72    lucia_ok=""
73    if [ ${oasis_UserChoices_Lucia} = y ] ; then
74        lucia_ok="-1"
75    fi
76   
77    ############ Update Parameter Files   ##############
78    sed -e "s/<total_time>/${D_JOB_SEC}/" \
79        -e "s/<lucia_ok>/${lucia_ok}/" \
80        -e "s/<output_mode>/${CPL_OutputVar}/g" \
81        -e "s/<freq_coupling>/${FreqCoupling}/g" \
82        -e "s/<lag_atm>/${LagAtm}/g" \
83        -e "s/<lag_oce>/${LagOce}/g" \
84        namcouple > namcouple.tmp
85    IGCM_sys_Mv namcouple.tmp namcouple
86    # For IPSLCM6 and use of OASIS-MCT
87    if [ ${CumulPeriod} -eq 1 ]; then
88        ncrename -v OIceFrac,OIceFrc sstoc.nc > /dev/null 2>&1
89    fi
90    # For use of XIOS
91    IGCM_comp_modifyXmlFile force iodef.xml using_oasis NONE true
92
93    IGCM_debug_PopStack "CPL_Update"
94}
95
96#-----------------------------------
97CPL_Finalize ()
98{
99    IGCM_debug_PushStack "CPL_Finalize"
100
101    if [ "${CPL_OutputMode}" = "y" ] ; then
102
103        [[ ${CPL_OkDay}   = "y" ]] && date >TEMPO_1D_cpl_atm.nc
104        [[ ${CPL_OkMonth} = "y" ]] && date >TEMPO_1M_cpl_atm.nc
105        [[ ${CPL_OkDay}   = "y" ]] && date >TEMPO_1D_cpl_oce.nc
106        [[ ${CPL_OkMonth} = "y" ]] && date >TEMPO_1M_cpl_oce.nc
107
108    fi
109
110    ## Use of Lucia ##
111    if [ ${oasis_UserChoices_Lucia} = y ] ; then
112        echo "Use of LUCIA"
113    #   To be changed
114    #   On Curie
115    #   /ccc/scratch/cont003/dsm/p86caub/LUCIA/lucia
116    #   On Ada
117    #   /linkhome/rech/psl/rpsl035/LUCIA/lucia
118    fi
119
120    echo FINALIZE CPL !!!
121
122    IGCM_debug_PopStack "CPL_Finalize"
123}
Note: See TracBrowser for help on using the repository browser.