Skip to content

Commit

Permalink
Enable GOCART integration in UFS (NCAR#310)
Browse files Browse the repository at this point in the history
Features:
- Implemented sharing of atmospheric tracer metadata (name, units) to coupled model component via a standard NUOPC connector if coupling tracer field is accessed by shared memory reference
- Introduced additional metadata to tracer records in field_table to identify and validate prognostic and diagnostic chemistry tracers. A new record line starting with the `tracer_usage` keyword is now required to recognize chemistry tracer as follows:

      "tracer_usage", "chemistry"                    (default, prognostic)
      "tracer_usage", "chemistry", "type=diagnostic" (diagnostic)

- Added sanity check for input chemistry tracers, ensuring that both prognostic and diagnostic tracers in field_table are contiguous, and diagnostic tracers follow prognostic ones.
- Improved algorithm to set aerosol scavenging factors
- Exported instantaneous fields for:
   - 3D non-convective liquid and ice precipitation fluxes
   - 3D cloud fraction
   - normalized soil wetness
   -  ice fraction (as used in the atmospheric model)
   - lake fraction
   - ocean fraction
   - surface snow area fraction
- Enabled import of diagnostic tracers

Fixes:
- Prevent a divide by zero error when constant arrays are rescaled for lossy compression in `write_netcdf_parallel()`
- Correctly sample and compute elapsed time for field bundle regridding operations.
- Include hotfix (see PR NCAR#308) to allow latest `setup_exportdata()` to work with coupled chemistry.

Co-authored-by: Dom Heinzeller <climbfuji@ymail.com>
  • Loading branch information
rmontuoro and climbfuji authored Jul 1, 2021
1 parent e4eb2ba commit ad7bddc
Show file tree
Hide file tree
Showing 13 changed files with 1,366 additions and 1,677 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ add_library(fv3atm
module_fv3_config.F90
module_fcst_grid_comp.F90
stochastic_physics/stochastic_physics_wrapper.F90
cpl/module_block_data.F90
cpl/module_cplfields.F90
cpl/module_cap_cpl.F90
io/ffsync.F90
Expand Down
1,656 changes: 497 additions & 1,159 deletions atmos_model.F90

Large diffs are not rendered by default.

324 changes: 137 additions & 187 deletions ccpp/data/GFS_typedefs.F90

Large diffs are not rendered by default.

136 changes: 40 additions & 96 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -2277,14 +2277,6 @@
type = real
kind = kind_phys
active = (index_for_stochastic_land_surface_perturbation_type .ne. 0)
[dqdti]
standard_name = instantaneous_water_vapor_specific_humidity_tendency_due_to_convection
long_name = instantaneous moisture tendency due to convection
units = kg kg-1 s-1
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
active = (flag_for_chemistry_coupling)
[nwfa2d]
standard_name = tendency_of_water_friendly_aerosols_at_surface
long_name = instantaneous water-friendly sfc aerosol source
Expand All @@ -2309,14 +2301,6 @@
type = real
kind = kind_phys
active = (flag_for_chemistry_coupling)
[dkt]
standard_name = instantaneous_atmosphere_heat_diffusivity
long_name = instantaneous atmospheric heat diffusivity
units = m2 s-1
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
active = (flag_for_chemistry_coupling)
[qci_conv]
standard_name = convective_cloud_condesate_after_rainout
long_name = convective cloud condesate after rainout
Expand All @@ -2325,6 +2309,22 @@
type = real
kind = kind_phys
active = (flag_for_mass_flux_deep_convection_scheme == flag_for_gf_deep_convection_scheme)
[pfi_lsan]
standard_name = ice_flux_due_to_large_scale_precipitation
long_name = instantaneous 3D flux of ice from nonconvective precipitation
units = kg m-2 s-1
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
active = (flag_for_chemistry_coupling)
[pfl_lsan]
standard_name = liquid_flux_due_to_large_scale_precipitation
long_name = instantaneous 3D flux of liquid water from nonconvective precipitation
units = kg m-2 s-1
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
active = (flag_for_chemistry_coupling)
########################################################################
[ccpp-table-properties]
name = GFS_control_type
Expand Down Expand Up @@ -4560,6 +4560,30 @@
units = index
dimensions = ()
type = integer
[ntche]
standard_name = index_for_last_chemical_tracer
long_name = tracer index for last chemical tracer
units = index
dimensions = ()
type = integer
[ndchm]
standard_name = number_of_diagnostic_chemical_tracers
long_name = number of diagnostic chemical tracers
units = count
dimensions = ()
type = integer
[ndchs]
standard_name = index_for_first_diagnostic_chemical_tracer
long_name = tracer index for first diagnostic chemical tracer
units = index
dimensions = ()
type = integer
[ndche]
standard_name = index_for_last_diagnostic_chemical_tracer
long_name = tracer index for last diagnostic chemical tracer
units = index
dimensions = ()
type = integer
[ntdiag]
standard_name = diagnostics_control_for_chemical_tracers
long_name = array to control diagnostics for chemical tracers
Expand Down Expand Up @@ -7058,86 +7082,6 @@
dimensions = (horizontal_loop_extent,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
[ndust]
standard_name = number_of_dust_bins_for_diagnostics
long_name = number of dust bins for diagnostics
units = count
dimensions = ()
type = integer
[nseasalt]
standard_name = number_of_seasalt_bins_for_diagnostics
long_name = number of seasalt bins for diagnostics
units = count
dimensions = ()
type = integer
[ntchmdiag]
standard_name = number_of_chemical_tracers_for_diagnostics
long_name = number of chemical tracers for diagnostic output
units = count
dimensions = ()
type = integer
[duem]
standard_name = instantaneous_dust_emission_flux
long_name = instantaneous dust emission flux
units = kg m-2 s-1
dimensions = (horizonal_dimension,number_of_dust_bins_for_diagnostics)
type = real
kind = kind_phys
active = (number_of_dust_bins_for_diagnostics > 0)
[ssem]
standard_name = instantaneous_seasalt_emission_flux
long_name = instantaneous sea salt emission flux
units = kg m-2 s-1
dimensions = (horizonal_dimension,number_of_seasalt_bins_for_diagnostics)
type = real
kind = kind_phys
active = (number_of_seasalt_bins_for_diagnostics > 0)
[sedim]
standard_name = instantaneous_sedimentation
long_name = instantaneous sedimentation
units = kg m-2 s-1
dimensions = (horizonal_dimension,number_of_chemical_tracers_for_diagnostics)
type = real
kind = kind_phys
active = (number_of_chemical_tracers_for_diagnostics > 0)
[drydep]
standard_name = instantaneous_dry_deposition
long_name = instantaneous dry deposition
units = kg m-2 s-1
dimensions = (horizonal_dimension,number_of_chemical_tracers_for_diagnostics)
type = real
kind = kind_phys
active = (number_of_chemical_tracers_for_diagnostics > 0)
[wetdpl]
standard_name = instantaneous_large_scale_wet_deposition
long_name = instantaneous large-scale wet deposition
units = kg m-2 s-1
dimensions = (horizonal_dimension,number_of_chemical_tracers_for_diagnostics)
type = real
kind = kind_phys
active = (number_of_chemical_tracers_for_diagnostics > 0)
[wetdpc]
standard_name = instantaneous_convective_scale_wet_deposition
long_name = instantaneous convective-scale wet deposition
units = kg m-2 s-1
dimensions = (horizonal_dimension,number_of_chemical_tracers_for_diagnostics)
type = real
kind = kind_phys
active = (number_of_chemical_tracers_for_diagnostics > 0)
[abem]
standard_name = instantaneous_anthopogenic_and_biomass_burning_emissions
long_name = instantaneous anthopogenic and biomass burning emissions for black carbon, organic carbon, and sulfur dioxide
units = ug m-2 s-1
dimensions = (horizontal_loop_extent,6)
type = real
kind = kind_phys
[aecm]
standard_name = instantaneous_aerosol_column_mass_densities
long_name = instantaneous aerosol column mass densities for pm2.5, black carbon, organic carbon, sulfate, dust, sea salt
units = g m-2
dimensions = (horizontal_loop_extent,6)
type = real
kind = kind_phys
[edmf_a]
standard_name = emdf_updraft_area
long_name = updraft area from mass flux scheme
Expand Down
155 changes: 0 additions & 155 deletions ccpp/driver/GFS_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3944,161 +3944,6 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop

! print *,'in gfdl_diag_register,af all extdiag, idx=',idx

! -- chemistry diagnostic variables
if (Model%cplchm) then

if (Model%ntchm > 0) then

if (associated(IntDiag(1)%duem)) then
do num = 1, size(IntDiag(1)%duem, dim=2)
idx = idx + 1
ExtDiag(idx)%axes = 2
write(ExtDiag(idx)%name,'("duem",i3.3)') num
write(ExtDiag(idx)%desc,'("Dust Emission Bin ",i0)') num
ExtDiag(idx)%unit = 'kg/m2/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%duem(:,num)
enddo
enddo
endif

if (associated(IntDiag(1)%ssem)) then
do num = 1, size(IntDiag(1)%ssem, dim=2)
idx = idx + 1
ExtDiag(idx)%axes = 2
write(ExtDiag(idx)%name,'("ssem",i3.3)') num
write(ExtDiag(idx)%desc,'("Seasalt Emission Bin ",i0)') num
ExtDiag(idx)%unit = 'kg/m2/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%ssem(:,num)
enddo
enddo
endif

if (associated(Model%ntdiag)) then
idt = 0
do num = Model%ntchs, Model%ntchm + Model%ntchs - 1
if (Model%ntdiag(num-Model%ntchs+1)) then
idt = idt + 1
idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = trim(Model%tracer_names(num)) // 'sd'
ExtDiag(idx)%desc = trim(Model%tracer_names(num)) // ' Sedimentation'
ExtDiag(idx)%unit = 'kg/m2/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%sedim(:,idt)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = trim(Model%tracer_names(num)) // 'dp'
ExtDiag(idx)%desc = trim(Model%tracer_names(num)) // ' Dry Deposition'
ExtDiag(idx)%unit = 'kg/m2/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%drydep(:,idt)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = trim(Model%tracer_names(num)) // 'wtl'
ExtDiag(idx)%desc = trim(Model%tracer_names(num)) // ' Large-Scale Wet Deposition'
ExtDiag(idx)%unit = 'kg/m2/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%wetdpl(:,idt)
enddo

idx = idx + 1
ExtDiag(idx)%axes = 2
ExtDiag(idx)%name = trim(Model%tracer_names(num)) // 'wtc'
ExtDiag(idx)%desc = trim(Model%tracer_names(num)) // ' Convective-Scale Wet Deposition'
ExtDiag(idx)%unit = 'kg/m2/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%wetdpc(:,idt)
enddo
endif
enddo
endif

endif

num = size(IntDiag(1)%abem, dim=2)
do num = 1, size(IntDiag(1)%abem, dim=2)
idx = idx + 1
select case (mod(num,3))
case (0)
ExtDiag(idx)%name = 'bcem'
ExtDiag(idx)%desc = 'Black Carbon'
case (1)
ExtDiag(idx)%name = 'ocem'
ExtDiag(idx)%desc = 'Organic Carbon'
case (2)
ExtDiag(idx)%name = 'so2em'
ExtDiag(idx)%desc = 'SO2'
end select

if (num > 3) then
ExtDiag(idx)%name = trim(ExtDiag(idx)%name) // 'bb'
ExtDiag(idx)%desc = trim(ExtDiag(idx)%desc) // ' Biomass Burning Emissions'
else
ExtDiag(idx)%name = trim(ExtDiag(idx)%name) // 'an'
ExtDiag(idx)%desc = trim(ExtDiag(idx)%desc) // ' Anthropogenic Emissions'
end if

ExtDiag(idx)%axes = 2
ExtDiag(idx)%unit = 'ug/m2/s'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%abem(:,num)
enddo
end do

do num = 1, size(IntDiag(1)%aecm, dim=2)
idx = idx + 1
select case (num)
case(1)
ExtDiag(idx)%name = 'aecmass'
ExtDiag(idx)%desc = 'Aerosol Column Mass Density (PM2.5)'
case(2)
ExtDiag(idx)%name = 'bccmass'
ExtDiag(idx)%desc = 'Black Carbon Column Mass Density'
case(3)
ExtDiag(idx)%name = 'occmass'
ExtDiag(idx)%desc = 'Organic Carbon Column Mass Density'
case(4)
ExtDiag(idx)%name = 'sucmass'
ExtDiag(idx)%desc = 'Sulfate Column Mass Density'
case(5)
ExtDiag(idx)%name = 'ducmass'
ExtDiag(idx)%desc = 'Dust Column Mass Density'
case(6)
ExtDiag(idx)%name = 'sscmass'
ExtDiag(idx)%desc = 'Seasalt Column Mass Density'
end select

ExtDiag(idx)%axes = 2
ExtDiag(idx)%unit = 'g/m2'
ExtDiag(idx)%mod_name = 'gfs_phys'
allocate (ExtDiag(idx)%data(nblks))
do nb = 1,nblks
ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%aecm(:,num)
enddo
end do

endif

!--- prognostic variable tendencies (t, u, v, sph, clwmr, o3)
!rab idx = idx + 1
!rab ExtDiag(idx)%axes = 3
Expand Down
1 change: 1 addition & 0 deletions ccpp/driver/GFS_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, &
Init_parm%iau_offset, Init_parm%bdat, &
Init_parm%cdat, Init_parm%nwat, &
Init_parm%tracer_names, &
Init_parm%tracer_types, &
Init_parm%input_nml_file, Init_parm%tile_num, &
Init_parm%blksz, Init_parm%ak, Init_parm%bk, &
Init_parm%restart, Init_parm%hydrostatic, &
Expand Down
Loading

0 comments on commit ad7bddc

Please sign in to comment.