New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
sbcblk_sanity_check.sh in NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/EXPREF – NEMO

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

Last change on this file since 13682 was 13682, checked in by laurent, 3 years ago

Still improving the oce+ice capable STATION_ASF...

  • Property svn:executable set to *
File size: 6.7 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="`dirname ${PWD} | sed -e 's|/tests/STATION_ASF||g'`" ; # that should normally do the trick!
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" ; # for now the sanity test does not test ice-atmo bulk parameterizations
44
45
46####### End of normal user configurable section #######
47
48#================================================================================
49
50# Should the `analyze_output.py` script provide more output ???
51cmore=""
52if [ "$1" != "" ]; then
53    if [ "$1" = "more" ]; then
54        cmore="m"
55    else
56        echo "Only 'more' is accepted as argument for script `basename $0` !"
57        exit
58    fi
59fi
60
61
62
63rm -f SBCBLK.success SBCBLK.fail
64
65HERE=`pwd`
66
67echo
68
69# Is the nemo.exe of STATION_ASF compiled with sea-ice support (SI3) ?
70i_si3=0
71FCPP="${SASF_WRK_DIR}/cpp_${CONFIG_BLD}.fcm"
72if [ ! -f ${FCPP} ]; then echo " Mhhh, we did not find 'cpp_STATION_ASF.fcm' into `dirname ${FCPP}` !"; exit; fi
73ca=`cat ${FCPP} | grep 'key_si3'`
74
75if [ "${ca}" = "" ]; then
76    echo " *** NEMO was NOT compiled with sea-ice support (SI3) !" ; echo
77    if [ ${i_sea_ice} -eq 1 ]; then
78        echo " ===> so you cannot request ice-air flux computation !"
79        echo "     ===> please set i_sea_ice=0 or compile STATION_ASF with CPP key 'key_si3' !"
80        echo ; exit
81    fi
82else
83    echo " *** NEMO was apparently compiled with sea-ice support (SI3) !" ; echo
84    i_si3=1
85fi
86
87
88DIR_NL=${NFORC}/oce ; # directory where to find the namelists...
89
90# NEMO executable to use is:
91NEMO_EXE="${SASF_WRK_DIR}/BLD/bin/nemo.exe"
92if [ ! -f ${NEMO_EXE} ]; then echo " Mhhh, no compiled 'nemo.exe' found into `dirname ${NEMO_EXE}` !"; exit; fi
93
94SASF_EXPREF=`pwd`  ; # STATION_ASF EXPREF directory from which to use namelists and XIOS xml files...
95
96
97if [ ! -d ${DATA_IN_DIR} ]; then echo "PROBLEM!!! => did not find directory 'input_data' with input forcing..."; exit; fi
98
99cdt_cmpl="`\ls -l ${NEMO_EXE} | cut -d' ' -f 6,7,8`"
100
101echo "###########################################################"
102echo "#        S T A T I O N   A i r  -  S e a   F l u x        #"
103echo "###########################################################"
104echo
105echo "  * NEMO reference root directory is: ${NEMO_REF_DIR}"
106echo "  * STATION_ASF work directory is: ${SASF_WRK_DIR}"
107echo "       ==> NEMO EXE to use: ${NEMO_EXE}"
108echo "           ==> compiled: ${cdt_cmpl} !"
109echo
110echo "  * Input forcing data into: ${DATA_IN_DIR}"
111echo "  * Production will be done into: ${PROD_DIR}"
112echo "  * Directory in which namelists and xml files are fetched:"
113echo "       ==> ${SASF_EXPREF}"
114echo
115sleep 2
116
117mkdir -p ${PROD_DIR}
118
119rsync -avP ${NEMO_EXE}          ${PROD_DIR}/
120ln -sf     ${NEMO_EXE}          ${PROD_DIR}/nemo.exe.lnk
121
122
123# XIOS xml file
124################
125
126list_xml="iodef.xml file_def_nemo-oce.xml field_def_nemo-oce.xml"
127fcntxt="context_nemo_OCE.xml"
128if [ ${i_sea_ice} -eq 1 ]; then
129    list_xml+=" file_def_nemo-ice.xml field_def_nemo-ice.xml"
130    fcntxt="context_nemo_OCE+ICE.xml"
131fi
132
133# The "context_nemo.xml" file:
134if [ ! -f ${SASF_EXPREF}/${fcntxt} ]; then echo " Mhhh, ${fcntxt} not found into ${SASF_EXPREF} !"; exit; fi
135rsync -avPL ${SASF_EXPREF}/${fcntxt} ${PROD_DIR}/context_nemo.xml
136
137# All remaining "*.xml" files:
138for ff in ${list_xml} ; do
139    if [ ! -f ${SASF_EXPREF}/${ff} ]; then echo " Mhhh, ${ff} not found into ${SASF_EXPREF} !"; exit; fi
140    rsync -avPL ${SASF_EXPREF}/${ff} ${PROD_DIR}/
141done
142
143
144# Getting reference/defaults files from reference NEMO distro:
145rdir="${NEMO_REF_DIR}/cfgs/SHARED"
146for ff in "domain_def_nemo.xml" "grid_def_nemo.xml"; do
147    if [ ! -f ${rdir}/${ff} ]; then echo " Mhhh, ${ff} not found into ${rdir} !"; exit; fi
148    ln -sf ${rdir}/${ff} ${PROD_DIR}/.
149done
150
151
152# Copy forcing to work directory:
153echo ; echo "Forcing files to use:"
154\ls -l ${DATA_IN_DIR}/${FORC}
155echo
156rsync -avP ${DATA_IN_DIR}/${FORC} ${PROD_DIR}/
157echo; echo
158
159for CASE in "NCAR" "ECMWF" "COARE3p0" "COARE3p6" "ANDREAS"; do
160
161        echo ; echo
162        echo "======================================================================="
163        echo " Going for experiment: ${CASE} bulk param. with ${NFORC} forcing "
164        echo "======================================================================="
165        echo
166
167        scase=`echo "${CASE}" | tr '[:upper:]' '[:lower:]'`
168
169        rm -f ${PROD_DIR}/namelist_cfg
170        fnml="${SASF_EXPREF}/${DIR_NL}/namelist_${scase}_cfg"
171        if [ ! -f ${fnml} ]; then echo " Mhhh, test namelist ${fnml} not found !"; exit; fi
172
173        echo "   ===> namelist to use is: ${DIR_NL}/namelist_${scase}_cfg !"; echo
174       
175        # The namelists:
176        rsync -avPL ${SASF_EXPREF}/${DIR_NL}/namelist_${scase}_cfg ${PROD_DIR}/namelist_cfg
177        rsync -avPL ${SASF_EXPREF}/namelist_ref                   ${PROD_DIR}/namelist_ref
178   
179        cd ${PROD_DIR}/
180        echo
181        echo "Launching NEMO !"
182        ./nemo.exe 1>out_nemo.out 2>err_nemo.err
183        echo "Done!"
184        echo
185
186        # Moving output files:
187        mkdir -p output
188        mv -f ${CONFIG}-${CASE}_${NFORC}_*_grid*.nc output/
189
190        # Saving logs:
191        mkdir -p ${CASE}_${NFORC}_log
192        mv -f *.out *.err ocean.output output.namelist.dyn ${CASE}_${NFORC}_log/
193
194done
195
196
197
198
199# Now we can compare the results with sanity range!
200
201echo ; echo ; echo
202echo " *** Now time for sanity-check of heat flux and wind stress components ***"
203echo
204
205cd ${HERE}
206python3 ./analyze_output.py ${DATA_IN_DIR}/${FORC} ${PROD_DIR}/output ${cmore}
207
208
Note: See TracBrowser for help on using the repository browser.