source: CONFIG/IPSLCM/IPSLCM5/branches/IPSLCM5_WORK/EXPBIOS/COMP/stomate.driver

Last change on this file was 738, checked in by mafoipsl, 15 years ago

Commit again to keep history : Adapt EXPBIOS.
EXPBIOS is a new configuration to activate BIO-CHEMICAL processes (STOMATE) with Land Use 1860 map.

See test in http://dods.extra.cea.fr/data/p86manci/IPSLCM5/CM5STO/

File size: 2.6 KB
Line 
1#!/bin/ksh
2
3#D- Driver du script pour ORCHIDEE
4
5#-----------------------------------------------------------------
6function BIOS_Initialize
7{
8    IGCM_debug_PushStack "BIOS_Initialize"
9
10    RESOL_BIOS=ALL
11   
12    IGCM_debug_PopStack "BIOS_Initialize"
13}
14
15#-----------------------------------------------------------------
16function BIOS_Update
17{
18    IGCM_debug_PushStack "BIOS_Update"
19
20    typeset STOMATE_WRITE_STEP
21
22    case ${config_BIOS_WriteFrequency} in
23        *Y|*y) 
24            WriteInYears=$( echo ${1} | awk -F '[yY]' "{print ${config_BIOS_WriteFrequency}}" )
25            PeriodLengthInYears=$( echo ${1} | awk -F '[yY]' "{print ${config_UserChoices_PeriodLength}}" )
26            (( STOMATE_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears )) ;;
27        *M|*m) 
28            WriteInMonths=$( echo ${1} | awk -F '[mM]' "{print ${config_BIOS_WriteFrequency}}" )
29            case ${config_UserChoices_PeriodLength} in
30            *Y|*y)
31                PeriodLengthInYears=$( echo ${1} | awk -F '[yY]' "{print ${config_UserChoices_PeriodLength}}" )
32                (( STOMATE_WRITE_STEP = 30 )) ;;
33            *M|*m)
34                PeriodLengthInMonths=$( echo ${1} | awk -F '[mM]' "{print ${config_UserChoices_PeriodLength}}" )
35                (( STOMATE_WRITE_STEP = PeriodLengthInDays * WriteInMonths / PeriodLengthInMonths )) ;;
36            *)
37                (( STOMATE_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) )) ;;
38            esac
39            ;;
40        5D|5d) 
41            (( STOMATE_WRITE_STEP = 5 )) ;;
42        1D|1d) 
43            (( STOMATE_WRITE_STEP = 1 )) ;;
44        *s)
45            WriteInSeconds=$( echo ${1} | awk -F '[s]' "{print ${config_BIOS_WriteFrequency}}" )
46            (( STOMATE_WRITE_STEP = 1 )) ;;
47        *) 
48            IGCM_debug_Exit "BIOS_Update " ${config_BIOS_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D." 
49            IGCM_debug_Verif_Exit ;;
50    esac
51
52    ORCHIDEE_sed STOMATE_OK_STOMATE y
53
54    ORCHIDEE_sed STOMATE_HIST_DT ${STOMATE_WRITE_STEP}
55    ORCHIDEE_sed STOMATE_HISTLEVEL ${stomate_UserChoices_stomate_LEVEL}
56    if ( [ ${CumulPeriod} -eq 1 ] && [ "${config_BIOS_Restart}" = "n" ] ) ; then
57        echo "STOMATE : without restart"
58    else
59        ORCHIDEE_sed STOMATE_RESTART_FILEIN stomate_rest_in.nc
60    fi
61
62    IGCM_debug_PopStack "BIOS_Update"
63}
64
65#-----------------------------------------------------------------
66function BIOS_Finalize
67{
68#set -vx
69    IGCM_debug_PushStack "BIOS_Finalize"
70
71    if [ $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${year}1230 ) -ge 0 ] ; then
72        IGCM_sys_Put_Out stomate_Cforcing.nc ${R_OUT_BIOS_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_stomate_Cforcing.nc
73        IGCM_sys_Put_Out stomate_forcing.nc  ${R_OUT_BIOS_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_stomate_forcing.nc
74#       rm -f stomate_Cforcing.nc
75#       rm -f stomate_forcing.nc
76    fi
77
78    IGCM_debug_PopStack "BIOS_Finalize"
79}
Note: See TracBrowser for help on using the repository browser.