Skip to content

Commit

Permalink
Merge branch 'main' into mdfowler/gustMods_updateU10
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b authored Mar 26, 2024
2 parents e05cbff + 1825c2b commit a0dbcc3
Show file tree
Hide file tree
Showing 25 changed files with 1,518 additions and 667 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/srt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,22 @@ jobs:
- name: checkout externals
run: |
pushd cesm
./manage_externals/checkout_externals ccs_config cdeps cime share mct cpl7 parallelio
./manage_externals/checkout_externals ccs_config cdeps share mct cpl7 parallelio
cd ccs_config
git checkout main
cd ../cime
git checkout master
git checkout main
cd ../
git clone https://github.com/ESMCI/cime
cd cime
if [[ ! -e "${PWD}/.gitmodules.bak" ]]
then
echo "Convering [email protected] to https://github.com urls in ${PWD}/.gitmodules"
echo "Converting [email protected] to https://github.com urls in ${PWD}/.gitmodules"
sed -i".bak" "s/[email protected]:/https:\/\/github.com\//g" "${PWD}/.gitmodules"
fi
git submodule update --init
cd ../components/cdeps
git checkout main
- name: Cache ESMF
id: cache-esmf
uses: actions/cache@v3
Expand Down
4 changes: 1 addition & 3 deletions cesm/driver/ensemble_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ subroutine SetModelServices(ensemble_driver, rc)
integer :: pio_asyncio_stride
integer :: pio_asyncio_rootpe
integer :: Global_Comm
character(len=CL) :: start_type ! Type of startup
character(len=CL) :: start_type ! Type of startup
character(len=7) :: drvrinst
character(len=5) :: inst_suffix
character(len=CX) :: msgstr
Expand Down Expand Up @@ -377,10 +377,8 @@ subroutine SetModelServices(ensemble_driver, rc)
endif
call shr_log_setLogUnit (logunit)
! Create a clock for each driver instance

call esm_time_clockInit(ensemble_driver, driver, logunit, localpet==petList(1), rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

enddo
inst = localPet/(ntasks_per_member+pio_asyncio_ntasks) + 1

Expand Down
50 changes: 36 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 Expand Up @@ -1517,6 +1538,7 @@ subroutine esm_finalize(driver, rc)

call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO)
rc = ESMF_SUCCESS

call shr_log_setLogunit(logunit)
call ESMF_GridCompGet(driver, vm=vm, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
Expand Down
1 change: 0 additions & 1 deletion cesm/driver/esm_time_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ subroutine esm_time_clockInit(ensemble_driver, instance_driver, logunit, maintas
call ESMF_TimeSet( RefTime, yy=yr, mm=mon, dd=day, s=ref_tod, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return


call ESMF_TimeIntervalSet( TimeStep, s=dtime_drv, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down
Loading

0 comments on commit a0dbcc3

Please sign in to comment.