Skip to content

Commit

Permalink
units correction in diagnostics
Browse files Browse the repository at this point in the history
	modified:   src/cpl/nuopc/atm_import_export.F90
	modified:   src/cpl/nuopc/atm_stream_ndep.F90
	modified:   src/physics/cam/cam_diagnostics.F90
  • Loading branch information
fvitt committed Dec 26, 2024
1 parent bba4e59 commit 9066aee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
15 changes: 3 additions & 12 deletions src/cpl/nuopc/atm_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,6 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc)
integer :: ncols ! Number of columns
integer :: nstep
logical :: exists
real(r8) :: scale_ndep
! 2d pointers
real(r8), pointer :: fldptr_ndep(:,:)
real(r8), pointer :: fldptr_bcph(:,:) , fldptr_ocph(:,:)
Expand Down Expand Up @@ -1121,30 +1120,22 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc)
end if

if (ndep_stream_active.or.chem_has_ndep_flx) then

! Nitrogen dep fluxes are obtained from the ndep input stream if input data is available
! otherwise computed by chemistry
if (ndep_stream_active) then

! get ndep fluxes from the stream
call stream_ndep_interp(cam_out, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
! NDEP read from forcing is expected to be in units of gN/m2/sec - but the mediator
! expects units of kgN/m2/sec
scale_ndep = .001_r8

else if (chem_has_ndep_flx) then

! Assume chemistry computes ndep fluxes, then its in units of kgN/m2/s - and the mediator expects
! units of kgN/m2/sec, so the following conversion needs to happen
scale_ndep = 1._r8

end if

g = 1
do c = begchunk,endchunk
do i = 1,get_ncols_p(c)
fldptr_ndep(1,g) = cam_out(c)%nhx_nitrogen_flx(i) * scale_ndep * mod2med_areacor(g)
fldptr_ndep(2,g) = cam_out(c)%noy_nitrogen_flx(i) * scale_ndep * mod2med_areacor(g)
fldptr_ndep(1,g) = cam_out(c)%nhx_nitrogen_flx(i) * mod2med_areacor(g)
fldptr_ndep(2,g) = cam_out(c)%noy_nitrogen_flx(i) * mod2med_areacor(g)
g = g + 1
end do
end do
Expand Down
9 changes: 7 additions & 2 deletions src/cpl/nuopc/atm_stream_ndep.F90
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ subroutine stream_ndep_interp(cam_out, rc)
integer :: mcdate ! Current model date (yyyymmdd)
real(r8), pointer :: dataptr1d_nhx(:)
real(r8), pointer :: dataptr1d_noy(:)

! NDEP read from forcing is expected to be in units of gN/m2/sec - but the mediator
! expects units of kgN/m2/sec
real(r8), parameter :: scale_ndep = .001_r8

!-----------------------------------------------------------------------

! Advance sdat stream
Expand All @@ -269,8 +274,8 @@ subroutine stream_ndep_interp(cam_out, rc)
g = 1
do c = begchunk,endchunk
do i = 1,get_ncols_p(c)
cam_out(c)%nhx_nitrogen_flx(i) = dataptr1d_nhx(g)
cam_out(c)%noy_nitrogen_flx(i) = dataptr1d_noy(g)
cam_out(c)%nhx_nitrogen_flx(i) = dataptr1d_nhx(g) * scale_ndep
cam_out(c)%noy_nitrogen_flx(i) = dataptr1d_noy(g) * scale_ndep
g = g + 1
end do
end do
Expand Down
4 changes: 2 additions & 2 deletions src/physics/cam/cam_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ subroutine diag_init_moist(pbuf2d)
call addfld('a2x_DSTWET4', horiz_only, 'A', 'kg/m2/s', 'wetdep of dust (bin4)')
call addfld('a2x_DSTDRY4', horiz_only, 'A', 'kg/m2/s', 'drydep of dust (bin4)')

call addfld('a2x_NOYDEP', horiz_only, 'A', 'kg/m2/s', 'NOy Deposition Flux')
call addfld('a2x_NHXDEP', horiz_only, 'A', 'kg/m2/s', 'NHx Deposition Flux')
call addfld('a2x_NOYDEP', horiz_only, 'A', 'kgN/m2/s', 'NOy Deposition Flux')
call addfld('a2x_NHXDEP', horiz_only, 'A', 'kgN/m2/s', 'NHx Deposition Flux')

! defaults
if (history_amwg) then
Expand Down

0 comments on commit 9066aee

Please sign in to comment.