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_ATCCO2=$( supergrep atcco2 ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} ) |
---|
23 | PAT_PIS_LRIVER=$( supergrep ln_river ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} ) |
---|
24 | |
---|
25 | IGCM_debug_PopStack "MBG_Initialize" |
---|
26 | } |
---|
27 | |
---|
28 | #----------------------------------- |
---|
29 | function MBG_Update |
---|
30 | { |
---|
31 | IGCM_debug_PushStack "MBG_Update" |
---|
32 | |
---|
33 | ##-- Restart configuration |
---|
34 | if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then |
---|
35 | |
---|
36 | #echo "NO RESTART FOR TOP" |
---|
37 | TOP_LRSTTR=.FALSE. |
---|
38 | TOP_NRSTTR=0 |
---|
39 | |
---|
40 | PISCES_LRIVER=.FALSE. |
---|
41 | |
---|
42 | elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then |
---|
43 | |
---|
44 | #echo "RESTART TOP" |
---|
45 | TOP_LRSTTR=.TRUE. |
---|
46 | TOP_NRSTTR=0 |
---|
47 | |
---|
48 | PISCES_LRIVER=.TRUE. |
---|
49 | |
---|
50 | else |
---|
51 | |
---|
52 | #echo "RESTART TOP" |
---|
53 | TOP_LRSTTR=.TRUE. |
---|
54 | TOP_NRSTTR=2 |
---|
55 | |
---|
56 | PISCES_LRIVER=.TRUE. |
---|
57 | |
---|
58 | fi |
---|
59 | |
---|
60 | ##-- GHG forcing for the current year |
---|
61 | IPCC_PIS_CO2=`grep Annee_${year} CO2_1765_2500.txt | awk -F= '{print $2}'` |
---|
62 | |
---|
63 | ##-- Update namelist_top and namelist_pisces |
---|
64 | |
---|
65 | sed -e "s%${PAT_TOP_LRSTTR}% ln_rsttr=${TOP_LRSTTR}%" \ |
---|
66 | -e "s%${PAT_TOP_NRSTTR}% nrsttr=${TOP_NRSTTR}%" \ |
---|
67 | namelist_top > namelist_top.tmp |
---|
68 | |
---|
69 | IGCM_sys_Mv namelist_top.tmp namelist_top |
---|
70 | |
---|
71 | sed -e "s%${PAT_PIS_ATCCO2}% atcco2=${IPCC_PIS_CO2}%" \ |
---|
72 | -e "s%${PAT_PIS_LRIVER}% ln_river=${PISCES_LRIVER}%" \ |
---|
73 | namelist_pisces > namelist_pisces.tmp |
---|
74 | |
---|
75 | IGCM_sys_Mv namelist_pisces.tmp namelist_pisces |
---|
76 | |
---|
77 | |
---|
78 | IGCM_debug_PopStack "MBG_Update" |
---|
79 | } |
---|
80 | |
---|
81 | #----------------------------------- |
---|
82 | function MBG_Finalize |
---|
83 | { |
---|
84 | IGCM_debug_PushStack "MBG_Finalize" |
---|
85 | |
---|
86 | echo FINALIZE MBG !!! |
---|
87 | |
---|
88 | IGCM_debug_PopStack "MBG_Finalize" |
---|
89 | } |
---|
90 | |
---|