1 | #!/bin/ksh |
---|
2 | |
---|
3 | #----------------------------------- |
---|
4 | function MBG_Initialize |
---|
5 | { |
---|
6 | IGCM_debug_PushStack "MBG_Initialize" |
---|
7 | |
---|
8 | # Local function to find namelists parameters |
---|
9 | supergrep () { |
---|
10 | grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%" |
---|
11 | } |
---|
12 | |
---|
13 | ##--Variables used by OPA -- |
---|
14 | |
---|
15 | |
---|
16 | ##--Variables used by MBG -- |
---|
17 | |
---|
18 | # ln_rsttr boolean term for tracer model restart (true or false) |
---|
19 | # nrsttr control of the time step (0, 1 or 2) |
---|
20 | |
---|
21 | ##--Variables used by PISCES -- |
---|
22 | |
---|
23 | PAT_TOP_LRSTTR=$( supergrep ln_rsttr ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} ) |
---|
24 | PAT_TOP_NRSTTR=$( supergrep nrsttr ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} ) |
---|
25 | PAT_PIS_ATCCO2=$( supergrep atcco2 ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} ) |
---|
26 | PAT_PIS_LRIVER=$( supergrep ln_river ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} ) |
---|
27 | |
---|
28 | IGCM_debug_PopStack "MBG_Initialize" |
---|
29 | } |
---|
30 | |
---|
31 | #----------------------------------- |
---|
32 | function MBG_Update |
---|
33 | { |
---|
34 | IGCM_debug_PushStack "MBG_Update" |
---|
35 | |
---|
36 | ##-- Restart configuration |
---|
37 | if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then |
---|
38 | |
---|
39 | #echo "NO RESTART FOR TOP" |
---|
40 | TOP_LRSTTR=.FALSE. |
---|
41 | TOP_NRSTTR=0 |
---|
42 | |
---|
43 | PISCES_LRIVER=.FALSE. |
---|
44 | |
---|
45 | elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then |
---|
46 | |
---|
47 | #echo "RESTART TOP" |
---|
48 | TOP_LRSTTR=.TRUE. |
---|
49 | TOP_NRSTTR=0 |
---|
50 | |
---|
51 | PISCES_LRIVER=.TRUE. |
---|
52 | |
---|
53 | else |
---|
54 | |
---|
55 | #echo "RESTART TOP" |
---|
56 | TOP_LRSTTR=.TRUE. |
---|
57 | TOP_NRSTTR=2 |
---|
58 | |
---|
59 | PISCES_LRIVER=.TRUE. |
---|
60 | |
---|
61 | fi |
---|
62 | |
---|
63 | ##-- Enable dbio output file |
---|
64 | DBIO_ENABLE=".FALSE." |
---|
65 | eval pisces_DBIO_ENABLE=\${pisces_UserChoices_DBIO_ENABLE} > /dev/null 2>&1 |
---|
66 | if [ "${pisces_DBIO_ENABLE}" = "y" ]; then |
---|
67 | DBIO_ENABLE=".TRUE." |
---|
68 | fi |
---|
69 | |
---|
70 | # update iodef.xml |
---|
71 | |
---|
72 | echo 'Informations into iodef.xml : DBIO_ENABLE' |
---|
73 | echo ${DBIO_ENABLE} |
---|
74 | |
---|
75 | sed -e "s/<DBIO_ENABLE>/${DBIO_ENABLE}/" \ |
---|
76 | iodef.xml > iodef.xml.tmp |
---|
77 | |
---|
78 | IGCM_sys_Mv iodef.xml.tmp iodef.xml |
---|
79 | |
---|
80 | ##-- GHG forcing for the current year |
---|
81 | IPCC_PIS_CO2=`grep Annee_${year} CO2_1765_2005.txt | awk -F= '{print $2}'` |
---|
82 | |
---|
83 | ##-- Update namelist_top and namelist_pisces |
---|
84 | |
---|
85 | sed -e "s%${PAT_TOP_LRSTTR}% ln_rsttr=${TOP_LRSTTR}%" \ |
---|
86 | -e "s%${PAT_TOP_NRSTTR}% nrsttr=${TOP_NRSTTR}%" \ |
---|
87 | namelist_top > namelist_top.tmp |
---|
88 | |
---|
89 | IGCM_sys_Mv namelist_top.tmp namelist_top |
---|
90 | |
---|
91 | sed -e "s%${PAT_PIS_ATCCO2}% atcco2=${IPCC_PIS_CO2}%" \ |
---|
92 | -e "s%${PAT_PIS_LRIVER}% ln_river=${PISCES_LRIVER}%" \ |
---|
93 | namelist_pisces > namelist_pisces.tmp |
---|
94 | |
---|
95 | IGCM_sys_Mv namelist_pisces.tmp namelist_pisces |
---|
96 | |
---|
97 | |
---|
98 | IGCM_debug_PopStack "MBG_Update" |
---|
99 | } |
---|
100 | |
---|
101 | #----------------------------------- |
---|
102 | function MBG_Finalize |
---|
103 | { |
---|
104 | IGCM_debug_PushStack "MBG_Finalize" |
---|
105 | |
---|
106 | echo FINALIZE MBG !!! |
---|
107 | |
---|
108 | IGCM_debug_PopStack "MBG_Finalize" |
---|
109 | } |
---|
110 | |
---|