1 | #!/bin/ksh |
---|
2 | #----------------------------------- |
---|
3 | CPL_Initialize () |
---|
4 | { |
---|
5 | IGCM_debug_PushStack "CPL_Initialize" |
---|
6 | |
---|
7 | echo INITIALIZE CPL !!! |
---|
8 | |
---|
9 | RESOL_CPL=$( echo $RESOL | awk "-F-" '{print $1}' ) |
---|
10 | |
---|
11 | #D- MPI context used to launch the coupled model |
---|
12 | LIBMPI=$(cat ${SUBMIT_DIR}/../.libmpi) |
---|
13 | echo LIBMPI=${LIBMPI} |
---|
14 | |
---|
15 | #D- MPISUSPEND=ON required for MPMD mode used by oasis |
---|
16 | export MPISUSPEND=ON |
---|
17 | |
---|
18 | IGCM_sys_build_run_file ${LIBMPI} |
---|
19 | |
---|
20 | IGCM_debug_PopStack "CPL_Initialize" |
---|
21 | } |
---|
22 | |
---|
23 | #----------------------------------- |
---|
24 | CPL_Update () |
---|
25 | { |
---|
26 | IGCM_debug_PushStack "CPL_Update" |
---|
27 | |
---|
28 | ############ Update Time and Counters ############## |
---|
29 | ##-- Calcul de la duree du job (en secondes) |
---|
30 | (( D_JOB_SEC = 3600 * 24 * PeriodLengthInDays )) |
---|
31 | |
---|
32 | ############ Update Other Parameters ############## |
---|
33 | ## Read Output_mode option in ${compname}.card --> Put "y" to have coupling variables in ouptut files |
---|
34 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices Output_mode |
---|
35 | eval Output_mode=\${${compname}_UserChoices_Output_mode} > /dev/null 2>&1 |
---|
36 | echo ${Output_mode} |
---|
37 | Output_var='EXPORTED' |
---|
38 | if [ ${Output_mode} = y ] ; then |
---|
39 | Output_var='EXPOUT' |
---|
40 | fi |
---|
41 | |
---|
42 | ############ Update Parameter Files ############## |
---|
43 | sed -e "s/<initial_date>/${PeriodDateBegin}/" \ |
---|
44 | -e "s/<total_time>/${D_JOB_SEC}/" \ |
---|
45 | -e "s/<lib_mpi>/${LIBMPI}/" \ |
---|
46 | -e "s/<nproc_atm>/${NUM_PROC_ATM}/g" \ |
---|
47 | -e "s/<nproc_oce>/${NUM_PROC_OCE}/g" \ |
---|
48 | -e "s/<output_mode>/${Output_var}/g" \ |
---|
49 | namcouple > namcouple.tmp |
---|
50 | |
---|
51 | IGCM_sys_Mv namcouple.tmp namcouple |
---|
52 | # Unused files we want to remove |
---|
53 | eval FileToBeDeleted[${#FileToBeDeleted[@]}]=trace |
---|
54 | eval FileToBeDeleted[${#FileToBeDeleted[@]}]=gweights |
---|
55 | eval FileToBeDeleted[${#FileToBeDeleted[@]}]=mweights |
---|
56 | eval FileToBeDeleted[${#FileToBeDeleted[@]}]=anaisout |
---|
57 | |
---|
58 | IGCM_debug_PopStack "CPL_Update" |
---|
59 | } |
---|
60 | |
---|
61 | #----------------------------------- |
---|
62 | CPL_Finalize () |
---|
63 | { |
---|
64 | IGCM_debug_PushStack "CPL_Finalize" |
---|
65 | |
---|
66 | DATE_OASIS=$(echo ${PeriodDateBegin} | sed -e "{ s/^\(.\{4\}\)/\1-/;s/\(-.\{2\}\)/\1-/; }"); |
---|
67 | DATE_OASIS=${DATE_OASIS}"T00:00:00" |
---|
68 | |
---|
69 | echo FINALIZE CPL !!! |
---|
70 | |
---|
71 | IGCM_debug_PopStack "CPL_Finalize" |
---|
72 | } |
---|