Skip to content

Commit e3eba33

Browse files
committed
Merge tag 'cmeps0.14.60' into add_MARBL
cmeps0.14.60
2 parents efbfd44 + 3b1e50b commit e3eba33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2555
-1487
lines changed

.github/workflows/extbuild.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
CPPFLAGS: "-I/usr/include -I/usr/local/include"
2121

2222
# Versions of all dependencies can be updated here
23-
ESMF_VERSION: v8.4.2
23+
ESMF_VERSION: v8.6.0
2424
PNETCDF_VERSION: checkpoint.1.12.3
25-
NETCDF_FORTRAN_VERSION: v4.6.0
26-
PIO_VERSION: pio2_6_0
27-
CDEPS_VERSION: cdeps1.0.15
25+
NETCDF_FORTRAN_VERSION: v4.6.1
26+
PIO_VERSION: pio2_6_2
27+
CDEPS_VERSION: cdeps1.0.26
2828
steps:
2929
- uses: actions/checkout@v3
3030
# Build the ESMF library, if the cache contains a previous build
@@ -84,7 +84,7 @@ jobs:
8484
ref: ${{ env.CDEPS_VERSION }}
8585
- name: Build CDEPS
8686
if: steps.cache-cdeps.outputs.cache-hit != 'true'
87-
uses: ESCOMP/CDEPS/.github/actions/[email protected].15
87+
uses: ESCOMP/CDEPS/.github/actions/[email protected].26
8888
with:
8989
esmfmkfile: $HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk
9090
pio_path: $HOME/pio
@@ -102,6 +102,6 @@ jobs:
102102
make VERBOSE=1
103103
popd
104104
105-
- name: Setup tmate session
106-
if: ${{ failure() }}
107-
uses: mxschmitt/action-tmate@v3
105+
# - name: Setup tmate session
106+
# if: ${{ failure() }}
107+
# uses: mxschmitt/action-tmate@v3

.github/workflows/srt.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
CPPFLAGS: "-I/usr/include -I/usr/local/include "
2727
LDFLAGS: "-L/usr/lib/x86_64-linux-gnu -lnetcdf -lnetcdff -lpnetcdf"
2828
# Versions of all dependencies can be updated here
29-
ESMF_VERSION: v8.5.0
30-
PARALLELIO_VERSION: pio2_6_0
29+
ESMF_VERSION: v8.6.0
30+
PARALLELIO_VERSION: pio2_6_2
3131
CIME_MODEL: cesm
3232
CIME_DRIVER: nuopc
3333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -79,7 +79,21 @@ jobs:
7979
- name: checkout externals
8080
run: |
8181
pushd cesm
82-
./manage_externals/checkout_externals ccs_config cdeps cime share mct cpl7 parallelio
82+
./manage_externals/checkout_externals ccs_config cdeps share mct cpl7 parallelio
83+
cd ccs_config
84+
git checkout main
85+
cd ../
86+
git clone https://github.com/ESMCI/cime
87+
cd cime
88+
if [[ ! -e "${PWD}/.gitmodules.bak" ]]
89+
then
90+
echo "Converting [email protected] to https://github.com urls in ${PWD}/.gitmodules"
91+
92+
sed -i".bak" "s/[email protected]:/https:\/\/github.com\//g" "${PWD}/.gitmodules"
93+
fi
94+
git submodule update --init
95+
cd ../components/cdeps
96+
git checkout main
8397
8498
- name: Cache ESMF
8599
id: cache-esmf

cesm/driver/ensemble_driver.F90

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ subroutine SetModelServices(ensemble_driver, rc)
145145
integer :: pio_asyncio_stride
146146
integer :: pio_asyncio_rootpe
147147
integer :: Global_Comm
148-
character(len=CL) :: start_type ! Type of startup
148+
character(len=CL) :: start_type ! Type of startup
149149
character(len=7) :: drvrinst
150150
character(len=5) :: inst_suffix
151151
character(len=CX) :: msgstr
@@ -377,10 +377,8 @@ subroutine SetModelServices(ensemble_driver, rc)
377377
endif
378378
call shr_log_setLogUnit (logunit)
379379
! Create a clock for each driver instance
380-
381380
call esm_time_clockInit(ensemble_driver, driver, logunit, localpet==petList(1), rc)
382381
if (chkerr(rc,__LINE__,u_FILE_u)) return
383-
384382
enddo
385383
inst = localPet/(ntasks_per_member+pio_asyncio_ntasks) + 1
386384

cesm/driver/esm.F90

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,13 +1224,17 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
12241224
real (r8), allocatable :: lats(:) ! temporary
12251225
real (r8), allocatable :: lons(:) ! temporary
12261226
real (r8), allocatable :: pos_lons(:) ! temporary
1227+
real (r8), allocatable :: pos_lats(:) ! temporary
1228+
real (r8), allocatable :: cols(:) ! temporary
12271229
real (r8), allocatable :: glob_grid(:,:) ! temporary
12281230
real (r8) :: pos_scol_lon ! temporary
1231+
real (r8) :: pos_scol_lat ! temporary
12291232
real (r8) :: scol_data(1)
12301233
integer :: iscol_data(1)
12311234
integer :: petcount
12321235
character(len=CL) :: cvalue
12331236
character(len=*), parameter :: subname= ' (esm_get_single_column_attributes) '
1237+
logical :: unstructured = .false.
12341238
!-------------------------------------------------------------------------------
12351239

12361240
rc = ESMF_SUCCESS
@@ -1324,7 +1328,15 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
13241328
if (status /= nf90_noerr) call shr_sys_abort (subname//' inq_varid frac')
13251329

13261330
! Read in domain file for single column
1327-
allocate(lats(nj))
1331+
! Check for unstructured data ni>1 and nj==1
1332+
if (ni.gt.1 .and. nj == 1) unstructured=.true.
1333+
1334+
if (unstructured) then
1335+
allocate(lats(ni))
1336+
allocate(pos_lats(ni))
1337+
else
1338+
allocate(lats(nj))
1339+
end if
13281340
allocate(lons(ni))
13291341
allocate(pos_lons(ni))
13301342
allocate(glob_grid(ni,nj))
@@ -1334,28 +1346,37 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
13341346
count3=(/ni,nj,1/)
13351347
status = nf90_get_var(ncid, varid_xc, glob_grid, start3, count3)
13361348
if (status /= nf90_noerr) call shr_sys_abort (subname//' get_var xc')
1337-
do i = 1,ni
1338-
lons(i) = glob_grid(i,1)
1339-
end do
1349+
lons(1:ni) = glob_grid(1:ni,1)
13401350
status = nf90_get_var(ncid, varid_yc, glob_grid, start3, count3)
13411351
if (status /= nf90_noerr) call shr_sys_abort (subname//' get_var yc')
1342-
do j = 1,nj
1343-
lats(j) = glob_grid(1,j)
1344-
end do
1345-
1352+
if (unstructured) then
1353+
lats(1:ni) = glob_grid(1:ni,1)
1354+
else
1355+
lats(1:nj) = glob_grid(1,1:nj)
1356+
end if
13461357
! find nearest neighbor indices of scol_lon and scol_lat in single_column_lnd_domain file
13471358
! convert lons array and scol_lon to 0,360 and find index of value closest to 0
13481359
! and obtain single-column longitude/latitude indices to retrieve
1349-
pos_lons(:) = mod(lons(:) + 360._r8, 360._r8)
1350-
pos_scol_lon = mod(scol_lon + 360._r8, 360._r8)
1351-
start(1) = (MINLOC(abs(pos_lons - pos_scol_lon), dim=1))
1352-
start(2) = (MINLOC(abs(lats -scol_lat ), dim=1))
1353-
1360+
if (unstructured) then
1361+
allocate(cols(ni))
1362+
pos_lons(:) = mod(lons(:) + 360._r8, 360._r8)
1363+
pos_scol_lon = mod(scol_lon + 360._r8, 360._r8)
1364+
pos_lats(:) = lats(:) + 90._r8
1365+
pos_scol_lat = scol_lat + 90._r8
1366+
cols=abs(pos_lons - pos_scol_lon)+abs(pos_lats - pos_scol_lat)
1367+
start(1) = MINLOC(cols, dim=1)
1368+
start(2) = 1
1369+
deallocate(cols)
1370+
else
1371+
pos_lons(:) = mod(lons(:) + 360._r8, 360._r8)
1372+
pos_scol_lon = mod(scol_lon + 360._r8, 360._r8)
1373+
start(1) = (MINLOC(abs(pos_lons - pos_scol_lon), dim=1))
1374+
start(2) = (MINLOC(abs(lats -scol_lat ), dim=1))
1375+
end if
13541376
deallocate(lats)
13551377
deallocate(lons)
13561378
deallocate(pos_lons)
13571379
deallocate(glob_grid)
1358-
13591380
! read in value of nearest neighbor lon and RESET scol_lon and scol_lat
13601381
! also get area of gridcell, mask and frac
13611382
status = nf90_get_var(ncid, varid_xc, scol_lon, start)
@@ -1517,6 +1538,7 @@ subroutine esm_finalize(driver, rc)
15171538

15181539
call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO)
15191540
rc = ESMF_SUCCESS
1541+
15201542
call shr_log_setLogunit(logunit)
15211543
call ESMF_GridCompGet(driver, vm=vm, rc=rc)
15221544
if (chkerr(rc,__LINE__,u_FILE_u)) return

cesm/driver/esm_time_mod.F90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ subroutine esm_time_clockInit(ensemble_driver, instance_driver, logunit, maintas
282282
call ESMF_TimeSet( RefTime, yy=yr, mm=mon, dd=day, s=ref_tod, rc=rc)
283283
if (ChkErr(rc,__LINE__,u_FILE_u)) return
284284

285-
286285
call ESMF_TimeIntervalSet( TimeStep, s=dtime_drv, rc=rc )
287286
if (ChkErr(rc,__LINE__,u_FILE_u)) return
288287

cesm/flux_atmocn/shr_flux_mod.F90

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,19 @@ end subroutine shr_flux_adjust_constants
133133
! Thomas Toniazzo (Bjerknes Centre, Bergen) ”
134134
!===============================================================================
135135
SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
136-
& qbot ,s16O ,sHDO ,s18O ,rbot, &
136+
& qbot, rainc ,s16O ,sHDO ,s18O ,rbot, &
137137
& tbot ,us ,vs, pslv, &
138138
& ts ,mask , seq_flux_atmocn_minwind, &
139139
& sen ,lat ,lwup , &
140140
& r16O, rhdo, r18O, &
141141
& evap ,evap_16O, evap_HDO, evap_18O, &
142142
& taux ,tauy ,tref ,qref , &
143143
& ocn_surface_flux_scheme, &
144-
& duu10n, ustar_sv ,re_sv ,ssq_sv, &
144+
& add_gusts, &
145+
& duu10n, &
146+
& ugust_out, &
147+
& u10res, &
148+
& ustar_sv ,re_sv ,ssq_sv, &
145149
& missval)
146150

147151
! !USES:
@@ -156,11 +160,13 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
156160
integer(IN),intent(in) :: nMax ! data vector length
157161
integer(IN),intent(in) :: mask (nMax) ! ocn domain mask 0 <=> out of domain
158162
integer(IN),intent(in) :: ocn_surface_flux_scheme
163+
logical ,intent(in) :: add_gusts
159164
real(R8) ,intent(in) :: zbot (nMax) ! atm level height (m)
160165
real(R8) ,intent(in) :: ubot (nMax) ! atm u wind (m/s)
161166
real(R8) ,intent(in) :: vbot (nMax) ! atm v wind (m/s)
162167
real(R8) ,intent(in) :: thbot(nMax) ! atm potential T (K)
163168
real(R8) ,intent(in) :: qbot (nMax) ! atm specific humidity (kg/kg)
169+
real(R8) ,intent(in) :: rainc(nMax) ! atm precip for convective gustiness (kg/m^3) - RBN 24Nov2008/MDF 31Jan2022
164170
real(R8) ,intent(in) :: s16O (nMax) ! atm H216O tracer conc. (kg/kg)
165171
real(R8) ,intent(in) :: sHDO (nMax) ! atm HDO tracer conc. (kg/kg)
166172
real(R8) ,intent(in) :: s18O (nMax) ! atm H218O tracer conc. (kg/kg)
@@ -188,6 +194,8 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
188194
real(R8),intent(out) :: tref (nMax) ! diag: 2m ref height T (K)
189195
real(R8),intent(out) :: qref (nMax) ! diag: 2m ref humidity (kg/kg)
190196
real(R8),intent(out) :: duu10n(nMax) ! diag: 10m wind speed squared (m/s)^2
197+
real(R8),intent(out) :: ugust_out(nMax) ! diag: gustiness addition to U10 (m/s)
198+
real(R8),intent(out) :: u10res(nMax) ! diag: gustiness addition to U10 (m/s)
191199

192200
real(R8),intent(out),optional :: ustar_sv(nMax) ! diag: ustar
193201
real(R8),intent(out),optional :: re_sv (nMax) ! diag: sqrt of exchange coefficient (water)
@@ -237,6 +245,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
237245
real(R8) :: cp ! specific heat of moist air
238246
real(R8) :: fac ! vertical interpolation factor
239247
real(R8) :: spval ! local missing value
248+
real(R8) :: wind0 ! resolved large-scale 10m wind (no gust added)
240249
!!++ COARE only
241250
real(R8) :: zo,zot,zoq ! roughness lengths
242251
real(R8) :: hsb,hlb ! sens & lat heat flxs at zbot
@@ -257,14 +266,16 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
257266
real(R8) :: tdiff(nMax) ! tbot - ts
258267
real(R8) :: vscl
259268

269+
real(R8) :: ugust ! function: gustiness as a function of convective rainfall.
270+
real(R8) :: gprec ! convective rainfall argument for ugust
260271

261272
qsat(Tk) = 640380.0_R8 / exp(5107.4_R8/Tk)
262273

263274
! Large and Yeager 2009
264275
cdn(Umps) = 0.0027_R8 / min(33.0000_R8,Umps) + 0.000142_R8 + &
265276
0.0000764_R8 * min(33.0000_R8,Umps) - 3.14807e-13_r8 * min(33.0000_R8,Umps)**6
266277
! Capped Large and Pond by wind
267-
! cdn(Umps) = 0.0027_R8 / min(30.0_R8,Umps) + 0.000142_R8 + 0.0000764_R8 * min(30.0_R8,Umps)
278+
! cdn(Umps) = 0.0027_R8 / min(30.0_R8,Umps) + 0.000142_R8 + 0.0000764_R8 * min(30.0_R8,Umps)
268279
! Capped Large and Pond by Cd
269280
! cdn(Umps) = min(0.0025_R8, (0.0027_R8 / Umps + 0.000142_R8 + 0.0000764_R8 * Umps ))
270281
! Large and Pond
@@ -273,6 +284,13 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
273284
psimhu(xd) = log((1.0_R8+xd*(2.0_R8+xd))*(1.0_R8+xd*xd)/8.0_R8) - 2.0_R8*atan(xd) + 1.571_R8
274285
psixhu(xd) = 2.0_R8 * log((1.0_R8 + xd*xd)/2.0_R8)
275286

287+
! Convective gustiness appropriate for input precipitation.
288+
! Following Regelsperger et al. (2000, J. Clim)
289+
! Ug = log(1.0+6.69R-0.476R^2)
290+
! Coefficients X by 8640 for mm/s (from cam) -> cm/day (for above forumla)
291+
ugust(gprec) = log(1._R8+57801.6_r8*gprec-3.55332096e7_r8*(gprec**2))
292+
293+
276294
!--- formats ----------------------------------------
277295
character(*),parameter :: subName = '(flux_atmOcn) '
278296
character(*),parameter :: F00 = "('(flux_atmOcn) ',4a)"
@@ -327,17 +345,29 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
327345
if (mask(n) /= 0) then
328346

329347
!--- compute some needed quantities ---
330-
vmag = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) )
348+
if (add_gusts) then
349+
vmag = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2 + (1.0_R8*ugust(min(rainc(n),6.94444e-4_r8))**2)) )
350+
ugust_out(n) = ugust(min(rainc(n),6.94444e-4_r8))
351+
else
352+
vmag = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) )
353+
ugust_out(n) = 0.0_r8
354+
end if
355+
wind0 = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) )
356+
331357
if (use_coldair_outbreak_mod) then
332358
! Cold Air Outbreak Modification:
333359
! Increase windspeed for negative tbot-ts
334360
! based on Mahrt & Sun 1995,MWR
335361

336362
if (tdiff(n).lt.td0) then
363+
! if add_gusts wind0 and vmag are different, both need this factor.
337364
vscl=min((1._R8+alpha*(abs(tdiff(n)-td0)**0.5_R8/abs(vmag))),maxscl)
338365
vmag=vmag*vscl
366+
vscl=min((1._R8+alpha*(abs(tdiff(n)-td0)**0.5_R8/abs(wind0))),maxscl)
367+
wind0=wind0*vscl
339368
endif
340369
endif
370+
341371
ssq = 0.98_R8 * qsat(ts(n)) / rbot(n) ! sea surf hum (kg/kg)
342372
delt = thbot(n) - ts(n) ! pot temp diff (K)
343373
delq = qbot(n) - ssq ! spec hum dif (kg/kg)
@@ -438,6 +468,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
438468
qref(n) = qbot(n) - delq*fac
439469

440470
duu10n(n) = u10n*u10n ! 10m wind speed squared
471+
u10res(n) = u10n * (wind0/vmag) ! resolved 10m wind
441472

442473
!------------------------------------------------------------
443474
! optional diagnostics, needed for water tracer fluxes (dcn)
@@ -450,6 +481,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
450481
!------------------------------------------------------------
451482
! no valid data here -- out of domain
452483
!------------------------------------------------------------
484+
453485
sen (n) = spval ! sensible heat flux (W/m^2)
454486
lat (n) = spval ! latent heat flux (W/m^2)
455487
lwup (n) = spval ! long-wave upward heat flux (W/m^2)
@@ -462,6 +494,8 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
462494
tref (n) = spval ! 2m reference height temperature (K)
463495
qref (n) = spval ! 2m reference height humidity (kg/kg)
464496
duu10n(n) = spval ! 10m wind speed squared (m/s)^2
497+
ugust_out(n) = spval ! gustiness addition (m/s)
498+
u10res(n) = spval ! 10m resolved wind (no gusts) (m/s)
465499

466500
if (present(ustar_sv)) ustar_sv(n) = spval
467501
if (present(re_sv )) re_sv (n) = spval

cime_config/buildexe

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ def _main_func():
108108
# always relink
109109
if os.path.isfile(exename):
110110
os.remove(exename)
111-
111+
exename = os.path.relpath(exename, bld_root)
112112
cmd = "{} exec_se -j {} EXEC_SE={} COMP_NAME=driver {} -f {} "\
113113
.format(gmake, gmake_j, exename, gmake_args, makefile)
114-
114+
pio = os.environ.get("PIO")
115+
if pio:
116+
os.environ["PIO_LIBDIR"] = os.path.join(pio,"lib")
115117

116118
rc, out, err = run_cmd(cmd,from_dir=bld_root)
117119
expect(rc==0,"Command {} failed rc={}\nout={}\nerr={}".format(cmd,rc,out,err))

cime_config/buildnml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ from CIME.case import Case
1515
from CIME.nmlgen import NamelistGenerator
1616
from CIME.utils import expect
1717
from CIME.utils import get_model, get_time_in_seconds, get_timestamp
18+
from CIME.namelist import literal_to_python_value
1819
from CIME.buildnml import create_namelist_infile, parse_input
1920
from CIME.XML.files import Files
2021

@@ -105,7 +106,8 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
105106
config["COMP_OCN"] = case.get_value("COMP_OCN")
106107
config["COMP_ROF"] = case.get_value("COMP_ROF")
107108
config["COMP_WAV"] = case.get_value("COMP_WAV")
108-
109+
config["CAMDEV"] = "True" if "CAM%DEV" in case.get_value("COMPSET") else "False"
110+
109111
if (
110112
(
111113
case.get_value("COMP_ROF") == "mosart"
@@ -144,6 +146,11 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
144146
if config["COMP_OCN"] == "docn" and "aqua" in case.get_value("DOCN_MODE"):
145147
nmlgen.set_value("aqua_planet", value=".true.")
146148

149+
# make sure that variable add_gusts is only set to true if compset includes cam_dev
150+
add_gusts = literal_to_python_value(nmlgen.get_value("add_gusts"), type_="logical")
151+
if add_gusts:
152+
expect("CAM%DEV" in case.get_value("COMPSET"),"ERROR: add_gusts can only be set if CAM%DEV in compset {}".format(case.get_value("COMPSET")))
153+
147154
# --------------------------------
148155
# Overwrite: set component coupling frequencies
149156
# --------------------------------
@@ -658,6 +665,7 @@ def buildnml(case, caseroot, component):
658665
create_namelist_infile(case, user_nl_file, namelist_infile, infile_text)
659666
infile = [namelist_infile]
660667

668+
661669
# create the files nuopc.runconfig, nuopc.runseq, drv_in and drv_flds_in
662670
_create_drv_namelists(case, infile, confdir, nmlgen, files)
663671

0 commit comments

Comments
 (0)