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 @ 13686

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

Improvements for "oce+ice capable" STATION_ASF!

  • Property svn:executable set to *
File size: 6.8 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 could 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
97CFGS_SHARED="${NEMO_REF_DIR}/cfgs/SHARED"
98if [ ! -d ${CFGS_SHARED} ]; then echo "PROBLEM!!! => could not find directory ${CFGS_SHARED} !"; exit; fi
99
100if [ ! -d ${DATA_IN_DIR} ]; then echo "PROBLEM!!! => could not find directory 'input_data' with input forcing..."; exit; fi
101
102cdt_cmpl="`\ls -l ${NEMO_EXE} | cut -d' ' -f 6,7,8`"
103
104echo "###########################################################"
105echo "#        S T A T I O N   A i r  -  S e a   F l u x        #"
106echo "###########################################################"
107echo
108echo "  * NEMO reference root directory is: ${NEMO_REF_DIR}"
109echo "  * STATION_ASF work directory is: ${SASF_WRK_DIR}"
110echo "       ==> NEMO EXE to use: ${NEMO_EXE}"
111echo "           ==> compiled: ${cdt_cmpl} !"
112echo
113echo "  * Input forcing data into: ${DATA_IN_DIR}"
114echo "  * Production will be done into: ${PROD_DIR}"
115echo "  * Directory in which namelists and xml files are fetched:"
116echo "       ==> ${SASF_EXPREF}"
117echo
118sleep 2
119
120mkdir -p ${PROD_DIR}
121
122rsync -avP ${NEMO_EXE}          ${PROD_DIR}/
123ln -sf     ${NEMO_EXE}          ${PROD_DIR}/nemo.exe.lnk
124
125
126# XIOS xml file
127################
128
129list_xml_ref="field_def_nemo-oce.xml domain_def_nemo.xml grid_def_nemo.xml"
130list_xml_cfg="iodef.xml file_def_nemo-oce.xml"
131fcntxt="context_nemo_OCE.xml"
132if [ ${i_sea_ice} -eq 1 ]; then
133    list_xml_ref+=" field_def_nemo-ice.xml"
134    list_xml_cfg+=" file_def_nemo-ice.xml"
135    fcntxt="context_nemo_OCE+ICE.xml"
136fi
137
138# The "context_nemo.xml" file:
139if [ ! -f ${SASF_EXPREF}/${fcntxt} ]; then echo " Mhhh, ${fcntxt} not found into ${SASF_EXPREF} !"; exit; fi
140rsync -avPL ${SASF_EXPREF}/${fcntxt} ${PROD_DIR}/context_nemo.xml
141
142# All remaining "*.xml" files:
143for ff in ${list_xml_cfg} ; do
144    if [ ! -f ${SASF_EXPREF}/${ff} ]; then echo " Mhhh, ${ff} not found into ${SASF_EXPREF} !"; exit; fi
145    rsync -avPL ${SASF_EXPREF}/${ff} ${PROD_DIR}/
146done
147for ff in ${list_xml_ref} ; do
148    if [ ! -f ${CFGS_SHARED}/${ff} ]; then echo " Mhhh, ${ff} not found into ${CFGS_SHARED} !"; exit; fi
149    rsync -avPL ${CFGS_SHARED}/${ff} ${PROD_DIR}/
150done
151
152
153# Copy forcing to work directory:
154echo ; echo "Forcing files to use:"
155\ls -l ${DATA_IN_DIR}/${FORC}
156echo
157rsync -avP ${DATA_IN_DIR}/${FORC} ${PROD_DIR}/
158echo; echo
159
160for CASE in "NCAR" "ECMWF" "COARE3p0" "COARE3p6" "ANDREAS"; do
161
162        echo ; echo
163        echo "======================================================================="
164        echo " Going for experiment: ${CASE} bulk param. with ${NFORC} forcing "
165        echo "======================================================================="
166        echo
167
168        scase=`echo "${CASE}" | tr '[:upper:]' '[:lower:]'`
169
170        rm -f ${PROD_DIR}/namelist_cfg
171        fnml="${SASF_EXPREF}/${DIR_NL}/namelist_${scase}_cfg"
172        if [ ! -f ${fnml} ]; then echo " Mhhh, test namelist ${fnml} not found !"; exit; fi
173
174        echo "   ===> namelist to use is: ${DIR_NL}/namelist_${scase}_cfg !"; echo
175       
176        # The namelists:
177        rsync -avPL ${SASF_EXPREF}/${DIR_NL}/namelist_${scase}_cfg ${PROD_DIR}/namelist_cfg
178        rsync -avPL ${CFGS_SHARED}/namelist_ref                    ${PROD_DIR}/namelist_ref
179   
180        cd ${PROD_DIR}/
181        echo
182        echo "Launching NEMO !"
183        ./nemo.exe 1>out_nemo.out 2>err_nemo.err
184        echo "Done!"
185        echo
186
187        # Moving output files:
188        mkdir -p output
189        mv -f ${CONFIG}-${CASE}_${NFORC}_*_grid*.nc output/
190
191        # Saving logs:
192        mkdir -p ${CASE}_${NFORC}_log
193        mv -f *.out *.err ocean.output output.namelist.dyn ${CASE}_${NFORC}_log/
194
195done
196
197
198
199
200# Now we can compare the results with sanity range!
201
202echo ; echo ; echo
203echo " *** Now time for sanity-check of heat flux and wind stress components ***"
204echo
205
206cd ${HERE}
207python3 ./analyze_output.py ${DATA_IN_DIR}/${FORC} ${PROD_DIR}/output ${cmore}
208
209
Note: See TracBrowser for help on using the repository browser.