Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import 5 canopy arrays and 3 photdiag arrays from AQM #1

Merged
merged 3 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
150 changes: 149 additions & 1 deletion atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1295,8 +1295,12 @@ subroutine update_atmos_chemistry(state, rc)

real(ESMF_KIND_R8), dimension(:,:,:,:), pointer :: q

!IVAI: add coszens, jo3o1d, jno2, claie, cfch, cfrt, cclu, cpopu
real(ESMF_KIND_R8), dimension(:,:), pointer :: aod, area, canopy, cmm, &
dqsfc, dtsfc, fice, flake, focn, fsnow, hpbl, nswsfc, oro, psfc, &
claie, cfch, cfrt, cclu, cpopu, & !IVAI
dqsfc, dtsfc, fice, flake, focn, fsnow, hpbl, &
coszens, jo3o1d, jno2, & !IVAI
nswsfc, oro, psfc, &
q2m, rain, rainc, rca, shfsfc, slmsk, stype, swet, t2m, tsfc, &
u10m, uustar, v10m, vfrac, xlai, zorl

Expand All @@ -1323,6 +1327,42 @@ subroutine update_atmos_chemistry(state, rc)
call cplFieldGet(state,'inst_tracer_diag_aod', farrayPtr2d=aod, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__, rcToReturn=rc)) return

!IVAI: case ('import') canopy arrays read in via 'aqm_emiss_read'

call cplFieldGet(state,'inst_tracer_diag_claie', farrayPtr2d=claie, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__, rcToReturn=rc)) return

call cplFieldGet(state,'inst_tracer_diag_cfch', farrayPtr2d=cfch, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__, rcToReturn=rc)) return

call cplFieldGet(state,'inst_tracer_diag_cfrt', farrayPtr2d=cfrt, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__, rcToReturn=rc)) return

call cplFieldGet(state,'inst_tracer_diag_cclu', farrayPtr2d=cclu, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__, rcToReturn=rc)) return

call cplFieldGet(state,'inst_tracer_diag_cpopu', farrayPtr2d=cpopu, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__, rcToReturn=rc)) return

!IVAI: case ('import') photdiag arrays
call cplFieldGet(state,'inst_tracer_diag_coszens', farrayPtr2d=coszens, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__, rcToReturn=rc)) return

call cplFieldGet(state,'inst_tracer_diag_jo3o1d', farrayPtr2d=jo3o1d, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__, rcToReturn=rc)) return

call cplFieldGet(state,'inst_tracer_diag_jno2', farrayPtr2d=jno2, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=__FILE__, rcToReturn=rc)) return
!IVAI
end if

!--- do not import tracer concentrations by default
Expand Down Expand Up @@ -1395,6 +1435,87 @@ subroutine update_atmos_chemistry(state, rc)
GFS_Data(nb)%IntDiag%aod(ix) = aod(i,j)
enddo
enddo
!IVAI: case ('import') canopy arrays read in via aqm_emiss_read
do j = 1, nj
jb = j + Atm_block%jsc - 1
do i = 1, ni
ib = i + Atm_block%isc - 1
nb = Atm_block%blkno(ib,jb)
ix = Atm_block%ixp(ib,jb)
GFS_Data(nb)%IntDiag%claie(ix) = claie(i,j)
enddo
enddo

do j = 1, nj
jb = j + Atm_block%jsc - 1
do i = 1, ni
ib = i + Atm_block%isc - 1
nb = Atm_block%blkno(ib,jb)
ix = Atm_block%ixp(ib,jb)
GFS_Data(nb)%IntDiag%cfch(ix) = cfch(i,j)
enddo
enddo

do j = 1, nj
jb = j + Atm_block%jsc - 1
do i = 1, ni
ib = i + Atm_block%isc - 1
nb = Atm_block%blkno(ib,jb)
ix = Atm_block%ixp(ib,jb)
GFS_Data(nb)%IntDiag%cfrt(ix) = cfrt(i,j)
enddo
enddo

do j = 1, nj
jb = j + Atm_block%jsc - 1
do i = 1, ni
ib = i + Atm_block%isc - 1
nb = Atm_block%blkno(ib,jb)
ix = Atm_block%ixp(ib,jb)
GFS_Data(nb)%IntDiag%cclu(ix) = cclu(i,j)
enddo
enddo

do j = 1, nj
jb = j + Atm_block%jsc - 1
do i = 1, ni
ib = i + Atm_block%isc - 1
nb = Atm_block%blkno(ib,jb)
ix = Atm_block%ixp(ib,jb)
GFS_Data(nb)%IntDiag%cpopu(ix) = cpopu(i,j)
enddo
enddo
!IVAI: case ('import') photdiag arrays
do j = 1, nj
jb = j + Atm_block%jsc - 1
do i = 1, ni
ib = i + Atm_block%isc - 1
nb = Atm_block%blkno(ib,jb)
ix = Atm_block%ixp(ib,jb)
GFS_Data(nb)%IntDiag%coszens(ix) = coszens(i,j)
enddo
enddo

do j = 1, nj
jb = j + Atm_block%jsc - 1
do i = 1, ni
ib = i + Atm_block%isc - 1
nb = Atm_block%blkno(ib,jb)
ix = Atm_block%ixp(ib,jb)
GFS_Data(nb)%IntDiag%jo3o1d(ix) = jo3o1d(i,j)
enddo
enddo

do j = 1, nj
jb = j + Atm_block%jsc - 1
do i = 1, ni
ib = i + Atm_block%isc - 1
nb = Atm_block%blkno(ib,jb)
ix = Atm_block%ixp(ib,jb)
GFS_Data(nb)%IntDiag%jno2(ix) = jno2(i,j)
enddo
enddo
!IVAI
end if

if (GFS_control%debug) then
Expand All @@ -1403,6 +1524,33 @@ subroutine update_atmos_chemistry(state, rc)
if (GFS_control%cplaqm) &
write(6,'("update_atmos: ",a,": aod - min/max ",3g16.6)') &
trim(state), minval(aod), maxval(aod)
!IVAI: case ('import') canopy arrays read via aqm_emiss_read
if (GFS_control%cplaqm) &
write(6,'("update_atmos: ",a,": claie - min/max ",3g16.6)') &
trim(state), minval(claie), maxval(claie)
if (GFS_control%cplaqm) &
write(6,'("update_atmos: ",a,": cfch - min/max ",3g16.6)') &
trim(state), minval(cfch), maxval(cfch)
if (GFS_control%cplaqm) &
write(6,'("update_atmos: ",a,": cfrt - min/max ",3g16.6)') &
trim(state), minval(cfrt), maxval(cfrt)
if (GFS_control%cplaqm) &
write(6,'("update_atmos: ",a,": cclu - min/max ",3g16.6)') &
trim(state), minval(cclu), maxval(cclu)
if (GFS_control%cplaqm) &
write(6,'("update_atmos: ",a,": cpopu - min/max ",3g16.6)') &
trim(state), minval(cpopu), maxval(cpopu)
!IVAI: case ('import') photdiag arrays
if (GFS_control%cplaqm) &
write(6,'("update_atmos: ",a,": coszens - min/max ",3g16.6)') &
trim(state), minval(coszens), maxval(coszens)
if (GFS_control%cplaqm) &
write(6,'("update_atmos: ",a,": jo3o1d - min/max ",3g16.6)') &
trim(state), minval(jo3o1d), maxval(jo3o1d)
if (GFS_control%cplaqm) &
write(6,'("update_atmos: ",a,": jno2 - min/max ",3g16.6)') &
trim(state), minval(jno2), maxval(jno2)
!IVAI
end if

case ('export')
Expand Down
65 changes: 56 additions & 9 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1201,8 +1201,8 @@ module GFS_typedefs

real(kind=kind_phys) :: rbcr !< Critical Richardson Number in the PBL scheme
real(kind=kind_phys) :: betascu !< Tuning parameter for prog. closure shallow clouds
real(kind=kind_phys) :: betamcu !< Tuning parameter for prog. closure midlevel clouds
real(kind=kind_phys) :: betadcu !< Tuning parameter for prog. closure deep clouds
real(kind=kind_phys) :: betamcu !< Tuning parameter for prog. closure midlevel clouds
real(kind=kind_phys) :: betadcu !< Tuning parameter for prog. closure deep clouds

!--- MYNN parameters/switches
logical :: do_mynnedmf
Expand Down Expand Up @@ -1578,7 +1578,7 @@ module GFS_typedefs
real(kind=kind_phys) :: huge !< huge fill value

!--- AQM Canopy
logical :: do_canopy !< control flag for aqm canopy effects
logical :: do_canopy !< control flag for aqm canopy effects
!--- lightning threat and diagsnostics
logical :: lightning_threat !< report lightning threat indices

Expand Down Expand Up @@ -2111,6 +2111,19 @@ module GFS_typedefs
! Diagnostics for coupled air quality model
real (kind=kind_phys), pointer :: aod (:) => null() !< instantaneous aerosol optical depth ( n/a )

!IVAI
! Diagnostics for coupled air quality model
real (kind=kind_phys), pointer :: claie(:) => null() ! Leaf Area Index ECCC
real (kind=kind_phys), pointer :: cfch (:) => null() ! Forest Canopy Height
real (kind=kind_phys), pointer :: cfrt (:) => null() ! Forest Fraction
real (kind=kind_phys), pointer :: cclu (:) => null() ! Clumping Index
real (kind=kind_phys), pointer :: cpopu(:) => null() ! Population density

real (kind=kind_phys), pointer :: coszens(:) => null() ! Cosine SZA for photolysis
real (kind=kind_phys), pointer :: jo3o1d(:) => null() ! instantaneous O3O1D photolysis rate
real (kind=kind_phys), pointer :: jno2 (:) => null() ! instantaneous NO2 photolysis rate
!IVAI

! Auxiliary output arrays for debugging
real (kind=kind_phys), pointer :: aux2d(:,:) => null() !< auxiliary 2d arrays in output (for debugging)
real (kind=kind_phys), pointer :: aux3d(:,:,:)=> null() !< auxiliary 2d arrays in output (for debugging)
Expand Down Expand Up @@ -3912,10 +3925,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
real(kind=kind_phys) :: radar_tten_limits(2) = (/ limit_unspecified, limit_unspecified /)
integer :: itime
integer :: w3kindreal,w3kindint

!--- switch for aqm canopy effects
logical :: do_canopy = .false. !< flag for canopy option

!--- END NAMELIST VARIABLES

NAMELIST /gfs_physics_nml/ &
Expand Down Expand Up @@ -4064,7 +4077,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
!--- (DFI) time ranges with radar-prescribed microphysics tendencies
! and (maybe) convection suppression
fh_dfi_radar, radar_tten_limits, do_cap_suppress, &
! aqm canopy option
! aqm canopy option
do_canopy, &
!--- GSL lightning threat indices
lightning_threat
Expand Down Expand Up @@ -4808,7 +4821,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%hwrf_samfdeep = hwrf_samfdeep
Model%hwrf_samfshal = hwrf_samfshal

!--prognostic closure - moisture coupling
!--prognostic closure - moisture coupling
if ((progsigma .and. imfdeepcnv/=2) .and. (progsigma .and. imfdeepcnv/=5)) then
write(*,*) 'Logic error: progsigma requires imfdeepcnv=2 or 5'
stop
Expand Down Expand Up @@ -5497,9 +5510,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
write(*,*) 'NSSL micro: CCN is ON'
ENDIF
ENDIF

! add checks for nssl_3moment
IF ( ( Model%nssl_3moment ) ) THEN
IF ( ( Model%nssl_3moment ) ) THEN
IF ( Model%ntrz < 1 ) THEN
write(*,*) 'NSSL micro: 3-moment is ON, but rain_ref tracer is missing'
stop
Expand Down Expand Up @@ -7864,6 +7877,40 @@ subroutine diag_create (Diag, IM, Model)
Diag%aod = zero
end if

!IVAI:
! Air quality diagnostics
! -- initialize diagnostic variables
if (Model%cplaqm) then

!IVAI: canopy arrays read via aqm_emis_read
allocate (Diag%claie(IM))
Diag%claie = zero

allocate (Diag%cfch (IM))
Diag%cfch = zero

allocate (Diag%cfrt (IM))
Diag%cfrt = zero

allocate (Diag%cclu (IM))
Diag%cclu = zero

allocate (Diag%cpopu (IM))
Diag%cpopu = zero

!IVAI: photdiag arrays
allocate (Diag%coszens(IM))
Diag%coszens= zero

allocate (Diag%jo3o1d(IM))
Diag%jo3o1d = zero

allocate (Diag%jno2(IM))
Diag%jno2 = zero

end if
!IVAI

! Auxiliary arrays in output for debugging
if (Model%naux2d>0) then
allocate (Diag%aux2d(IM,Model%naux2d))
Expand Down
37 changes: 37 additions & 0 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,43 @@
type = real
kind = kind_phys
active = (control_for_land_surface_scheme == identifier_for_noahmp_land_surface_scheme)
### IVAI
[claie]
standard_name = canopy_leaf_area_index
long_name = canopy leaf area index
units = none
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
[cfch]
standard_name = canopy_forest_height
long_name = canopy forest height
units = m
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
[cfrt]
standard_name = canopy_forest_fraction
long_name = canopy forest fraction
units = none
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
[cclu]
standard_name = canopy_clumping_index
long_name = canopy clumping index
units = none
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
[cpopu]
standard_name = canopy_population_density
long_name = population density used for canopy correction
units = none
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
### IVAI
[canopylaixy]
standard_name = canopy_leaf_area_index
long_name = canopy leaf area index
Copy link
Member

Choose a reason for hiding this comment

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

@iri01 I am not really using these test canopylaixy and other canopy variables below, and the compilation may complain about duplicate standard names, so I would comment all these "...xy" variables I put below.

Expand Down
Loading