Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 80 additions & 1 deletion doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,84 @@
===============================================================

Tag name: cam6_3_008
Originator(s): patcal, jedwards, goldy
Date: 2020-01-10
One-line Summary: Fixes for PIO2 plus nudging I/O update
Github PR URL: https://github.com/ESCOMP/CAM/pull/310

Purpose of changes (include the issue number and title text for each
relevant GitHub issue):
#237: Replace deprecated physics grid interfaces in nudging input
#248: scam tests don't work with pio2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are no keywords in the main PR message for Issue #263. I assume there should be?

Also, Issue #237 isn't listed here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the #263 issue, that issue was not important for PIO1 usage and has been properly addressed as part of the PIO2 fixes. I added a line in the PR description.

Thanks for noticing the missing #237 line.

#263: attempt to initialize variable prior to calling intent(out) subroutine
#282: ambiguous dof when writing FV zonal mean values

Describe any changes made to build system: NA

Describe any changes made to the namelist: NA

List any changes to the defaults for the boundary datasets: NA

Describe any substantial timing or memory changes: NA

Code reviewed by: cacraig, fvitt, goldy, nusbaume

List all files eliminated: NA

List all files added and what they do: NA

List all existing files that have been modified, and describe the changes:

doc/ChangeLog
- This is what has become of my aspiring rap career
src/chemistry/mozart/mo_drydep.F90
- Pass file_desc_t instead of file handle
src/control/cam_history.F90
- Add fill value info required by PIO2
- Explicitly handle conversion to 4-byte reals (req. by PIO2)
src/control/cam_restart.F90
- Call cam_pio_set_fill for the restart file
src/control/ncdio_atm.F90
- Return the fill value as an optional output
- Pass file_desc_t instead of file handle
src/dynamics/fv/dyn_grid.F90
- Make sure that zonal mean grid has no duplicate points
src/dynamics/se/dyn_comp.F90
- Detect fillvalue in input fields for reset to zero
src/physics/cam/nudging.F90
- Use infld instead of raw NetCDF for data input
- Code cleanup
src/utils/cam_pio_utils.F90
- Added interfaces for cam_pio_inq_var_fill and cam_pio_set_fill
These interfaces encapsulate PIO1 / PIO2 fill functionality

If there were any failures reported from running test_driver.sh on any test
platform, and checkin with these failures has been OK'd by the gatekeeper,
then copy the lines from the td.*.status files for the failed tests to the
appropriate machine below. All failed tests must be justified.

cheyenne/intel/aux_cam:

FAIL ERP_Ln9.ne30_ne30_mg17.FCnudged.cheyenne_intel.cam-outfrq9s BASELINE /glade/p/cesm/amwg/cesm_baselines/cam6_3_007: ERROR BFAIL some baseline files were missing
- This is an expected fail because this test failed to run in cam6_3_007
(fix is part of this PR). The baseline was verified by running this test
standalone with a compare to cam6_3_006.

izumi/nag/aux_cam:

FAIL DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae COMPARE_base_da
- Known (pre-existing) failure

izumi/pgi/aux_cam: ALL PASS

CAM tag used for the baseline comparison tests if different than previous
tag: NA

Summarize any changes to answers): BFB

===============================================================
===============================================================

Tag name: cam6_3_007
Originator(s): goldy
Date: 2020-12-06
Expand Down Expand Up @@ -208,7 +287,7 @@ This error should be fixed with PR #241

izumi/nag/aux_cam:
FAIL DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae COMPARE_base_da
Known (pre-existing) failure
- Known (pre-existing) failure
FAIL DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae NLCOMP
FAIL ERC_D_Ln9.f10_f10_mg37.FHS94.izumi_nag.cam-idphys NLCOMP
FAIL ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_carma NLCOMP
Expand Down
80 changes: 40 additions & 40 deletions src/chemistry/mozart/mo_drydep.F90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module mo_drydep

!---------------------------------------------------------------------
! ... Dry deposition
! ... Dry deposition
!---------------------------------------------------------------------

use shr_kind_mod, only : r8 => shr_kind_r8, shr_kind_cl
Expand Down Expand Up @@ -80,7 +80,7 @@ module mo_drydep
integer, parameter :: n_land_type = 11

integer, allocatable :: spc_ndx(:) ! nddvels
real(r8), public :: crb
real(r8), public :: crb

type lnd_dvel_type
real(r8), pointer :: dvel(:,:) ! deposition velocity over land (cm/s)
Expand All @@ -93,7 +93,7 @@ module mo_drydep

!---------------------------------------------------------------------------
!---------------------------------------------------------------------------
subroutine dvel_inti_fromlnd
subroutine dvel_inti_fromlnd
use mo_chem_utls, only : get_spc_ndx
use cam_abortutils, only : endrun

Expand All @@ -120,10 +120,10 @@ subroutine dvel_inti_fromlnd
!-------------------------------------------------------------------------------------
subroutine drydep_update( state, cam_in )
use physics_types, only : physics_state
use camsrfexch, only : cam_in_t
use camsrfexch, only : cam_in_t

type(physics_state), intent(in) :: state ! Physics state variables
type(cam_in_t), intent(in) :: cam_in
type(cam_in_t), intent(in) :: cam_in

if (nddvels<1) return

Expand All @@ -137,15 +137,15 @@ subroutine drydep_fromlnd( ocnfrac, icefrac, sfc_temp, pressure_sfc, &
wind_speed, spec_hum, air_temp, pressure_10m, rain, &
snow, solar_flux, dvelocity, dflx, mmr, &
tv, ncol, lchnk )

!-------------------------------------------------------------------------------------
! combines the deposition velocities provided by the land model with deposition
! velocities over ocean and sea ice
! combines the deposition velocities provided by the land model with deposition
! velocities over ocean and sea ice
!-------------------------------------------------------------------------------------

use ppgrid, only : pcols
use chem_mods, only : gas_pcnst

#if (defined OFFLINE_DYN)
use metdata, only: get_met_fields
#endif
Expand All @@ -154,8 +154,8 @@ subroutine drydep_fromlnd( ocnfrac, icefrac, sfc_temp, pressure_sfc, &
! ... dummy arguments
!-------------------------------------------------------------------------------------

real(r8), intent(in) :: icefrac(pcols)
real(r8), intent(in) :: ocnfrac(pcols)
real(r8), intent(in) :: icefrac(pcols)
real(r8), intent(in) :: ocnfrac(pcols)
integer, intent(in) :: ncol
integer, intent(in) :: lchnk ! chunk number
real(r8), intent(in) :: sfc_temp(pcols) ! surface temperature (K)
Expand All @@ -164,7 +164,7 @@ subroutine drydep_fromlnd( ocnfrac, icefrac, sfc_temp, pressure_sfc, &
real(r8), intent(in) :: spec_hum(pcols) ! specific humidity (kg/kg)
real(r8), intent(in) :: air_temp(pcols) ! surface air temperature (K)
real(r8), intent(in) :: pressure_10m(pcols) ! 10 meter pressure (Pa)
real(r8), intent(in) :: rain(pcols)
real(r8), intent(in) :: rain(pcols)
real(r8), intent(in) :: snow(pcols) ! snow height (m)
real(r8), intent(in) :: solar_flux(pcols) ! direct shortwave radiation at surface (W/m^2)
real(r8), intent(in) :: tv(pcols) ! potential temperature
Expand All @@ -180,17 +180,17 @@ subroutine drydep_fromlnd( ocnfrac, icefrac, sfc_temp, pressure_sfc, &

real(r8), dimension(ncol) :: term ! work array
integer :: ispec
real(r8) :: lndfrac(pcols)
real(r8) :: lndfrac(pcols)
#if (defined OFFLINE_DYN)
real(r8) :: met_ocnfrac(pcols)
real(r8) :: met_icefrac(pcols)
real(r8) :: met_icefrac(pcols)
#endif
integer :: i

lndfrac(:ncol) = 1._r8 - ocnfrac(:ncol) - icefrac(:ncol)

where( lndfrac(:ncol) < 0._r8 )
lndfrac(:ncol) = 0._r8
where( lndfrac(:ncol) < 0._r8 )
lndfrac(:ncol) = 0._r8
endwhere

#if (defined OFFLINE_DYN)
Expand All @@ -201,7 +201,7 @@ subroutine drydep_fromlnd( ocnfrac, icefrac, sfc_temp, pressure_sfc, &
! ... initialize
!-------------------------------------------------------------------------------------
dvelocity(:,:) = 0._r8

!-------------------------------------------------------------------------------------
! ... compute the dep velocities over ocean and sea ice
! land type 7 is used for ocean
Expand All @@ -226,7 +226,7 @@ subroutine drydep_fromlnd( ocnfrac, icefrac, sfc_temp, pressure_sfc, &
dvelocity(:ncol,spc_ndx(ispec)) = lnd(lchnk)%dvel(:ncol,ispec)*lndfrac(:ncol) &
+ ocnice_dvel(:ncol,spc_ndx(ispec))
enddo

!-------------------------------------------------------------------------------------
! ... special adjustments
!-------------------------------------------------------------------------------------
Expand All @@ -249,10 +249,10 @@ subroutine drydep_fromlnd( ocnfrac, icefrac, sfc_temp, pressure_sfc, &
dvelocity(:ncol,hcooh_ndx) = dvelocity(:ncol,ch3cooh_ndx)
end if
end if

!-------------------------------------------------------------------------------------
! ... assign CO tags to CO
! put this kludge in for now ...
! put this kludge in for now ...
! -- should be able to set all these via the table mapping in seq_drydep_mod
!-------------------------------------------------------------------------------------
if( cohc_ndx>0 .and. co_ndx>0 ) then
Expand Down Expand Up @@ -533,11 +533,11 @@ subroutine get_landuse_and_soilw_from_file()
use ncdio_atm, only : infld

logical :: readvar

type(file_desc_t) :: piofile
character(len=shr_kind_cl) :: locfn
logical :: lexist

call getfil (drydep_srf_file, locfn, 1, lexist)
if(lexist) then
call cam_pio_openfile(piofile, locfn, PIO_NOWRITE)
Expand Down Expand Up @@ -630,10 +630,10 @@ subroutine interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_ve
if (single_column) then
if (scm_cambfb_mode) then
piofile => initial_file_get_id()
call shr_scam_getCloseLatLon(piofile%fh,scmlat,scmlon,closelat,closelon,latidx,lonidx)
call shr_scam_getCloseLatLon(piofile,scmlat,scmlon,closelat,closelon,latidx,lonidx)
ploniop=size(loniop)
platiop=size(latiop)
else
else
latidx=1
lonidx=1
ploniop=1
Expand Down Expand Up @@ -697,7 +697,7 @@ subroutine interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_ve
write(iulog,*) 'interp_map : mapping_ext ',mapping_ext
#endif
do j = 1,plon+1
lon1 = lon_edge(j)
lon1 = lon_edge(j)
do i = -veg_ext,nlon_veg+veg_ext
dx = lon_veg_edge_ext(i ) - lon1
dy = lon_veg_edge_ext(i+1) - lon1
Expand Down Expand Up @@ -729,17 +729,17 @@ subroutine interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_ve
fraction = 0._r8
do jj = ind_lat(j),ind_lat(j+1)
y1 = max( lat_edge(j),lat_veg_edge(jj) )
y2 = min( lat_edge(j+1),lat_veg_edge(jj+1) )
y2 = min( lat_edge(j+1),lat_veg_edge(jj+1) )
dy = (y2 - y1)/(lat_veg_edge(jj+1) - lat_veg_edge(jj))
do ii =ind_lon(i),ind_lon(i+1)
i_ndx = mapping_ext(ii)
x1 = max( lon_edge(i),lon_veg_edge_ext(ii) )
x2 = min( lon_edge(i+1),lon_veg_edge_ext(ii+1) )
x2 = min( lon_edge(i+1),lon_veg_edge_ext(ii+1) )
dx = (x2 - x1)/(lon_veg_edge_ext(ii+1) - lon_veg_edge_ext(ii))
area = dx * dy
total_area = total_area + area
!-----------------------------------------------------------------
! ... special case for ocean grid point
! ... special case for ocean grid point
!-----------------------------------------------------------------
if( nint(landmask(i_ndx,jj)) == 0 ) then
fraction(npft_veg+1) = fraction(npft_veg+1) + area
Expand Down Expand Up @@ -790,7 +790,7 @@ subroutine interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_ve
tmp_frac_lu(i,11, j) = sum(fraction(10:12))
end do lon_loop
end do lat_loop

do lchnk = begchunk, endchunk
ncol = get_ncols_p(lchnk)
call get_rlat_all_p(lchnk, ncol, rlats(:ncol))
Expand Down Expand Up @@ -819,7 +819,7 @@ subroutine interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_ve
end do

end subroutine interp_map

!-------------------------------------------------------------------------------------
!-------------------------------------------------------------------------------------
subroutine drydep_xactive( sfc_temp, pressure_sfc, &
Expand Down Expand Up @@ -860,7 +860,7 @@ subroutine drydep_xactive( sfc_temp, pressure_sfc, &
real(r8), intent(in) :: spec_hum(pcols) ! specific humidity (kg/kg)
real(r8), intent(in) :: air_temp(pcols) ! surface air temperature (K)
real(r8), intent(in) :: pressure_10m(pcols) ! 10 meter pressure (Pa)
real(r8), intent(in) :: rain(pcols)
real(r8), intent(in) :: rain(pcols)
real(r8), intent(in) :: snow(pcols) ! snow height (m)

real(r8), intent(in) :: solar_flux(pcols) ! direct shortwave radiation at surface (W/m^2)
Expand All @@ -874,8 +874,8 @@ subroutine drydep_xactive( sfc_temp, pressure_sfc, &
integer, intent(in), optional :: beglandtype
integer, intent(in), optional :: endlandtype

real(r8), intent(in), optional :: ocnfrc(pcols)
real(r8), intent(in), optional :: icefrc(pcols)
real(r8), intent(in), optional :: ocnfrc(pcols)
real(r8), intent(in), optional :: icefrc(pcols)

!-------------------------------------------------------------------------------------
! ... local variables
Expand Down Expand Up @@ -952,7 +952,7 @@ subroutine drydep_xactive( sfc_temp, pressure_sfc, &
logical :: fr_lnduse(ncol,n_land_type) ! wrking array
real(r8) :: dewm ! multiplier for rs when dew occurs

real(r8) :: lcl_frc_landuse(ncol,n_land_type)
real(r8) :: lcl_frc_landuse(ncol,n_land_type)

integer :: beglt, endlt

Expand All @@ -966,16 +966,16 @@ subroutine drydep_xactive( sfc_temp, pressure_sfc, &
0.005_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.075_r8, 0.002_r8 /)

if (present( beglandtype)) then
beglt = beglandtype
beglt = beglandtype
else
beglt = 1
endif
if (present( endlandtype)) then
endlt = endlandtype
endlt = endlandtype
else
endlt = n_land_type
endif

!-------------------------------------------------------------------------------------
! initialize
!-------------------------------------------------------------------------------------
Expand All @@ -1001,7 +1001,7 @@ subroutine drydep_xactive( sfc_temp, pressure_sfc, &
!-------------------------------------------------------------------------------------
! season index only for ocn and sea ice
!-------------------------------------------------------------------------------------
index_season = 4
index_season = 4
!-------------------------------------------------------------------------------------
! special case for snow covered terrain
!-------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1141,7 +1141,7 @@ subroutine drydep_xactive( sfc_temp, pressure_sfc, &
!-------------------------------------------------------------------------------------
! revise calculation of friction velocity and z0 over water
!-------------------------------------------------------------------------------------
lt = 7
lt = 7
do i = 1,ncol
if( fr_lnduse(i,lt) ) then
if( unstable(i) ) then
Expand Down Expand Up @@ -1386,7 +1386,7 @@ subroutine drydep_xactive( sfc_temp, pressure_sfc, &
if( lt == 7 ) then
where( fr_lnduse(:ncol,lt) )
! assume no surface resistance for SO2 over water`
wrk(:) = wrk(:) + lnd_frc(:)/(dep_ra(:ncol,lt,lchnk) + dep_rb(:ncol,lt,lchnk))
wrk(:) = wrk(:) + lnd_frc(:)/(dep_ra(:ncol,lt,lchnk) + dep_rb(:ncol,lt,lchnk))
endwhere
else
where( fr_lnduse(:ncol,lt) )
Expand Down
Loading