Skip to content

Commit

Permalink
Add constraint that YOG number tendency can be negative but cannot re…
Browse files Browse the repository at this point in the history
…duce number concentration below zero.
  • Loading branch information
jatkinson1000 committed Sep 12, 2024
1 parent 7bc36e8 commit 6adda9c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/physics/cam/yog_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ subroutine yog_tend(ztodt, state, ptend)
integer :: ncol ! number of atmospheric columns

real(r8) :: ftem(pcols,pver) ! Temporary workspace for outfld variables
real(r8) :: num_tem ! Temporary holder for number tendency

logical :: lq(pcnst)

Expand Down Expand Up @@ -233,12 +234,26 @@ subroutine yog_tend(ztodt, state, ptend)

! Update the number concentration tendencies for liquid and ice species
! Values taken to match those in the `clubb_tend_cam()` subroutine
! YOG can produce negative number tendency, but we must ensure it doesn't reduce total
! number concentration below 0.0
call cnst_get_ind('NUMLIQ', ixnumliq)
call cnst_get_ind('NUMICE', ixnumice)
do k = 1, pver
do i = 1, ncol
ptend%q(i,k,ixnumliq) = 3. * max(0.0, ptend%q(i,k,ixcldliq)) / (4.0*3.14* 8.0e-6**3*997.0)
ptend%q(i,k,ixnumice) = 3. * max(0.0, ptend%q(i,k,ixcldice)) / (4.0*3.14*25.0e-6**3*500.0)
! Liquid
num_tem = 3. * ptend%q(i,k,ixcldliq) / (4.0*3.14* 8.0e-6**3*997.0)
if (num_tem .lt. 0) then
ptend%q(i,k,ixnumliq) = - min(-num_tem, state%q(i,k,ixnumliq)/ztodt)
else
ptend%q(i,k,ixnumliq) = num_tem
endif
! Ice
num_tem = 3. * ptend%q(i,k,ixcldice) / (4.0*3.14*25.0e-6**3*500.0)
if (num_tem .lt. 0) then
ptend%q(i,k,ixnumice) = - min(-num_tem, state%q(i,k,ixnumice)/ztodt)
else
ptend%q(i,k,ixnumice) = num_tem
endif
end do
end do
call outfld('YOGDNUMLIQ ',ptend%q(1,1,ixnumliq) ,pcols ,lchnk )
Expand Down

0 comments on commit 6adda9c

Please sign in to comment.