forked from NOAA-EMC/global-workflow
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathparsing_ufs_configure.sh
executable file
·107 lines (82 loc) · 3.14 KB
/
parsing_ufs_configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#! /usr/bin/env bash
#####
## This script writes ufs.configure file based on a template defined in
## ${ufs_configure_template}
#####
# Disable variable not used warnings
# shellcheck disable=SC2034
UFS_configure() {
echo "SUB ${FUNCNAME[0]}: ufs.configure begins"
# Setup ufs.configure
local esmf_logkind=${esmf_logkind:-"ESMF_LOGKIND_MULTI"} #options: ESMF_LOGKIND_MULTI_ON_ERROR, ESMF_LOGKIND_MULTI, ESMF_LOGKIND_NONE
local DumpFields=${DumpFields:-false}
local cap_dbug_flag=${cap_dbug_flag:-0}
# Determine "cmeps_run_type" based on the availability of the mediator restart file
# If it is a warm_start, we already copied the mediator restart to DATA, if it was present
# If the mediator restart was not present, despite being a "warm_start", we put out a WARNING
# in forecast_postdet.sh function CMEPS_postdet
if [[ -f "${DATA}/ufs.cpld.cpl.r.nc" ]]; then
local cmeps_run_type='continue'
else
local cmeps_run_type='startup'
fi
# Atm-related
local atm_model="fv3"
local atm_petlist_bounds="0 $(( ATMPETS-1 ))"
local atm_omp_num_threads="${ATMTHREADS}"
local med_model="cmeps"
local med_petlist_bounds="0 $(( MEDPETS-1 ))"
local med_omp_num_threads="${MEDTHREADS}"
if [[ "${cpl}" = ".true." ]]; then
local coupling_interval_slow_sec="${CPL_SLOW}"
fi
local WRITE_ENDOFRUN_RESTART=.false.
if [[ "${cplflx}" = ".true." ]]; then
local use_coldstart=${use_coldstart:-".false."}
local use_mommesh=${USE_MOMMESH:-"true"}
local ocn_model="mom6"
local ocn_petlist_bounds="${ATMPETS} $(( ATMPETS+OCNPETS-1 ))"
local ocn_omp_num_threads="${OCNTHREADS}"
local RUNTYPE="${cmeps_run_type}"
local CMEPS_RESTART_DIR="CMEPS_RESTART/"
local CPLMODE="${cplmode}"
local coupling_interval_fast_sec="${CPL_FAST}"
local RESTART_N="${restart_interval}"
local ocean_albedo_limit=0.06
local ATMTILESIZE="${CASE:1}"
local ocean_albedo_limit=0.06
local pio_rearranger=${pio_rearranger:-"box"}
fi
if [[ "${cplice}" = ".true." ]]; then
local ice_model="cice6"
local ice_petlist_bounds="$(( ATMPETS+OCNPETS )) $(( ATMPETS+OCNPETS+ICEPETS-1 ))"
local ice_omp_num_threads="${ICETHREADS}"
local FHMAX="${FHMAX_GFS}" # TODO: How did this get in here hard-wired to FHMAX_GFS?
fi
if [[ "${cplwav}" = ".true." ]]; then
local wav_model="ww3"
local wav_petlist_bounds="$(( ATMPETS+OCNPETS+ICEPETS )) $(( ATMPETS+OCNPETS+ICEPETS+WAVPETS-1 ))"
local wav_omp_num_threads="${WAVTHREADS}"
local MULTIGRID="${waveMULTIGRID}"
local WW3_user_sets_restname="false"
fi
if [[ "${cplchm}" = ".true." ]]; then
local chm_model="gocart"
local chm_petlist_bounds="0 $(( CHMPETS-1 ))"
local chm_omp_num_threads="${CHMTHREADS}"
local coupling_interval_sec="${CPL_FAST}"
fi
# Ensure the template exists
if [[ ! -r "${ufs_configure_template}" ]]; then
echo "FATAL ERROR: template '${ufs_configure_template}' does not exist, ABORT!"
exit 1
else
echo "INFO: using ufs.configure template: '${ufs_configure_template}'"
fi
rm -f "${DATA}/ufs.configure"
atparse < "${ufs_configure_template}" >> "${DATA}/ufs.configure"
echo "Rendered ufs.configure:"
cat ufs.configure
${NCP} "${HOMEgfs}/sorc/ufs_model.fd/tests/parm/fd_ufs.yaml" fd_ufs.yaml
echo "SUB ${FUNCNAME[0]}: ufs.configure ends"
}