1+ #! /bin/sh
2+ # =======================================================================================
3+ # Setup and run an ELM OLMT simulation for an NGEE Arctic site
4+ #
5+ #
6+ # availible site names: kougarok, teller, council, beo
7+ # =======================================================================================
8+
9+ cwd=$( pwd)
10+ cd /tools/OLMT
11+
12+ # =======================================================================================
13+ # ## Setup and run an example ELM OLMT ensemble simulation for a NGEE-Arctic research site
14+ for i in " $@ "
15+ do
16+ case $i in
17+ -sn=* |--site_name=* )
18+ site_name=" ${i#* =} "
19+ shift # past argument=value
20+ ;;
21+ -sg=* |--site_group=* )
22+ site_group=" ${i#* =} "
23+ shift # past argument=value
24+ ;;
25+ -cp=* |--case_prefix=* )
26+ case_prefix=" ${i#* =} "
27+ shift # past argument=value
28+ ;;
29+ -adsy=* |--ad_spinup_years=* )
30+ ad_spinup_years=" ${i#* =} "
31+ shift # past argument=value
32+ ;;
33+ -fsy=* |--final_spinup_years=* )
34+ final_spinup_years=" ${i#* =} "
35+ shift # past argument=value
36+ ;;
37+ -trsy=* |--transient_years=* )
38+ transient_years=" ${i#* =} "
39+ shift # past argument=value
40+ ;;
41+ -tsp=* |--timestep=* )
42+ timestep=" ${i#* =} "
43+ shift # past argument=value
44+ ;;
45+ -pl=* |--param_list=* )
46+ param_list=" ${i#* =} "
47+ shift # past argument=value
48+ ;;
49+ -ne=* |--num_ens=* )
50+ num_ens=" ${i#* =} "
51+ shift # past argument=value
52+ ;;
53+ -ng=* |--num_groups=* )
54+ num_groups=" ${i#* =} "
55+ shift # past argument=value
56+ ;;
57+ * )
58+ # unknown option
59+ ;;
60+ esac
61+ done
62+ # =======================================================================================
63+
64+ # =======================================================================================
65+ # Set defaults and print the selected options back to the screen before running
66+ site_name=" ${site_name:- kougarok} "
67+ site_group=" ${site_group:- NGEEArctic} "
68+ case_prefix=" ${case_prefix:- OLMT_ens} "
69+ ad_spinup_years=" ${ad_spinup_years:- 200} "
70+ final_spinup_years=" ${final_spinup_years:- 600} "
71+ transient_years=" ${transient_years:- -1} "
72+ timestep=" ${timestep:- 1} "
73+ param_list=" ${param_list:-/ scripts/ param_list_example_kougarok} "
74+ num_ens=" ${num_ens:- 6} "
75+ num_groups=" ${num_groups:- 3} "
76+
77+ # print back selected or set options to the user
78+ echo " "
79+ echo " "
80+ echo " *************************** OLMT run options ***************************"
81+ echo " Site Name = ${site_name} "
82+ echo " Site Group = ${site_group} "
83+ echo " Case Prefix = ${case_prefix} "
84+ echo " Number of AD Spinup Simulation Years = ${ad_spinup_years} "
85+ echo " Number of Final Spinup Simulation Years = ${final_spinup_years} "
86+ echo " Number of Transient Simulation Years = ${transient_years} "
87+ echo " Model Timestep = ${timestep} "
88+ echo " Input parameter list = ${param_list} "
89+ echo " Number of MCMC Ensembles = ${num_ens} "
90+ echo " Number of MPI groups = ${num_groups} "
91+ if [ ${transient_years} != -1 ]; then
92+ sim_years=" --nyears_ad_spinup ${ad_spinup_years} --nyears_final_spinup ${final_spinup_years} \
93+ --nyears_transient ${transient_years} "
94+ else
95+ sim_years=" --nyears_ad_spinup ${ad_spinup_years} --nyears_final_spinup ${final_spinup_years} "
96+ fi
97+ echo " "
98+ # =======================================================================================
99+
100+ # =======================================================================================
101+ # Set site codes for OLMT
102+ if [ ${site_name} = beo ]; then
103+ site_code=" AK-BEOG"
104+ elif [ ${site_name} = council ]; then
105+ site_code=" AK-CLG"
106+ elif [ ${site_name} = kougarok ]; then
107+ site_code=" AK-K64G"
108+ elif [ ${site_name} = teller ]; then
109+ site_code=" AK-TLG"
110+ else
111+ echo " "
112+ echo " **** EXECUTION HALTED ****"
113+ echo " Please select a Site Name from beo, council, kougarok, teller"
114+ exit 0
115+ echo " "
116+ fi
117+ echo " OLMT Site Code: ${site_code} "
118+ # =======================================================================================
119+
120+ # =======================================================================================
121+ # pause to show options before continuing
122+ sleep 3
123+ echo " "
124+ echo " "
125+ # =======================================================================================
126+
127+ # =======================================================================================
128+ echo " Building ensemble simulations with OLMT source: " $( pwd)
129+ echo " *****************************************************************"
130+ echo " "
131+ echo " "
132+ echo " **** User OLMT run command: "
133+ runcmd=" python3 ./site_fullrun.py \
134+ --site ${site_code} --sitegroup ${site_group} --caseidprefix ${case_prefix} \
135+ ${sim_years} --tstep ${timestep} --machine docker \
136+ --compiler gnu --mpilib mpi-serial \
137+ --cpl_bypass --gswp3 \
138+ --model_root /E3SM \
139+ --caseroot /output \
140+ --ccsm_input /inputdata \
141+ --runroot /output \
142+ --spinup_vars \
143+ --parm_list ${param_list} \
144+ --mc_ensemble ${num_ens} \
145+ --nopointdata \
146+ --metdir /inputdata/atm/datm7/atm_forcing.datm7.GSWP3.0.5d.v2.c180716_NGEE-Grid/cpl_bypass_${site_name} -Grid \
147+ --domainfile /inputdata/share/domains/domain.clm/domain.lnd.1x1pt_${site_name} -GRID_navy.nc \
148+ --surffile /inputdata/lnd/clm2/surfdata_map/surfdata_1x1pt_${site_name} -GRID_simyr1850_c360x720_c171002.nc \
149+ --landusefile /inputdata/lnd/clm2/surfdata_map/landuse.timeseries_1x1pt_${site_name} -GRID_simyr1850-2015_c180423.nc \
150+ & sleep 10"
151+ echo ${runcmd}
152+ echo " "
153+ echo " "
154+
155+ # create the OLMT run command
156+ if python3 ./site_fullrun.py \
157+ --site ${site_code} --sitegroup ${site_group} --caseidprefix ${case_prefix} \
158+ ${sim_years} --tstep ${timestep} --machine docker \
159+ --compiler gnu --mpilib mpi-serial \
160+ --cpl_bypass --gswp3 \
161+ --model_root /E3SM \
162+ --caseroot /output \
163+ --ccsm_input /inputdata \
164+ --runroot /output \
165+ --spinup_vars \
166+ --parm_list ${param_list} \
167+ --mc_ensemble ${num_ens} \
168+ --ng ${num_groups} \
169+ --nopointdata \
170+ --metdir /inputdata/atm/datm7/atm_forcing.datm7.GSWP3.0.5d.v2.c180716_NGEE-Grid/cpl_bypass_${site_name} -Grid \
171+ --domainfile /inputdata/share/domains/domain.clm/domain.lnd.1x1pt_${site_name} -GRID_navy.nc \
172+ --surffile /inputdata/lnd/clm2/surfdata_map/surfdata_1x1pt_${site_name} -GRID_simyr1850_c360x720_c171002.nc \
173+ --landusefile /inputdata/lnd/clm2/surfdata_map/landuse.timeseries_1x1pt_${site_name} -GRID_simyr1850-2015_c180423.nc \
174+ & sleep 10
175+
176+ then
177+ wait
178+
179+ echo " DONE docker ELM runs !"
180+
181+ else
182+ exit & ?
183+ fi
184+
185+ cd ${cwd}
186+ sleep 2
187+
188+ # ### Postprocess
189+ # Copy the example parameter file to the OLMT ensemble output folder
190+ cp ${param_list} /output/cime_run_dirs/UQ/${case_prefix} _${site_code} _ICB20TRCNPRDCTCBC/.
191+ # ## Collapse transient simulation output into a single netCDF file
192+ echo " "
193+ echo " "
194+ echo " "
195+ echo " **** Postprocessing ELM output in:"
196+ echo " /output/cime_run_dirs/UQ/${case_prefix} _${site_code} _ICB20TRCNPRDCTCBC/"
197+ echo " "
198+ echo " "
199+ cd /output/cime_run_dirs/UQ/${case_prefix} _${site_code} _ICB20TRCNPRDCTCBC/
200+ echo " "
201+ echo " **** Concatenating netCDF output - Hang tight this will take awhile ****"
202+ echo ${PWD}
203+ for d in * / ; do
204+ echo " Post-processing: $d "
205+ cd /output/cime_run_dirs/UQ/${case_prefix} _${site_code} _ICB20TRCNPRDCTCBC/${d}
206+ ncrcat --ovr * .h0.* .nc ELM_output.nc
207+ chmod 777 ELM_output.nc
208+ echo " "
209+ done
210+ echo " "
211+ echo " "
212+ echo " **** Concatenating netCDF output: DONE ****"
213+ echo " **** OLMT Ensemble Simulation at ${site_name} : DONE ****"
214+ echo " "
215+ echo " "
216+ echo " "
217+ sleep 2
218+ # =======================================================================================
0 commit comments