Skip to content

Commit

Permalink
Move IO related configuration from fv3_cap to write grid component. A…
Browse files Browse the repository at this point in the history
…dd cice6 ice albedo (NOAA-EMC#318)

* Move IO related configuration from fv3_cap to write grid component
* Move some module variables that are not public, nor shared between various subroutines to local scope.
* Consolidate three versions of string buffers (for logging) into one (msgString)
* Remove unused variables (fcstmype for example)
* Rename atmos_model_finalize to ModelFinalize, for consistency
* Move restart_interval,num_restart_interval and frestart to module_fcst_grid_comp
* Get cice6 ice albedo to FV3

Co-authored-by: Jun Wang <junwang-noaa@users.noreply.github.com>
  • Loading branch information
DusanJovic-NOAA and junwang-noaa authored Jun 8, 2021
1 parent 116d701 commit 8384673
Show file tree
Hide file tree
Showing 8 changed files with 576 additions and 504 deletions.
86 changes: 85 additions & 1 deletion atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module atmos_model_mod
DIAG_SIZE
use fv_iau_mod, only: iau_external_data_type,getiauforcing,iau_initialize
use module_fv3_config, only: output_1st_tstep_rst, first_kdt, nsout, &
frestart, restart_endfcst
restart_endfcst

!-----------------------------------------------------------------------

Expand Down Expand Up @@ -1847,9 +1847,93 @@ subroutine assign_importdata(rc)
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get snow_volume from mediator'
endif
endif
!
! get instantaneous near IR albedo for diffuse radiation: for sea ice covered area
!---------------------------------------------------------------------------------
fldname = 'inst_ice_ir_dif_albedo'
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)
if (GFS_data(nb)%Sfcprop%oceanfrac(ix) > zero) then
GFS_data(nb)%Coupling%sfc_alb_nir_dif_cpl(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get sfc_alb_nir_dif_cpl from mediator'
endif
endif
!
! get instantaneous near IR albedo for direct radiation: for sea ice covered area
!---------------------------------------------------------------------------------
fldname = 'inst_ice_ir_dir_albedo'
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)
if (GFS_data(nb)%Sfcprop%oceanfrac(ix) > zero) then
GFS_data(nb)%Coupling%sfc_alb_nir_dir_cpl(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get sfc_alb_nir_dir_cpl from mediator'
endif
endif
!
! get instantaneous visible albedo for diffuse radiation: for sea ice covered area
!---------------------------------------------------------------------------------
fldname = 'inst_ice_vis_dif_albedo'
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)
if (GFS_data(nb)%Sfcprop%oceanfrac(ix) > zero) then
GFS_data(nb)%Coupling%sfc_alb_vis_dif_cpl(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get sfc_alb_vis_dif_cpl from mediator'
endif
endif

!
! get instantaneous visible IR albedo for direct radiation: for sea ice covered area
!---------------------------------------------------------------------------------
fldname = 'inst_ice_vis_dir_albedo'
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)
if (GFS_data(nb)%Sfcprop%oceanfrac(ix) > zero) then
GFS_data(nb)%Coupling%sfc_alb_vis_dir_cpl(ix) = datar8(i,j)
endif
enddo
enddo
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'fv3 assign_import: get inst_ice_vis_dir_albedo from mediator'
endif
endif


endif ! if (datar8(isc,jsc) > -99999.0) then

!-------------------------------------------------------

! For JEDI

sphum = get_tracer_index(MODEL_ATMOS, 'sphum')
Expand Down
83 changes: 48 additions & 35 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -440,20 +440,25 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: fluxlwUP_allsky(:,:) => null() !< GP up LW total sky flux profile ( w/m**2/K )
real (kind=kind_phys), pointer :: fluxlwDOWN_allsky(:,:) => null() !< GP down LW total sky flux profile ( w/m**2/K )
real (kind=kind_phys), pointer :: htrlw(:,:) => null() !< GP updated LW heating rate

!--- incoming quantities
real (kind=kind_phys), pointer :: dusfcin_cpl(:) => null() !< aoi_fld%dusfcin(item,lan)
real (kind=kind_phys), pointer :: dvsfcin_cpl(:) => null() !< aoi_fld%dvsfcin(item,lan)
real (kind=kind_phys), pointer :: dtsfcin_cpl(:) => null() !< aoi_fld%dtsfcin(item,lan)
real (kind=kind_phys), pointer :: dqsfcin_cpl(:) => null() !< aoi_fld%dqsfcin(item,lan)
real (kind=kind_phys), pointer :: ulwsfcin_cpl(:)=> null() !< aoi_fld%ulwsfcin(item,lan)
! real (kind=kind_phys), pointer :: tseain_cpl(:) => null() !< aoi_fld%tseain(item,lan)
! real (kind=kind_phys), pointer :: tisfcin_cpl(:) => null() !< aoi_fld%tisfcin(item,lan)
! real (kind=kind_phys), pointer :: ficein_cpl(:) => null() !< aoi_fld%ficein(item,lan)
! real (kind=kind_phys), pointer :: hicein_cpl(:) => null() !< aoi_fld%hicein(item,lan)
real (kind=kind_phys), pointer :: hsnoin_cpl(:) => null() !< aoi_fld%hsnoin(item,lan)
real (kind=kind_phys), pointer :: dusfcin_cpl(:) => null() !< aoi_fld%dusfcin(item,lan)
real (kind=kind_phys), pointer :: dvsfcin_cpl(:) => null() !< aoi_fld%dvsfcin(item,lan)
real (kind=kind_phys), pointer :: dtsfcin_cpl(:) => null() !< aoi_fld%dtsfcin(item,lan)
real (kind=kind_phys), pointer :: dqsfcin_cpl(:) => null() !< aoi_fld%dqsfcin(item,lan)
real (kind=kind_phys), pointer :: ulwsfcin_cpl(:) => null() !< aoi_fld%ulwsfcin(item,lan)
! real (kind=kind_phys), pointer :: tseain_cpl(:) => null() !< aoi_fld%tseain(item,lan)
! real (kind=kind_phys), pointer :: tisfcin_cpl(:) => null() !< aoi_fld%tisfcin(item,lan)
! real (kind=kind_phys), pointer :: ficein_cpl(:) => null() !< aoi_fld%ficein(item,lan)
! real (kind=kind_phys), pointer :: hicein_cpl(:) => null() !< aoi_fld%hicein(item,lan)
real (kind=kind_phys), pointer :: hsnoin_cpl(:) => null() !< aoi_fld%hsnoin(item,lan)
real (kind=kind_phys), pointer :: sfc_alb_nir_dir_cpl(:) => null() !< sfc nir albedo for direct rad
real (kind=kind_phys), pointer :: sfc_alb_nir_dif_cpl(:) => null() !< sfc nir albedo for diffuse rad
real (kind=kind_phys), pointer :: sfc_alb_vis_dir_cpl(:) => null() !< sfc vis albedo for direct rad
real (kind=kind_phys), pointer :: sfc_alb_vis_dif_cpl(:) => null() !< sfc vis albedo for diffuse rad
!--- only variable needed for cplwav2atm=.TRUE.
! real (kind=kind_phys), pointer :: zorlwav_cpl(:) => null() !< roughness length from wave model
!--- also needed for ice/ocn coupling - Xingren
! real (kind=kind_phys), pointer :: zorlwav_cpl(:) => null() !< roughness length from wave model
!--- also needed for ice/ocn coupling
real (kind=kind_phys), pointer :: slimskin_cpl(:)=> null() !< aoi_fld%slimskin(item,lan)

!--- outgoing accumulated quantities
Expand Down Expand Up @@ -2743,29 +2748,37 @@ subroutine coupling_create (Coupling, IM, Model)

if (Model%cplflx) then
!--- incoming quantities
allocate (Coupling%slimskin_cpl (IM))
allocate (Coupling%dusfcin_cpl (IM))
allocate (Coupling%dvsfcin_cpl (IM))
allocate (Coupling%dtsfcin_cpl (IM))
allocate (Coupling%dqsfcin_cpl (IM))
allocate (Coupling%ulwsfcin_cpl (IM))
! allocate (Coupling%tseain_cpl (IM))
! allocate (Coupling%tisfcin_cpl (IM))
! allocate (Coupling%ficein_cpl (IM))
! allocate (Coupling%hicein_cpl (IM))
allocate (Coupling%hsnoin_cpl (IM))

Coupling%slimskin_cpl = clear_val
Coupling%dusfcin_cpl = clear_val
Coupling%dvsfcin_cpl = clear_val
Coupling%dtsfcin_cpl = clear_val
Coupling%dqsfcin_cpl = clear_val
Coupling%ulwsfcin_cpl = clear_val
! Coupling%tseain_cpl = clear_val
! Coupling%tisfcin_cpl = clear_val
! Coupling%ficein_cpl = clear_val
! Coupling%hicein_cpl = clear_val
Coupling%hsnoin_cpl = clear_val
allocate (Coupling%slimskin_cpl (IM))
allocate (Coupling%dusfcin_cpl (IM))
allocate (Coupling%dvsfcin_cpl (IM))
allocate (Coupling%dtsfcin_cpl (IM))
allocate (Coupling%dqsfcin_cpl (IM))
allocate (Coupling%ulwsfcin_cpl (IM))
! allocate (Coupling%tseain_cpl (IM))
! allocate (Coupling%tisfcin_cpl (IM))
! allocate (Coupling%ficein_cpl (IM))
! allocate (Coupling%hicein_cpl (IM))
allocate (Coupling%hsnoin_cpl (IM))
allocate (Coupling%sfc_alb_nir_dir_cpl (IM))
allocate (Coupling%sfc_alb_nir_dif_cpl (IM))
allocate (Coupling%sfc_alb_vis_dir_cpl (IM))
allocate (Coupling%sfc_alb_vis_dif_cpl (IM))

Coupling%slimskin_cpl = clear_val
Coupling%dusfcin_cpl = clear_val
Coupling%dvsfcin_cpl = clear_val
Coupling%dtsfcin_cpl = clear_val
Coupling%dqsfcin_cpl = clear_val
Coupling%ulwsfcin_cpl = clear_val
! Coupling%tseain_cpl = clear_val
! Coupling%tisfcin_cpl = clear_val
! Coupling%ficein_cpl = clear_val
! Coupling%hicein_cpl = clear_val
Coupling%hsnoin_cpl = clear_val
Coupling%sfc_alb_nir_dir_cpl = clear_val
Coupling%sfc_alb_nir_dif_cpl = clear_val
Coupling%sfc_alb_vis_dir_cpl = clear_val
Coupling%sfc_alb_vis_dif_cpl = clear_val

!--- accumulated quantities
allocate (Coupling%dusfc_cpl (IM))
Expand Down
32 changes: 32 additions & 0 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -2167,6 +2167,38 @@
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
[sfc_alb_nir_dir_cpl]
standard_name = surface_nir_albedo_direct_rad_for_coupling
long_name = sfc near IR albedo for direct radiation for coupling
units = frac
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (flag_for_flux_coupling)
[sfc_alb_nir_dif_cpl]
standard_name = surface_nir_albedo_diffuse_rad_for_coupling
long_name = sfc near IR albedo for diffuse radiation for coupling
units = frac
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (flag_for_flux_coupling)
[sfc_alb_vis_dir_cpl]
standard_name = surface_vis_albedo_direct_rad_for_coupling
long_name = sfc visible albedo for direct radiation for coupling
units = frac
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (flag_for_flux_coupling)
[sfc_alb_vis_dif_cpl]
standard_name = surface_vis_albedo_diffuse_rad_for_coupling
long_name = sfc visible albedo for diffuse radiation for coupling
units = frac
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
active = (flag_for_flux_coupling)
[slimskin_cpl]
standard_name = sea_land_ice_mask_in
long_name = sea/land/ice mask input (=0/1/2)
Expand Down
6 changes: 5 additions & 1 deletion cpl/module_cplfields.F90
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ module module_cplfields
FieldInfo("t2m ", "s") ]

! Import Fields ----------------------------------------
integer, public, parameter :: NimportFields = 42
integer, public, parameter :: NimportFields = 46
logical, public :: importFieldsValid(NimportFields)
type(ESMF_Field), target, public :: importFields(NimportFields)

Expand All @@ -141,6 +141,10 @@ module module_cplfields
FieldInfo("stress_on_air_ice_merid ", "s"), &
FieldInfo("mean_ice_volume ", "s"), &
FieldInfo("mean_snow_volume ", "s"), &
FieldInfo("inst_ice_ir_dif_albedo ", "s"), &
FieldInfo("inst_ice_ir_dir_albedo ", "s"), &
FieldInfo("inst_ice_vis_dif_albedo ", "s"), &
FieldInfo("inst_ice_vis_dir_albedo ", "s"), &
FieldInfo("inst_tracer_up_surface_flx ", "u"), &
FieldInfo("inst_tracer_down_surface_flx ", "d"), &
FieldInfo("inst_tracer_clmn_mass_dens ", "c"), &
Expand Down
Loading

0 comments on commit 8384673

Please sign in to comment.