Skip to content

Commit

Permalink
Bug fix for ozone input option o3input = 0 (#1755)
Browse files Browse the repository at this point in the history
Bug fix for o3input=0

TYPE: bug fix

KEYWORDS: RRTMG radiation, o3input=0

SOURCE: reported by Mauro Morichetti of Institute of Atmospheric Sciences and Climate (ISAC), ITALY, fixed internally

DESCRIPTION OF CHANGES:
Problem:
The ozone input option 0 (o3input=0) has been broken since 3.5.1 after a different ozone input option was introduced in 3.5 The code checks the presence of the ozone array O33D, and if it is not present, then the ozone is computed using o3input option 0. But the array is always present, so that code never reaches the other branch. Note also that the default o3input option was changed to 2 since 3.7.

Solution:
This PR fixes the option by checking the ozone input option rather than the presence of the array O33D. As there is an interest to see the output from this option, code is added to pass out the data, which is based on 1-d ozone profile. 

LIST OF MODIFIED FILES: 
M       phys/module_ra_rrtmg_lw.F
M       phys/module_ra_rrtmg_lwf.F
M       phys/module_ra_rrtmg_sw.F
M       phys/module_ra_rrtmg_swf.F

TESTS CONDUCTED: 
1. Do mods fix problem? Tested and it fixed the bug.
2. The Jenkins tests have passed.

RELEASE NOTE: Fixed a bug associated with ozone input option o3input = 0. When o3input is set to 0, ozone is effectively not used in the RRTMG radiation option before this fix.
  • Loading branch information
weiwangncar committed Aug 9, 2022
1 parent 9805ddd commit e466739
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 54 deletions.
31 changes: 17 additions & 14 deletions phys/module_ra_rrtmg_lw.F
Original file line number Diff line number Diff line change
Expand Up @@ -11701,9 +11701,8 @@ SUBROUTINE RRTMG_LWRAD( &

! Ozone
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) , &
OPTIONAL , &
INTENT(IN ) :: O33D
INTEGER, OPTIONAL, INTENT(IN ) :: o3input
INTENT(INOUT) :: O33D
INTEGER, INTENT(IN ) :: o3input

real, parameter :: thresh=1.e-9
real slope
Expand Down Expand Up @@ -12011,7 +12010,7 @@ SUBROUTINE RRTMG_LWRAD( &
QV1D(K)=max(0.,QV1D(K))
ENDDO

IF (PRESENT(O33D)) THEN
IF (o3input.eq.2) THEN
DO K=kts,kte
O31D(K)=O33D(I,K,J)
ENDDO
Expand Down Expand Up @@ -12401,27 +12400,31 @@ SUBROUTINE RRTMG_LWRAD( &
call inirad (o3mmr,plev,kts,nlay-1)

! Steven Cavallo: Changed to nlayers from kte+1
if(present(o33d)) then
if(o3input.eq.2) then
do k = kts, nlayers
o3vmr(ncol,k) = o3mmr(k) * amdo
IF ( PRESENT( O33D ) ) THEN
if(o3input .eq. 2)then
if(k.le.kte)then
o3vmr(ncol,k) = o31d(k)
else
if(k.le.kte)then
o3vmr(ncol,k) = o31d(k)
else
! apply shifted climatology profile above model top
o3vmr(ncol,k) = o31d(kte) - o3mmr(kte)*amdo + o3mmr(k)*amdo
if(o3vmr(ncol,k) .le. 0.)o3vmr(ncol,k) = o3mmr(k)*amdo
endif
o3vmr(ncol,k) = o31d(kte) - o3mmr(kte)*amdo + o3mmr(k)*amdo
if(o3vmr(ncol,k) .le. 0.)o3vmr(ncol,k) = o3mmr(k)*amdo
endif
ENDIF
enddo
else
do k = kts, nlayers
o3vmr(ncol,k) = o3mmr(k) * amdo
o31d(k) = o3vmr(ncol,k)
enddo
endif

! output o3 for o3input=0
IF (o3input.ne.2) THEN
DO K=kts,kte
O33D(I,K,J)=O31D(K)
ENDDO
ENDIF

! Set surface emissivity in each RRTMG longwave band
do nb = 1, nbndlw
emis(ncol, nb) = emiss(i,j)
Expand Down
22 changes: 9 additions & 13 deletions phys/module_ra_rrtmg_lwf.F
Original file line number Diff line number Diff line change
Expand Up @@ -15375,8 +15375,8 @@ SUBROUTINE RRTMG_LWRAD_FAST( &
! Ozone
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) , &
OPTIONAL , &
INTENT(IN ) :: O33D
INTEGER, OPTIONAL, INTENT(IN ) :: o3input
INTENT(INOUT) :: O33D
INTEGER, INTENT(IN ) :: o3input

real, parameter :: thresh=1.e-9
real slope
Expand Down Expand Up @@ -15674,7 +15674,7 @@ SUBROUTINE RRTMG_LWRAD_FAST( &
QV1D(K)=max(0.,QV1D(K))
ENDDO

IF (PRESENT(O33D)) THEN
IF (o3input.eq.2) THEN
DO K=kts,kte
O31D(K)=O33D(I,K,J)
ENDDO
Expand Down Expand Up @@ -16015,20 +16015,16 @@ SUBROUTINE RRTMG_LWRAD_FAST( &
call inirad (o3mmr,plev(icol,:),kts,nlay-1)

! Steven Cavallo: Changed to nlayers from kte+1
if(present(o33d)) then
if(o3input.eq.2) then
do k = kts, nlayers
o3vmr(icol,k) = o3mmr(k) * amdo
IF ( PRESENT( O33D ) ) THEN
if(o3input .eq. 2)then
if(k.le.kte)then
o3vmr(icol,k) = o31d(k)
else
if(k.le.kte)then
o3vmr(icol,k) = o31d(k)
else
! apply shifted climatology profile above model top
o3vmr(icol,k) = o31d(kte) - o3mmr(kte)*amdo + o3mmr(k)*amdo
if(o3vmr(icol,k) .le. 0.)o3vmr(icol,k) = o3mmr(k)*amdo
endif
o3vmr(icol,k) = o31d(kte) - o3mmr(kte)*amdo + o3mmr(k)*amdo
if(o3vmr(icol,k) .le. 0.)o3vmr(icol,k) = o3mmr(k)*amdo
endif
ENDIF
enddo
else
do k = kts, nlayers
Expand Down
24 changes: 10 additions & 14 deletions phys/module_ra_rrtmg_sw.F
Original file line number Diff line number Diff line change
Expand Up @@ -10214,9 +10214,8 @@ SUBROUTINE RRTMG_SWRAD( &

! Ozone
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) , &
OPTIONAL , &
INTENT(IN ) :: O33D
INTEGER, OPTIONAL, INTENT(IN ) :: o3input
INTENT(INOUT) :: O33D
INTEGER, INTENT(IN ) :: o3input
! EC aerosol: no_src = naerec = 6
INTEGER, INTENT(IN ) :: no_src
REAL, DIMENSION( ims:ime, kms:kme, jms:jme, 1:no_src ) , &
Expand Down Expand Up @@ -10598,7 +10597,7 @@ SUBROUTINE RRTMG_SWRAD( &
QV1D(K)=max(0.,QV1D(K))
ENDDO

IF (PRESENT(O33D)) THEN
IF (o3input.eq.2) THEN
DO K=kts,kte
O31D(K)=O33D(I,K,J)
ENDDO
Expand Down Expand Up @@ -10919,24 +10918,21 @@ SUBROUTINE RRTMG_SWRAD( &
! Get ozone profile including amount in extra layer above model top
call inirad (o3mmr,plev,kts,kte)

if(present(o33d)) then
if(o3input.eq.2) then
do k = kts, kte+1
o3vmr(ncol,k) = o3mmr(k) * amdo
IF ( PRESENT( O33D ) ) THEN
if(o3input .eq. 2)then
if(k.le.kte)then
o3vmr(ncol,k) = o31d(k)
else
if(k.le.kte)then
o3vmr(ncol,k) = o31d(k)
else
! apply shifted climatology profile above model top
o3vmr(ncol,k) = o31d(kte) - o3mmr(kte)*amdo + o3mmr(k)*amdo
if(o3vmr(ncol,k) .le. 0.)o3vmr(ncol,k) = o3mmr(k)*amdo
endif
o3vmr(ncol,k) = o31d(kte) - o3mmr(kte)*amdo + o3mmr(k)*amdo
if(o3vmr(ncol,k) .le. 0.)o3vmr(ncol,k) = o3mmr(k)*amdo
endif
ENDIF
enddo
else
do k = kts, kte+1
o3vmr(ncol,k) = o3mmr(k) * amdo
o31d(k) = o3vmr(ncol,k)
enddo
endif

Expand Down
21 changes: 8 additions & 13 deletions phys/module_ra_rrtmg_swf.F
Original file line number Diff line number Diff line change
Expand Up @@ -11386,8 +11386,7 @@ SUBROUTINE RRTMG_SWRAD_FAST( &
INTEGER, INTENT(IN ), OPTIONAL :: progn
! Ozone
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) , &
OPTIONAL , &
INTENT(IN ) :: O33D
INTENT(INOUT) :: O33D
INTEGER, OPTIONAL, INTENT(IN ) :: o3input
! EC aerosol: no_src = naerec = 6
INTEGER, INTENT(IN ) :: no_src
Expand Down Expand Up @@ -11731,7 +11730,7 @@ SUBROUTINE RRTMG_SWRAD_FAST( &
QV1D(K)=max(0.,QV1D(K))
ENDDO

IF (PRESENT(O33D)) THEN
IF (o3input.eq.2) THEN
DO K=kts,kte
O31D(K)=O33D(I,K,J)
ENDDO
Expand Down Expand Up @@ -11992,20 +11991,16 @@ SUBROUTINE RRTMG_SWRAD_FAST( &
! call inirad (o3mmr,plev,kts,kte)
call inirad (o3mmr,plev(icol,:),kts,kte)

if(present(o33d)) then
if(o3input.eq.2) then
do k = kts, kte+1
o3vmr(icol,k) = o3mmr(k) * amdo
IF ( PRESENT( O33D ) ) THEN
if(o3input .eq. 2)then
if(k.le.kte)then
o3vmr(icol,k) = o31d(k)
else
if(k.le.kte)then
o3vmr(icol,k) = o31d(k)
else
! apply shifted climatology profile above model top
o3vmr(icol,k) = o31d(kte) - o3mmr(kte)*amdo + o3mmr(k)*amdo
if(o3vmr(icol,k) .le. 0.)o3vmr(icol,k) = o3mmr(k)*amdo
endif
o3vmr(icol,k) = o31d(kte) - o3mmr(kte)*amdo + o3mmr(k)*amdo
if(o3vmr(icol,k) .le. 0.)o3vmr(icol,k) = o3mmr(k)*amdo
endif
ENDIF
enddo
else
do k = kts, kte+1
Expand Down

0 comments on commit e466739

Please sign in to comment.