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.
launch_sasf.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/launch_sasf.sh @ 13675

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

Setting up the new STATION_ASF with sea-ice support

  • Property svn:executable set to *
File size: 8.2 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
13CONFIG="STATION_ASF" ; # general name of the configuration
14CONFIG_BLD="STATION_ASF" ; # name of config as build in NEMO... (directory inside "tests" actually contains the compiled test-case?)
15
16# Root directory NEMOGCM reference depository where to fetch compiled STATION_ASF nemo.exe + default namelists:
17NEMO_REF_DIR="/home/laurent/DEV/NEMO/NEMOGCM_dev_r13648_ASINTER-04_laurent_bulk_ice"
18NEMO_WRK_DIR="/home/laurent/NEMO/NEMOvdev_r13648_ASINTER-04_laurent_bulk_ice"
19
20# NEMOGCM root directory where to fetch compiled STATION_ASF nemo.exe:
21SASF_WRK_DIR="${NEMO_WRK_DIR}/tests/${CONFIG_BLD}"
22
23# Directory where to run the simulation:
24PROD_DIR="${HOME}/tmp/${CONFIG}"
25
26
27
28# Atmo + SSX forcing to use and wheter to compute fluxes over sea-ice as well (i_sea_ice=1)
29#############################################################################################
30i_sea_ice=0 ; # default does not compute fluxes over sea-ice
31#
32NFORC="ERA5_arctic" ; i_sea_ice=1 ; FORC="ERA5_arctic_surface_81N_36p75E_1h" ; # string sufficient to copy relevant files as in "*${FORC}*.nc"
33
34#NFORC="PAPA" ; FORC="Station_PAPA_50N-145W" ; # string sufficient to copy relevant files as in "*${FORC}*.nc"
35
36
37
38
39####### End of normal user configurable section #######
40
41#================================================================================
42HERE=`pwd`
43
44echo
45
46# Is the nemo.exe of STATION_ASF compiled with sea-ice support (SI3) ?
47i_si3=0
48FCPP="${SASF_WRK_DIR}/cpp_${CONFIG_BLD}.fcm"
49if [ ! -f ${FCPP} ]; then echo " Mhhh, we did not find 'cpp_STATION_ASF.fcm' into `dirname ${FCPP}` !"; exit; fi
50ca=`cat ${FCPP} | grep 'key_si3'`
51
52if [ "${ca}" = "" ]; then
53    echo " *** NEMO was NOT compiled with sea-ice support (SI3) !" ; echo
54    if [ ${i_sea_ice} -eq 1 ]; then
55        echo " ===> so you cannot request ice-air flux computation !"
56        echo "     ===> please set i_sea_ice=0 or compile STATION_ASF with CPP key 'key_si3' !"
57        echo ; exit
58    fi
59else
60    echo " *** NEMO was apparently compiled with sea-ice support (SI3) !" ; echo
61    i_si3=1
62fi
63
64# Ok things are a bit different whether we compute fluxes over open ocean only or open ocean + sea-ice
65if [ ${i_sea_ice} -eq 1 ]; then
66    # OPEN-OCEAN/AIR + SEA-ICE/AIR flux computation
67    #   - simpler if we only use one Open-ocean/air algo (ECMWF)
68    LIST_OA_ALGOS="ECMWF" ;          # list of air-sea algorithms to test
69    LIST_IA_ALGOS="LG15 LU12 CSTC" ; # list of air-ice algorithms to test
70    DIR_NL=${NFORC}/ice ; # where to get the namelists from...
71else
72    # Only OPEN-OCEAN/AIR flux computation
73    LIST_OA_ALGOS="NCAR ECMWF" ; # "NCAR ECMWF COARE3p6"; do   ; # list of air-sea algorithms to test
74    LIST_IA_ALGOS=""
75    DIR_NL=${NFORC}/oce ; # where to get the namelists from...
76fi
77if [ ! -d ${DIR_NL} ]; then echo " Mhhh, seems like forcing ${NFORC} is not meant to be used with sea-ice/air flux computation !"; exit; fi
78
79
80
81# NEMO executable to use is:
82NEMO_EXE="${SASF_WRK_DIR}/BLD/bin/nemo.exe"
83if [ ! -f ${NEMO_EXE} ]; then echo " Mhhh, no compiled 'nemo.exe' found into `dirname ${NEMO_EXE}` !"; exit; fi
84
85SASF_EXPREF=`pwd`  ; # STATION_ASF EXPREF directory from which to use namelists and XIOS xml files...
86
87
88# DATA_IN_DIR => Directory containing sea-surface + atmospheric forcings
89#             (get it there https://drive.google.com/file/d/1MxNvjhRHmMrL54y6RX7WIaM9-LGl--ZP/):
90if [ `hostname` = "merlat"        ]; then
91    DATA_IN_DIR="/MEDIA/data/STATION_ASF/input_data"
92elif [ `hostname` = "luitel"        ]; then
93    DATA_IN_DIR="/data/gcm_setup/STATION_ASF/input_data"
94elif [ `hostname` = "ige-meom-cal1" ]; then
95    DATA_IN_DIR="/mnt/meom/workdir/brodeau/STATION_ASF/input_data"
96elif [ `hostname` = "salvelinus" ]; then
97    DATA_IN_DIR="/opt/data/STATION_ASF/input_data"
98else
99    echo "Boo!"; exit
100fi
101if [ ! -d ${DATA_IN_DIR} ]; then echo "PROBLEM!!! => did not find directory 'input_data' with input forcing..."; exit; fi
102
103cdt_cmpl="`\ls -l ${NEMO_EXE} | cut -d' ' -f 6,7,8`"
104
105echo "###########################################################"
106echo "#        S T A T I O N   A i r  -  S e a   F l u x        #"
107echo "###########################################################"
108echo
109echo "  * NEMO reference root directory is: ${NEMO_REF_DIR}"
110echo "  * STATION_ASF work directory is: ${SASF_WRK_DIR}"
111echo "       ==> NEMO EXE to use: ${NEMO_EXE}"
112echo "           ==> compiled: ${cdt_cmpl} !"
113echo
114echo "  * Input forcing data into: ${DATA_IN_DIR}"
115echo "  * Production will be done into: ${PROD_DIR}"
116echo "  * Directory in which namelists and xml files are fetched:"
117echo "       ==> ${SASF_EXPREF}"
118echo
119sleep 2
120
121mkdir -p ${PROD_DIR}
122
123rsync -avP ${NEMO_EXE}          ${PROD_DIR}/
124ln -sf     ${NEMO_EXE}          ${PROD_DIR}/nemo.exe.lnk
125
126
127# XIOS xml file
128################
129
130list_xml="iodef.xml file_def_nemo-oce.xml field_def_nemo-oce.xml"
131fcntxt="context_nemo_OCE.xml"
132if [ ${i_sea_ice} -eq 1 ]; then
133    list_xml+=" file_def_nemo-ice.xml field_def_nemo-ice.xml"
134    fcntxt="context_nemo_OCE+ICE.xml"
135fi
136
137# The "context_nemo.xml" file:
138if [ ! -f ${SASF_EXPREF}/${fcntxt} ]; then echo " Mhhh, ${fcntxt} not found into ${SASF_EXPREF} !"; exit; fi
139rsync -avPL ${SASF_EXPREF}/${fcntxt} ${PROD_DIR}/context_nemo.xml
140
141# All remaining "*.xml" files:
142for ff in ${list_xml} ; do
143    if [ ! -f ${SASF_EXPREF}/${ff} ]; then echo " Mhhh, ${ff} not found into ${SASF_EXPREF} !"; exit; fi
144    rsync -avPL ${SASF_EXPREF}/${ff} ${PROD_DIR}/
145done
146
147
148# Getting reference/defaults files from reference NEMO distro:
149rdir="${NEMO_REF_DIR}/cfgs/SHARED"
150for ff in "domain_def_nemo.xml" "grid_def_nemo.xml"; do
151    if [ ! -f ${rdir}/${ff} ]; then echo " Mhhh, ${ff} not found into ${rdir} !"; exit; fi
152    ln -sf ${rdir}/${ff} ${PROD_DIR}/.
153done
154
155
156# Copy forcing to work directory:
157echo ; echo "Forcing files to use:"
158\ls -l ${DATA_IN_DIR}/*${FORC}*.nc
159echo
160rsync -avP ${DATA_IN_DIR}/*${FORC}*.nc ${PROD_DIR}/
161echo; echo
162
163
164if [ "${LIST_IA_ALGOS}" = "" ]; then LIST_IA_ALGOS="none"; fi
165
166echo " {LIST_OA_ALGOS} = ${LIST_OA_ALGOS} !"
167echo " {LIST_IA_ALGOS} = ${LIST_IA_ALGOS} !"
168
169for OA_A in ${LIST_OA_ALGOS}; do
170    for IA_A in ${LIST_IA_ALGOS}; do
171       
172        CASE="${OA_A}"
173        if [ ${i_sea_ice} -eq 1 ] && [ "${IA_A}" != "none" ]; then CASE="${OA_A}-${IA_A}"; fi
174
175        echo ; echo
176        echo "===================================="
177        echo " Going for ${CASE} experiment"
178        echo "===================================="
179        echo
180
181        scase=`echo "${CASE}" | tr '[:upper:]' '[:lower:]'`
182
183        rm -f ${PROD_DIR}/namelist_cfg
184        fnml="${SASF_EXPREF}/${DIR_NL}/namelist_${scase}_cfg"
185        if [ ! -f ${fnml} ]; then echo " Mhhh, test namelist ${fnml} not found !"; exit; fi
186
187        echo "   ===> namelist to use is: ${DIR_NL}/namelist_${scase}_cfg !"; echo
188       
189        # The namelists:
190        rsync -avPL ${SASF_EXPREF}/${DIR_NL}/namelist_${scase}_cfg ${PROD_DIR}/namelist_cfg
191        rsync -avPL ${SASF_EXPREF}/namelist_ref                   ${PROD_DIR}/namelist_ref
192        if [ ${i_sea_ice} -eq 1 ]; then
193            rsync -avPL ${SASF_EXPREF}/namelist_ice_ref ${PROD_DIR}/namelist_ice_ref
194            rsync -avPL ${SASF_EXPREF}/namelist_ice_cfg ${PROD_DIR}/namelist_ice_cfg
195        fi
196       
197        cd ${PROD_DIR}/
198        echo
199        echo "Launching NEMO !"
200        ./nemo.exe 1>out_nemo.out 2>err_nemo.err
201        echo "Done!"
202        echo
203
204        # Moving output files:
205        mkdir -p output
206        mv -f ${CONFIG}-${CASE}_*_grid*.nc output/
207        if [ ${i_sea_ice} -eq 1 ]; then mv -f ${CONFIG}-${CASE}_*_icemod.nc output/; fi
208
209        # Saving logs:
210        mkdir -p ${CASE}_${NFORC}_log
211        mv -f *.out *.err ocean.output output.namelist.dyn ${CASE}_${NFORC}_log/
212
213        # Making 3x3 to 1 !
214        cd output/
215        mkdir -p 3x3
216        list=`\ls ${CONFIG}*${CASE}*.nc | grep -v '_restart_'`
217        for ff in ${list}; do
218            echo
219            fn=`echo ${ff} | sed -e "s|.nc|_${NFORC}_1p.nc|g"`
220            fb=`echo ${ff} | sed -e "s|.nc|_${NFORC}.nc|g"`
221            CMD="ncks -O -d x,1 -d y,1 ${ff} -o ${fn}"
222            echo " *** ${CMD}"; ${CMD}
223            mv -f ${ff} 3x3/${fb}
224            echo
225        done
226
227    done
228
229done
Note: See TracBrowser for help on using the repository browser.