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