Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/NOAA-EMC/fv3atm into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Sep 23, 2024
2 parents e3fe22f + a936459 commit f78d2c4
Show file tree
Hide file tree
Showing 48 changed files with 263 additions and 74 deletions.
75 changes: 75 additions & 0 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3121,6 +3121,54 @@ subroutine assign_importdata(jdat, rc)
endif
endif

fldname = 'hflx_fire'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex)) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
im = GFS_control%chunk_begin(nb)+ix-1
GFS_sfcprop%hflx_fire(im) = datar82d(i-isc+1,j-jsc+1)
enddo
enddo
endif
endif

fldname = 'evap_fire'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex)) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
im = GFS_control%chunk_begin(nb)+ix-1
GFS_sfcprop%evap_fire(im) = datar82d(i-isc+1,j-jsc+1)
enddo
enddo
endif
endif

fldname = 'smoke_fire'
if (trim(impfield_name) == trim(fldname)) then
findex = queryImportFields(fldname)
if (importFieldsValid(findex)) then
!$omp parallel do default(shared) private(i,j,nb,ix)
do j=jsc,jec
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
im = GFS_control%chunk_begin(nb)+ix-1
GFS_sfcprop%smoke_fire(im) = datar82d(i-isc+1,j-jsc+1)
enddo
enddo
endif
endif

! write post merge import data to NetCDF file.
if (GFS_control%cpl_imp_dbg) then
call ESMF_FieldGet(importFields(n), grid=grid, rc=rc)
Expand Down Expand Up @@ -3294,6 +3342,21 @@ subroutine setup_exportdata(rc)
do nb = 1, Atm_block%nblks
select case (trim(fieldname))
!--- Instantaneous quantities
! Instantaneous mean layer pressure (Pa)
case ('inst_pres_levels')
call block_data_copy_or_fill(datar83d, GFS_statein%prsl, zeror8, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! Instantaneous geopotential at model layer centers (m2 s-2)
case ('inst_geop_levels')
call block_data_copy_or_fill(datar83d, GFS_statein%phil, zeror8, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! Instantaneous zonal wind (m s-1)
case ('inst_zonal_wind_levels')
call block_data_copy_or_fill(datar83d, GFS_statein%ugrs, zeror8, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! Instantaneous meridional wind (m s-1)
case ('inst_merid_wind_levels')
call block_data_copy_or_fill(datar83d, GFS_statein%vgrs, zeror8, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! Instantaneous surface roughness length (cm)
case ('inst_surface_roughness')
call block_data_copy(datar82d, GFS_sfcprop%zorl, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! Instantaneous u wind (m/s) 10 m above ground
case ('inst_zonal_wind_height10m')
call block_data_copy(datar82d, GFS_coupling%u10mi_cpl, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
Expand Down Expand Up @@ -3378,6 +3441,9 @@ subroutine setup_exportdata(rc)
! Land/Sea mask (sea:0,land:1)
case ('inst_land_sea_mask', 'slmsk')
call block_data_copy(datar82d, GFS_sfcprop%slmsk, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! Total precipitation amount in each time step
case ('inst_rainfall_amount')
call block_data_copy(datar82d, GFS_sfcprop%tprcp, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
!--- Mean quantities
! MEAN Zonal compt of momentum flux (N/m**2)
case ('mean_zonal_moment_flx_atm')
Expand Down Expand Up @@ -3430,6 +3496,15 @@ subroutine setup_exportdata(rc)
! MEAN NET sfc uv+vis diffused flux (W/m**2)
case ('mean_net_sw_vis_dif_flx')
call block_data_copy(datar82d, GFS_coupling%nvisdf_cpl, Atm_block, nb, rtime, spval, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! MEAN precipitation rate (kg/m2/s)
case ('mean_prec_rate')
call block_data_copy(datar82d, GFS_sfcprop%tprcp, Atm_block, nb, rtimek, spval, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! MEAN convective precipitation rate (kg/m2/s)
case ('mean_prec_rate_conv')
call block_data_copy(datar82d, GFS_coupling%rainc_cpl, Atm_block, nb, rtimek, spval, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! MEAN snow precipitation rate (kg/m2/s)
case ('mean_fprec_rate')
call block_data_copy(datar82d, GFS_coupling%snow_cpl, Atm_block, nb, rtimek, spval, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! oceanfrac used by atm to calculate fluxes
case ('openwater_frac_in_atm')
call block_data_combine_fractions(datar82d, GFS_sfcprop%oceanfrac, GFS_sfcprop%fice, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
Expand Down
8 changes: 6 additions & 2 deletions ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
'physics/physics/hooks/machine.F',
'physics/physics/Radiation/RRTMG/radsw_param.f',
'physics/physics/Radiation/RRTMG/radlw_param.f',
'physics/physics/photochem/h2o_def.f',
'physics/physics/photochem/module_ozphys.F90',
'physics/physics/MP/TEMPO/tempo/module_mp_thompson_params.F90',
'physics/physics/photochem/module_h2ophys.F90',
'data/CCPP_typedefs.F90',
'data/GFS_typedefs.F90',
'data/CCPP_data.F90',
Expand Down Expand Up @@ -49,6 +49,9 @@
'module_mp_thompson_params' : {
'module_mp_thompson_params' : '',
'ty_tempo_cfg' : '',
'module_h2ophys' : {
'module_h2ophys' : '',
'ty_h2ophys' : '',
},
'CCPP_typedefs' : {
'GFS_interstitial_type' : 'GFS_Interstitial(cdata%thrd_no)',
Expand Down Expand Up @@ -90,6 +93,7 @@
'physics/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_SCNV_generic_post.F90',
'physics/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_debug.F90',
'physics/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.F90',
'physics/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_photochemistry.F90',
'physics/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_rad_time_vary.fv3.F90',
'physics/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_radiation_surface.F90',
'physics/physics/Interstitials/UFS_SCM_NEPTUNE/GFS_rrtmg_post.F90',
Expand Down Expand Up @@ -155,7 +159,7 @@
'physics/physics/GWD/gwdc_post.f',
'physics/physics/GWD/gwdps.f',
'physics/physics/GWD/rayleigh_damp.f',
'physics/physics/photochem/h2ophys.f',
'physics/physics/photochem/module_h2ophys.F90',
'physics/physics/photochem/module_ozphys.F90',
'physics/physics/MP/Ferrier_Aligo/mp_fer_hires.F90',
'physics/physics/MP/GFDL/gfdl_cloud_microphys.F90',
Expand Down
73 changes: 52 additions & 21 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module GFS_typedefs
use module_radsw_parameters, only: topfsw_type, sfcfsw_type
use module_radlw_parameters, only: topflw_type, sfcflw_type
use module_mp_thompson_params,only: ty_tempo_cfg
use h2o_def, only: levh2o, h2o_coeff
use module_ozphys, only: ty_ozphys
use module_h2ophys, only: ty_h2ophys

implicit none

Expand Down Expand Up @@ -298,6 +298,11 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: hflx (:) => null() !<
real (kind=kind_phys), pointer :: qss (:) => null() !<

!--- fire_behavior
real (kind=kind_phys), pointer :: hflx_fire (:) => null() !< kinematic surface upward sensible heat flux of fire
real (kind=kind_phys), pointer :: evap_fire (:) => null() !< kinematic surface upward latent heat flux of fire
real (kind=kind_phys), pointer :: smoke_fire (:) => null() !< smoke emission of fire

!-- In/Out
real (kind=kind_phys), pointer :: maxupmf(:) => null() !< maximum up draft mass flux for Grell-Freitas
real (kind=kind_phys), pointer :: conv_act(:) => null() !< convective activity counter for Grell-Freitas
Expand Down Expand Up @@ -767,6 +772,7 @@ module GFS_typedefs
logical :: cpllnd !< default no cpllnd collection
logical :: cpllnd2atm !< default no lnd->atm coupling
logical :: rrfs_sd !< default no rrfs_sd collection
logical :: cpl_fire !< default no fire_behavior collection
logical :: use_cice_alb !< default .false. - i.e. don't use albedo imported from the ice model
logical :: cpl_imp_mrg !< default no merge import with internal forcings
logical :: cpl_imp_dbg !< default no write import data to file post merge
Expand Down Expand Up @@ -1022,6 +1028,7 @@ module GFS_typedefs
logical :: sedi_semi !< flag for semi Lagrangian sedi of rain
integer :: decfl !< deformed CFL factor
type(ty_tempo_cfg) :: tempo_cfg !< Thompson MP configuration information.
logical :: thpsnmp_is_init !< Local scheme initialization flag

!--- GFDL microphysical paramters
logical :: lgfdlmprad !< flag for GFDL mp scheme and radiation consistency
Expand Down Expand Up @@ -1488,6 +1495,7 @@ module GFS_typedefs
integer :: nto2 !< tracer index for oxygen
integer :: ntwa !< tracer index for water friendly aerosol
integer :: ntia !< tracer index for ice friendly aerosol
integer :: ntfsmoke !< tracer index for fire smoke
integer :: ntsmoke !< tracer index for smoke
integer :: ntdust !< tracer index for dust
integer :: ntcoarsepm !< tracer index for coarse PM
Expand Down Expand Up @@ -1636,7 +1644,11 @@ module GFS_typedefs
type(ty_ozphys) :: ozphys !< DDT with data needed by ozone physics
integer :: levozp !< Number of vertical layers in ozone forcing data
integer :: oz_coeff !< Number of coefficients in ozone forcing data

!--- NRL h2o photchemistry physics
type(ty_h2ophys) :: h2ophys !< DDT with data needed by h2o photchemistry physics.
integer :: levh2o !< Number of vertical layers in stratospheric h2o data.
integer :: h2o_coeff !< Number of coefficients in stratospheric h2o data.

contains
procedure :: init => control_initialize
procedure :: init_chemistry => control_chemistry_initialize
Expand Down Expand Up @@ -2863,6 +2875,16 @@ subroutine sfcprop_create (Sfcprop, Model)
Sfcprop%lu_qfire = clear_val
endif

!--- if fire_behavior is on
if(Model%cpl_fire) then
allocate (Sfcprop%hflx_fire (IM))
allocate (Sfcprop%evap_fire (IM))
allocate (Sfcprop%smoke_fire (IM))
Sfcprop%hflx_fire = zero
Sfcprop%evap_fire = zero
Sfcprop%smoke_fire = zero
endif

end subroutine sfcprop_create


Expand Down Expand Up @@ -2922,7 +2944,7 @@ subroutine coupling_create (Coupling, Model)
Coupling%tsfc_radtime = clear_val
endif

if (Model%cplflx .or. Model%do_sppt .or. Model%cplchm .or. Model%ca_global .or. Model%cpllnd) then
if (Model%cplflx .or. Model%do_sppt .or. Model%cplchm .or. Model%ca_global .or. Model%cpllnd .or. Model%cpl_fire) then
allocate (Coupling%rain_cpl (IM))
allocate (Coupling%snow_cpl (IM))
Coupling%rain_cpl = clear_val
Expand Down Expand Up @@ -2951,7 +2973,7 @@ subroutine coupling_create (Coupling, Model)
! Coupling%zorlwav_cpl = clear_val
! endif

if (Model%cplflx .or. Model%cpllnd) then
if (Model%cplflx .or. Model%cpllnd .or. Model%cpl_fire) then
allocate (Coupling%dlwsfci_cpl (IM))
allocate (Coupling%dswsfci_cpl (IM))
allocate (Coupling%dlwsfc_cpl (IM))
Expand Down Expand Up @@ -2985,7 +3007,7 @@ subroutine coupling_create (Coupling, Model)
Coupling%nvisdf_cpl = clear_val
end if

if (Model%cplflx) then
if (Model%cplflx .or. Model%cpl_fire) then
!--- incoming quantities
allocate (Coupling%slimskin_cpl (IM))
allocate (Coupling%dusfcin_cpl (IM))
Expand Down Expand Up @@ -3150,7 +3172,7 @@ subroutine coupling_create (Coupling, Model)
Coupling%pfl_lsan = clear_val
endif

if (Model%cplchm .or. Model%cplflx .or. Model%cpllnd) then
if (Model%cplchm .or. Model%cplflx .or. Model%cpllnd .or. Model%cpl_fire) then
!--- accumulated convective rainfall
allocate (Coupling%rainc_cpl (IM))
Coupling%rainc_cpl = clear_val
Expand Down Expand Up @@ -3358,6 +3380,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
logical :: cpllnd = .false. !< default no cpllnd collection
logical :: cpllnd2atm = .false. !< default no cpllnd2atm coupling
logical :: rrfs_sd = .false. !< default no rrfs_sd collection
logical :: cpl_fire = .false. !< default no fire behavior colleciton
logical :: use_cice_alb = .false. !< default no cice albedo
logical :: cpl_imp_mrg = .false. !< default no merge import with internal forcings
logical :: cpl_imp_dbg = .false. !< default no write import data to file post merge
Expand Down Expand Up @@ -3554,6 +3577,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
real(kind=kind_phys) :: dt_inner = -999.0 !< time step for the inner loop
logical :: sedi_semi = .false. !< flag for semi Lagrangian sedi of rain
integer :: decfl = 8 !< deformed CFL factor
logical :: thpsnmp_is_init = .false. !< Local scheme initialization flag

!--- GFDL microphysical parameters
logical :: lgfdlmprad = .false. !< flag for GFDLMP radiation interaction
Expand Down Expand Up @@ -3985,6 +4009,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
integer :: kozpl = 28 !< File identifier for ozone forcing data
integer :: kozc = 48 !< File identifier for ozone climotology data

!--- NRL h2o photochemistry physics
integer :: kh2oc = 29 !< File identifier for h2o photochemistry data.

!--- aerosol scavenging factors
integer, parameter :: max_scav_factors = 183
character(len=40) :: fscav_aero(max_scav_factors) = ''
Expand All @@ -4002,7 +4029,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
!--- coupling parameters
cplflx, cplice, cplocn2atm, cplwav, cplwav2atm, cplaqm, &
cplchm, cpllnd, cpllnd2atm, cpl_imp_mrg, cpl_imp_dbg, &
rrfs_sd, use_cice_alb, &
cpl_fire, rrfs_sd, use_cice_alb, &
#ifdef IDEA_PHYS
lsidea, weimer_model, f107_kp_size, f107_kp_interval, &
f107_kp_skip_size, f107_kp_data_size, f107_kp_read_in_start, &
Expand Down Expand Up @@ -4375,6 +4402,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &

!--- RRFS-SD
Model%rrfs_sd = rrfs_sd
Model%cpl_fire = cpl_fire
Model%dust_drylimit_factor = dust_drylimit_factor
Model%dust_moist_correction = dust_moist_correction
Model%dust_moist_opt = dust_moist_opt
Expand Down Expand Up @@ -4917,18 +4945,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%oz_phys_2015 = oz_phys_2015
Model%h2o_phys = h2o_phys

! To ensure that these values match what's in the physics,
! array sizes are compared during model init in GFS_phys_time_vary_init()
!
! from module h2ointerp
if (h2o_phys) then
levh2o = 72
h2o_coeff = 3
else
levh2o = 1
h2o_coeff = 1
end if

Model%pdfcld = pdfcld
Model%shcnvcw = shcnvcw
Model%redrag = redrag
Expand Down Expand Up @@ -5210,12 +5226,14 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%nqrimef = get_tracer_index(Model%tracer_names, 'q_rimef', Model%me, Model%master, Model%debug)
Model%ntwa = get_tracer_index(Model%tracer_names, 'liq_aero', Model%me, Model%master, Model%debug)
Model%ntia = get_tracer_index(Model%tracer_names, 'ice_aero', Model%me, Model%master, Model%debug)
if (Model%cpl_fire) then
Model%ntfsmoke = get_tracer_index(Model%tracer_names, 'fsmoke', Model%me, Model%master, Model%debug)
endif
if (Model%rrfs_sd) then
Model%ntsmoke = get_tracer_index(Model%tracer_names, 'smoke', Model%me, Model%master, Model%debug)
Model%ntdust = get_tracer_index(Model%tracer_names, 'dust', Model%me, Model%master, Model%debug)
Model%ntcoarsepm = get_tracer_index(Model%tracer_names, 'coarsepm', Model%me, Model%master, Model%debug)
endif

!--- initialize parameters for atmospheric chemistry tracers
call Model%init_chemistry(tracer_types)

Expand Down Expand Up @@ -5642,6 +5660,17 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
err_message = Model%ozphys%load_o3clim('global_o3prdlos.f77',kozc)
end if

!--- NRL h2o photochemistry physics.
if (Model%h2o_phys) then
! Load data for h2o photochemistry physics.
err_message = Model%h2ophys%load('global_h2oprdlos.f77',kh2oc)
Model%levh2o = Model%h2ophys%nlev
Model%h2o_coeff = Model%h2ophys%ncf
else
Model%levh2o = 1
Model%h2o_coeff = 1
end if

!--- quantities to be used to derive phy_f*d totals
Model%nshoc_2d = nshoc_2d
Model%nshoc_3d = nshoc_3d
Expand Down Expand Up @@ -6511,6 +6540,7 @@ subroutine control_print(Model)
print *, ' cpllnd : ', Model%cpllnd
print *, ' cpllnd2atm : ', Model%cpllnd2atm
print *, ' rrfs_sd : ', Model%rrfs_sd
print *, ' cpl_fire : ', Model%cpl_fire
print *, ' use_cice_alb : ', Model%use_cice_alb
print *, ' cpl_imp_mrg : ', Model%cpl_imp_mrg
print *, ' cpl_imp_dbg : ', Model%cpl_imp_dbg
Expand Down Expand Up @@ -6983,6 +7013,7 @@ subroutine control_print(Model)
print *, ' nto2 : ', Model%nto2
print *, ' ntwa : ', Model%ntwa
print *, ' ntia : ', Model%ntia
print *, ' ntfsmoke : ', Model%ntfsmoke
print *, ' ntsmoke : ', Model%ntsmoke
print *, ' ntdust : ', Model%ntdust
print *, ' ntcoarsepm : ', Model%ntcoarsepm
Expand Down Expand Up @@ -7185,7 +7216,7 @@ subroutine tbd_create (Tbd, Model)

!--- ozone and stratosphere h2o needs
allocate (Tbd%ozpl (IM,Model%levozp,Model%oz_coeff))
allocate (Tbd%h2opl (IM,levh2o,h2o_coeff))
allocate (Tbd%h2opl (IM,Model%levh2o,Model%h2o_coeff))
Tbd%h2opl = clear_val
Tbd%ozpl = clear_val

Expand Down
Loading

0 comments on commit f78d2c4

Please sign in to comment.