Skip to content

Commit

Permalink
merge up to cmeps0.14.60
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Jun 4, 2024
2 parents c604c33 + 3b1e50b commit b63b37d
Show file tree
Hide file tree
Showing 24 changed files with 978 additions and 723 deletions.
49 changes: 35 additions & 14 deletions cesm/driver/esm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1224,13 +1224,17 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
real (r8), allocatable :: lats(:) ! temporary
real (r8), allocatable :: lons(:) ! temporary
real (r8), allocatable :: pos_lons(:) ! temporary
real (r8), allocatable :: pos_lats(:) ! temporary
real (r8), allocatable :: cols(:) ! temporary
real (r8), allocatable :: glob_grid(:,:) ! temporary
real (r8) :: pos_scol_lon ! temporary
real (r8) :: pos_scol_lat ! temporary
real (r8) :: scol_data(1)
integer :: iscol_data(1)
integer :: petcount
character(len=CL) :: cvalue
character(len=*), parameter :: subname= ' (esm_get_single_column_attributes) '
logical :: unstructured = .false.
!-------------------------------------------------------------------------------

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

! Read in domain file for single column
allocate(lats(nj))
! Check for unstructured data ni>1 and nj==1
if (ni.gt.1 .and. nj == 1) unstructured=.true.

if (unstructured) then
allocate(lats(ni))
allocate(pos_lats(ni))
else
allocate(lats(nj))
end if
allocate(lons(ni))
allocate(pos_lons(ni))
allocate(glob_grid(ni,nj))
Expand All @@ -1334,28 +1346,37 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
count3=(/ni,nj,1/)
status = nf90_get_var(ncid, varid_xc, glob_grid, start3, count3)
if (status /= nf90_noerr) call shr_sys_abort (subname//' get_var xc')
do i = 1,ni
lons(i) = glob_grid(i,1)
end do
lons(1:ni) = glob_grid(1:ni,1)
status = nf90_get_var(ncid, varid_yc, glob_grid, start3, count3)
if (status /= nf90_noerr) call shr_sys_abort (subname//' get_var yc')
do j = 1,nj
lats(j) = glob_grid(1,j)
end do

if (unstructured) then
lats(1:ni) = glob_grid(1:ni,1)
else
lats(1:nj) = glob_grid(1,1:nj)
end if
! find nearest neighbor indices of scol_lon and scol_lat in single_column_lnd_domain file
! convert lons array and scol_lon to 0,360 and find index of value closest to 0
! and obtain single-column longitude/latitude indices to retrieve
pos_lons(:) = mod(lons(:) + 360._r8, 360._r8)
pos_scol_lon = mod(scol_lon + 360._r8, 360._r8)
start(1) = (MINLOC(abs(pos_lons - pos_scol_lon), dim=1))
start(2) = (MINLOC(abs(lats -scol_lat ), dim=1))

if (unstructured) then
allocate(cols(ni))
pos_lons(:) = mod(lons(:) + 360._r8, 360._r8)
pos_scol_lon = mod(scol_lon + 360._r8, 360._r8)
pos_lats(:) = lats(:) + 90._r8
pos_scol_lat = scol_lat + 90._r8
cols=abs(pos_lons - pos_scol_lon)+abs(pos_lats - pos_scol_lat)
start(1) = MINLOC(cols, dim=1)
start(2) = 1
deallocate(cols)
else
pos_lons(:) = mod(lons(:) + 360._r8, 360._r8)
pos_scol_lon = mod(scol_lon + 360._r8, 360._r8)
start(1) = (MINLOC(abs(pos_lons - pos_scol_lon), dim=1))
start(2) = (MINLOC(abs(lats -scol_lat ), dim=1))
end if
deallocate(lats)
deallocate(lons)
deallocate(pos_lons)
deallocate(glob_grid)

! read in value of nearest neighbor lon and RESET scol_lon and scol_lat
! also get area of gridcell, mask and frac
status = nf90_get_var(ncid, varid_xc, scol_lon, start)
Expand Down
17 changes: 14 additions & 3 deletions cesm/flux_atmocn/shr_flux_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
& ocn_surface_flux_scheme, &
& add_gusts, &
& duu10n, &
& ugust_out, &
& ugust_out, &
& u10res, &
& ustar_sv ,re_sv ,ssq_sv, &
& missval)

Expand Down Expand Up @@ -194,6 +195,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
real(R8),intent(out) :: qref (nMax) ! diag: 2m ref humidity (kg/kg)
real(R8),intent(out) :: duu10n(nMax) ! diag: 10m wind speed squared (m/s)^2
real(R8),intent(out) :: ugust_out(nMax) ! diag: gustiness addition to U10 (m/s)
real(R8),intent(out) :: u10res(nMax) ! diag: gustiness addition to U10 (m/s)

real(R8),intent(out),optional :: ustar_sv(nMax) ! diag: ustar
real(R8),intent(out),optional :: re_sv (nMax) ! diag: sqrt of exchange coefficient (water)
Expand Down Expand Up @@ -243,6 +245,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
real(R8) :: cp ! specific heat of moist air
real(R8) :: fac ! vertical interpolation factor
real(R8) :: spval ! local missing value
real(R8) :: wind0 ! resolved large-scale 10m wind (no gust added)
!!++ COARE only
real(R8) :: zo,zot,zoq ! roughness lengths
real(R8) :: hsb,hlb ! sens & lat heat flxs at zbot
Expand Down Expand Up @@ -343,23 +346,28 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &

!--- compute some needed quantities ---
if (add_gusts) then
vmag = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) + ugust(min(rainc(n),6.94444e-4_r8)) )
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)) )
ugust_out(n) = ugust(min(rainc(n),6.94444e-4_r8))
else
vmag = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) )
ugust_out(n) = 0.0_r8
end if
wind0 = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) )

if (use_coldair_outbreak_mod) then
! Cold Air Outbreak Modification:
! Increase windspeed for negative tbot-ts
! based on Mahrt & Sun 1995,MWR

if (tdiff(n).lt.td0) then
! if add_gusts wind0 and vmag are different, both need this factor.
vscl=min((1._R8+alpha*(abs(tdiff(n)-td0)**0.5_R8/abs(vmag))),maxscl)
vmag=vmag*vscl
vscl=min((1._R8+alpha*(abs(tdiff(n)-td0)**0.5_R8/abs(wind0))),maxscl)
wind0=wind0*vscl
endif
endif

ssq = 0.98_R8 * qsat(ts(n)) / rbot(n) ! sea surf hum (kg/kg)
delt = thbot(n) - ts(n) ! pot temp diff (K)
delq = qbot(n) - ssq ! spec hum dif (kg/kg)
Expand Down Expand Up @@ -460,6 +468,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
qref(n) = qbot(n) - delq*fac

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

!------------------------------------------------------------
! optional diagnostics, needed for water tracer fluxes (dcn)
Expand All @@ -472,6 +481,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
!------------------------------------------------------------
! no valid data here -- out of domain
!------------------------------------------------------------

sen (n) = spval ! sensible heat flux (W/m^2)
lat (n) = spval ! latent heat flux (W/m^2)
lwup (n) = spval ! long-wave upward heat flux (W/m^2)
Expand All @@ -484,7 +494,8 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
tref (n) = spval ! 2m reference height temperature (K)
qref (n) = spval ! 2m reference height humidity (kg/kg)
duu10n(n) = spval ! 10m wind speed squared (m/s)^2
ugust_out(n) = spval ! gustiness addition (m/s)
ugust_out(n) = spval ! gustiness addition (m/s)
u10res(n) = spval ! 10m resolved wind (no gusts) (m/s)

if (present(ustar_sv)) ustar_sv(n) = spval
if (present(re_sv )) re_sv (n) = spval
Expand Down
6 changes: 4 additions & 2 deletions cime_config/buildexe
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ def _main_func():
# always relink
if os.path.isfile(exename):
os.remove(exename)

exename = os.path.relpath(exename, bld_root)
cmd = "{} exec_se -j {} EXEC_SE={} COMP_NAME=driver {} -f {} "\
.format(gmake, gmake_j, exename, gmake_args, makefile)

pio = os.environ.get("PIO")
if pio:
os.environ["PIO_LIBDIR"] = os.path.join(pio,"lib")

rc, out, err = run_cmd(cmd,from_dir=bld_root)
expect(rc==0,"Command {} failed rc={}\nout={}\nerr={}".format(cmd,rc,out,err))
Expand Down
2 changes: 2 additions & 0 deletions cime_config/config_component_cesm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@
<default_value>1</default_value>
<values match="last">
<value compset="_DLND.*_CISM\d">1</value>
<value compset="_DGLC">1</value>
<value compset="_SGLC">$ATM_NCPL</value>
<value compset="_XGLC">$ATM_NCPL</value>
<value compset="_MOM6">1</value>
Expand Down Expand Up @@ -537,6 +538,7 @@
<default_value>FALSE</default_value>
<values match="last">
<value compset="_CLM.+CISM\d">TRUE</value>
<value compset="_CLM.+DGLC%">TRUE</value>
<!-- Turn on two-way coupling for TG compsets - even though there are no
feedbacks for a TG compset, this will give us additional diagnostics -->
<value compset="_DLND.+CISM\d">TRUE</value>
Expand Down
Loading

0 comments on commit b63b37d

Please sign in to comment.