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.
sanity_check_SBCBLK.sh in NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/SANITY_CHECK – NEMO

source: NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/tests/STATION_ASF/SANITY_CHECK/sanity_check_SBCBLK.sh @ 13868

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

Reorganization of the SBCBLK SANITY-CHECK of 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
19CONFIG="STATION_ASF" ; # general name of the configuration
20CONFIG_BLD="STATION_ASF2" ; # name of config as build in NEMO... (directory inside "tests" actually contains the compiled test-case?)
21
22# Atmo + SSX forcing to use and sea-ice support?
23FORCING="IDEALIZED" ; i_sea_ice=0 ; SFORC="input_output_VALIDATION_IDEALIZED.nc"
24
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}_test"
37
38# MPI launch command for your system
39# Even though we are running on 1 proc here, NEMO has likely been compiled with MPI,
40# if it's not the case then just leave "MPI_LAUNCH" void...
41MPI_LAUNCH="mpirun -n 1"
42
43####### End of normal user configurable section #######
44#================================================================================
45
46
47
48# Should the `analyze_output.py` script provide more output ???
49cmore=""
50if [ "$1" != "" ]; then
51    if [ "$1" = "more" ]; then
52        cmore="m"
53    else
54        echo "Only 'more' is accepted as argument for script `basename $0` !"
55        exit
56    fi
57fi
58
59rm -f SBCBLK.success SBCBLK.fail
60
61HERE=`pwd`
62
63echo
64
65# Is the nemo.exe of STATION_ASF compiled with sea-ice support (SI3) ?
66i_si3=0
67FCPP="${SASF_WRK_DIR}/cpp_${CONFIG_BLD}.fcm"
68if [ ! -f ${FCPP} ]; then echo " Mhhh, we could not find 'cpp_STATION_ASF.fcm' into `dirname ${FCPP}` !"; exit; fi
69ca=`cat ${FCPP} | grep 'key_si3'`
70
71if [ "${ca}" = "" ]; then
72    echo " *** NEMO was NOT compiled with sea-ice support (SI3) !" ; echo
73    if [ ${i_sea_ice} -eq 1 ]; then
74        echo " ===> so you cannot request ice-air flux computation !"
75        echo "     ===> please set i_sea_ice=0 or compile STATION_ASF with CPP key 'key_si3' !"
76        echo ; exit
77    fi
78else
79    echo " *** NEMO was apparently compiled with sea-ice support (SI3) !" ; echo
80    i_si3=1
81fi
82
83
84DIR_NL=${FORCING}/oce ; # directory where to find the namelists...
85
86# NEMO executable to use is:
87NEMO_EXE="${SASF_WRK_DIR}/BLD/bin/nemo.exe"
88if [ ! -f ${NEMO_EXE} ]; then echo " Mhhh, no compiled 'nemo.exe' found into `dirname ${NEMO_EXE}` !"; exit; fi
89
90SASF_EXPREF="${NEMO_REF_DIR}/tests/STATION_ASF/EXPREF" ; # STATION_ASF EXPREF directory from which to fetch and XIOS xml files...
91
92CFGS_SHARED="${NEMO_REF_DIR}/cfgs/SHARED"
93if [ ! -d ${CFGS_SHARED} ]; then echo "PROBLEM!!! => could not find directory ${CFGS_SHARED} !"; exit; fi
94
95if [ ! -d ${DATA_IN_DIR} ]; then echo "PROBLEM!!! => could not find directory 'input_data' with input forcing..."; exit; fi
96
97cdt_cmpl="`\ls -l ${NEMO_EXE} | cut -d' ' -f 6,7,8`"
98
99echo "###########################################################"
100echo "#        S T A T I O N   A i r  -  S e a   F l u x        #"
101echo "###########################################################"
102echo
103echo "  * NEMO reference root directory is: ${NEMO_REF_DIR}"
104echo "  * STATION_ASF work directory is: ${SASF_WRK_DIR}"
105echo "       ==> NEMO EXE to use: ${NEMO_EXE}"
106echo "           ==> compiled: ${cdt_cmpl} !"
107echo
108echo "  * Input forcing data into: ${DATA_IN_DIR}"
109echo "  * Production will be done into: ${PROD_DIR}"
110echo "  * Directory in which namelists and xml files are fetched:"
111echo "       ==> ${SASF_EXPREF}"
112echo
113sleep 2
114
115mkdir -p ${PROD_DIR}
116
117rsync -avP ${NEMO_EXE}          ${PROD_DIR}/
118ln -sf     ${NEMO_EXE}          ${PROD_DIR}/nemo.exe.lnk
119
120
121# XIOS xml file
122################
123
124list_xml_ref="field_def_nemo-oce.xml domain_def_nemo.xml grid_def_nemo.xml"
125list_xml_cfg="iodef.xml file_def_nemo-oce.xml"
126fcntxt="context_nemo_OCE.xml"
127if [ ${i_sea_ice} -eq 1 ]; then
128    list_xml_ref+=" field_def_nemo-ice.xml"
129    list_xml_cfg+=" file_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_cfg} ; 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
142for ff in ${list_xml_ref} ; do
143    if [ ! -f ${CFGS_SHARED}/${ff} ]; then echo " Mhhh, ${ff} not found into ${CFGS_SHARED} !"; exit; fi
144    rsync -avPL ${CFGS_SHARED}/${ff} ${PROD_DIR}/
145done
146
147
148# Copy forcing to work directory:
149echo ; echo "Forcing files to use:"
150\ls -l ${DATA_IN_DIR}/${SFORC}
151echo
152rsync -avP ${DATA_IN_DIR}/${SFORC} ${PROD_DIR}/
153echo; echo
154
155for CASE in "NCAR" "ECMWF" "COARE3p0" "COARE3p6" "ANDREAS"; do
156
157        echo ; echo
158        echo "======================================================================="
159        echo " Going for experiment: ${CASE} bulk param. with ${FORCING} forcing "
160        echo "======================================================================="
161        echo
162
163        scase=`echo "${CASE}" | tr '[:upper:]' '[:lower:]'`
164
165        rm -f ${PROD_DIR}/namelist_cfg
166        fnml="${HERE}/${DIR_NL}/namelist_${scase}_cfg"
167        if [ ! -f ${fnml} ]; then echo " Mhhh, test namelist ${fnml} not found !"; exit; fi
168
169        echo "   ===> namelist to use is: ${DIR_NL}/namelist_${scase}_cfg !"; echo
170       
171        # The namelists:
172        rsync -avPL ${HERE}/${DIR_NL}/namelist_${scase}_cfg        ${PROD_DIR}/namelist_cfg
173        rsync -avPL ${CFGS_SHARED}/namelist_ref                    ${PROD_DIR}/namelist_ref
174   
175        cd ${PROD_DIR}/
176        echo
177        echo "Launching NEMO ! (==> ${MPI_LAUNCH} ./nemo.exe)"
178        ${MPI_LAUNCH} ./nemo.exe 1>out_nemo.out 2>err_nemo.err
179        echo "Done!"
180        echo
181
182        # Moving output files:
183        mkdir -p output
184        mv -f ${CONFIG}-${CASE}_${FORCING}_*_grid*.nc output/
185
186        # Saving logs:
187        mkdir -p ${CASE}_${FORCING}_log
188        mv -f *.out *.err ocean.output output.namelist.dyn ${CASE}_${FORCING}_log/
189
190done
191
192
193
194
195# Now we can compare the results with sanity range!
196
197echo ; echo ; echo
198echo " *** Now time for sanity-check of heat flux and wind stress components ***"
199echo
200
201cd ${HERE}
202python3 ./analyze_output.py ${DATA_IN_DIR}/${SFORC} ${PROD_DIR}/output ${cmore}
203
204
Note: See TracBrowser for help on using the repository browser.