source: NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF/sbcblk_sanity_check.sh @ 13676

Last change on this file since 13676 was 13676, checked in by laurent, 7 months ago

Setting up the new STATION_ASF with sea-ice support

  • Property svn:executable set to *
File size: 6.3 KB
Line 
1#!/bin/bash
2
3################################################################
4#
5# Script to launch a set of STATION_ASF simulations
6#
7#  Ocean-only version....
8#
9# L. Brodeau, 2020
10#
11#
12# Note: the current setup only performs an ocean-only test (no sea-ice),
13#       even though the current script already recongnises if the nemo.exe
14#       has been compiled with "key_si3". For now it will just test the
15#       fluxes over open water.
16#
17#
18#
19#
20#
21################################################################
22
23CONFIG="STATION_ASF" ; # general name of the configuration
24CONFIG_BLD="STATION_ASF2" ; # name of config as build in NEMO... (directory inside "tests" actually contains the compiled test-case?)
25
26# Root directory NEMOGCM reference depository where to fetch compiled STATION_ASF nemo.exe + default namelists:
27NEMO_REF_DIR="/home/laurent/DEV/NEMO/NEMOGCM_dev_r13648_ASINTER-04_laurent_bulk_ice"
28
29# NEMOGCM root directory where to fetch compiled STATION_ASF nemo.exe:
30SASF_WRK_DIR="${NEMO_REF_DIR}/tests/${CONFIG_BLD}"
31
32# DATA_IN_DIR => Directory containing sea-surface + atmospheric forcings:
33DATA_IN_DIR="${NEMO_REF_DIR}/tests/${CONFIG}/input_data"
34
35# Directory where to run the simulation:
36PROD_DIR="${HOME}/tmp/${CONFIG}"
37
38
39
40# Atmo + SSX forcing to use and wheter to compute fluxes over sea-ice as well (i_sea_ice=1)
41#############################################################################################
42i_sea_ice=0 ; # default does not compute fluxes over sea-ice
43NFORC="IDEALIZED" ; i_sea_ice=0 ; FORC="input_output_VALIDATION_IDEALIZED.nc"
44
45
46####### End of normal user configurable section #######
47
48#================================================================================
49
50rm -f SBCBLK.success SBCBLK.fail
51
52HERE=`pwd`
53
54echo
55
56# Is the nemo.exe of STATION_ASF compiled with sea-ice support (SI3) ?
57i_si3=0
58FCPP="${SASF_WRK_DIR}/cpp_${CONFIG_BLD}.fcm"
59if [ ! -f ${FCPP} ]; then echo " Mhhh, we did not find 'cpp_STATION_ASF.fcm' into `dirname ${FCPP}` !"; exit; fi
60ca=`cat ${FCPP} | grep 'key_si3'`
61
62if [ "${ca}" = "" ]; then
63    echo " *** NEMO was NOT compiled with sea-ice support (SI3) !" ; echo
64    if [ ${i_sea_ice} -eq 1 ]; then
65        echo " ===> so you cannot request ice-air flux computation !"
66        echo "     ===> please set i_sea_ice=0 or compile STATION_ASF with CPP key 'key_si3' !"
67        echo ; exit
68    fi
69else
70    echo " *** NEMO was apparently compiled with sea-ice support (SI3) !" ; echo
71    i_si3=1
72fi
73
74
75DIR_NL=${NFORC}/oce ; # directory where to find the namelists...
76
77# NEMO executable to use is:
78NEMO_EXE="${SASF_WRK_DIR}/BLD/bin/nemo.exe"
79if [ ! -f ${NEMO_EXE} ]; then echo " Mhhh, no compiled 'nemo.exe' found into `dirname ${NEMO_EXE}` !"; exit; fi
80
81SASF_EXPREF=`pwd`  ; # STATION_ASF EXPREF directory from which to use namelists and XIOS xml files...
82
83
84if [ ! -d ${DATA_IN_DIR} ]; then echo "PROBLEM!!! => did not find directory 'input_data' with input forcing..."; exit; fi
85
86cdt_cmpl="`\ls -l ${NEMO_EXE} | cut -d' ' -f 6,7,8`"
87
88echo "###########################################################"
89echo "#        S T A T I O N   A i r  -  S e a   F l u x        #"
90echo "###########################################################"
91echo
92echo "  * NEMO reference root directory is: ${NEMO_REF_DIR}"
93echo "  * STATION_ASF work directory is: ${SASF_WRK_DIR}"
94echo "       ==> NEMO EXE to use: ${NEMO_EXE}"
95echo "           ==> compiled: ${cdt_cmpl} !"
96echo
97echo "  * Input forcing data into: ${DATA_IN_DIR}"
98echo "  * Production will be done into: ${PROD_DIR}"
99echo "  * Directory in which namelists and xml files are fetched:"
100echo "       ==> ${SASF_EXPREF}"
101echo
102sleep 2
103
104mkdir -p ${PROD_DIR}
105
106rsync -avP ${NEMO_EXE}          ${PROD_DIR}/
107ln -sf     ${NEMO_EXE}          ${PROD_DIR}/nemo.exe.lnk
108
109
110# XIOS xml file
111################
112
113list_xml="iodef.xml file_def_nemo-oce.xml field_def_nemo-oce.xml"
114fcntxt="context_nemo_OCE.xml"
115if [ ${i_sea_ice} -eq 1 ]; then
116    list_xml+=" file_def_nemo-ice.xml field_def_nemo-ice.xml"
117    fcntxt="context_nemo_OCE+ICE.xml"
118fi
119
120# The "context_nemo.xml" file:
121if [ ! -f ${SASF_EXPREF}/${fcntxt} ]; then echo " Mhhh, ${fcntxt} not found into ${SASF_EXPREF} !"; exit; fi
122rsync -avPL ${SASF_EXPREF}/${fcntxt} ${PROD_DIR}/context_nemo.xml
123
124# All remaining "*.xml" files:
125for ff in ${list_xml} ; do
126    if [ ! -f ${SASF_EXPREF}/${ff} ]; then echo " Mhhh, ${ff} not found into ${SASF_EXPREF} !"; exit; fi
127    rsync -avPL ${SASF_EXPREF}/${ff} ${PROD_DIR}/
128done
129
130
131# Getting reference/defaults files from reference NEMO distro:
132rdir="${NEMO_REF_DIR}/cfgs/SHARED"
133for ff in "domain_def_nemo.xml" "grid_def_nemo.xml"; do
134    if [ ! -f ${rdir}/${ff} ]; then echo " Mhhh, ${ff} not found into ${rdir} !"; exit; fi
135    ln -sf ${rdir}/${ff} ${PROD_DIR}/.
136done
137
138
139# Copy forcing to work directory:
140echo ; echo "Forcing files to use:"
141\ls -l ${DATA_IN_DIR}/${FORC}
142echo
143rsync -avP ${DATA_IN_DIR}/${FORC} ${PROD_DIR}/
144echo; echo
145
146for CASE in "NCAR" "ECMWF" "COARE3p0" "COARE3p6" "ANDREAS"; do
147
148        echo ; echo
149        echo "======================================================================="
150        echo " Going for experiment: ${CASE} bulk param. with ${NFORC} forcing "
151        echo "======================================================================="
152        echo
153
154        scase=`echo "${CASE}" | tr '[:upper:]' '[:lower:]'`
155
156        rm -f ${PROD_DIR}/namelist_cfg
157        fnml="${SASF_EXPREF}/${DIR_NL}/namelist_${scase}_cfg"
158        if [ ! -f ${fnml} ]; then echo " Mhhh, test namelist ${fnml} not found !"; exit; fi
159
160        echo "   ===> namelist to use is: ${DIR_NL}/namelist_${scase}_cfg !"; echo
161       
162        # The namelists:
163        rsync -avPL ${SASF_EXPREF}/${DIR_NL}/namelist_${scase}_cfg ${PROD_DIR}/namelist_cfg
164        rsync -avPL ${SASF_EXPREF}/namelist_ref                   ${PROD_DIR}/namelist_ref
165   
166        cd ${PROD_DIR}/
167        echo
168        echo "Launching NEMO !"
169        ./nemo.exe 1>out_nemo.out 2>err_nemo.err
170        echo "Done!"
171        echo
172
173        # Moving output files:
174        mkdir -p output
175        mv -f ${CONFIG}-${CASE}_${NFORC}_*_grid*.nc output/
176
177        # Saving logs:
178        mkdir -p ${CASE}_${NFORC}_log
179        mv -f *.out *.err ocean.output output.namelist.dyn ${CASE}_${NFORC}_log/
180
181done
182
183
184
185
186# Now we can compare the results with sanity range!
187
188echo ; echo ; echo
189echo " *** Now time for sanity-check of heat flux and wind stress components ***"
190echo
191
192cd ${HERE}
193python3 ./analyze_output.py ${DATA_IN_DIR}/${FORC} ${PROD_DIR}/output
194
195
Note: See TracBrowser for help on using the repository browser.