Skip to content

Commit

Permalink
Merge branch 'hotfix/NOAA-EMC#301-exportdata' into feature/gocart-int…
Browse files Browse the repository at this point in the history
…egration
  • Loading branch information
rmontuoro committed May 27, 2021
2 parents c48922a + 03f841d commit 72ec69e
Show file tree
Hide file tree
Showing 8 changed files with 700 additions and 575 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
223 changes: 216 additions & 7 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ module atmos_model_mod
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
use module_block_data

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

Expand Down Expand Up @@ -2330,6 +2331,9 @@ subroutine setup_exportdata(rc)
real(kind=ESMF_KIND_R8), dimension(:,:), pointer :: datar82d
real(kind=ESMF_KIND_R8), dimension(:,:,:), pointer :: datar83d

!--- local parameters
real(kind=ESMF_KIND_R8), parameter :: zeror8 = 0._ESMF_KIND_R8

!--- begin
if (present(rc)) rc = ESMF_SUCCESS

Expand Down Expand Up @@ -2383,13 +2387,218 @@ subroutine setup_exportdata(rc)
end if

if (isFound) then
select case (trim(fieldname))
#include "physics_export_fields.h"
#include "dynamics_export_fields.h"
#include "jedi_export_fields.h"
end select
end if

!$omp parallel do default(shared) private(nb)
do nb = 1, Atm_block%nblks
select case (trim(fieldname))
!--- Instantaneous quantities
! Instantaneous u wind (m/s) 10 m above ground
case ('inst_zonal_wind_height10m')
call block_data_copy(datar82d, GFS_data(nb)%coupling%u10mi_cpl, Atm_block, nb)
! Instantaneous v wind (m/s) 10 m above ground
case ('inst_merid_wind_height10m')
call block_data_copy(datar82d, GFS_data(nb)%coupling%v10mi_cpl, Atm_block, nb)
! Instantaneous Zonal compt of momentum flux (N/m**2)
case ('inst_zonal_moment_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dusfci_cpl, Atm_block, nb)
! Instantaneous Merid compt of momentum flux (N/m**2)
case ('inst_merid_moment_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dvsfci_cpl, Atm_block, nb)
! Instantaneous Sensible heat flux (W/m**2)
case ('inst_sensi_heat_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dtsfci_cpl, Atm_block, nb)
! Instantaneous Latent heat flux (W/m**2)
case ('inst_laten_heat_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dqsfci_cpl, Atm_block, nb)
! Instantaneous Downward long wave radiation flux (W/m**2)
case ('inst_down_lw_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dlwsfci_cpl, Atm_block, nb)
! Instantaneous Downward solar radiation flux (W/m**2)
case ('inst_down_sw_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dswsfci_cpl, Atm_block, nb)
! Instantaneous Temperature (K) 2 m above ground
case ('inst_temp_height2m')
call block_data_copy(datar82d, GFS_data(nb)%coupling%t2mi_cpl, Atm_block, nb)
! Instantaneous Specific humidity (kg/kg) 2 m above ground
case ('inst_spec_humid_height2m')
call block_data_copy(datar82d, GFS_data(nb)%coupling%q2mi_cpl, Atm_block, nb)
! Instantaneous Temperature (K) at surface
case ('inst_temp_height_surface')
call block_data_copy(datar82d, GFS_data(nb)%coupling%tsfci_cpl, Atm_block, nb)
! Instantaneous Pressure (Pa) land and sea surface
case ('inst_pres_height_surface')
call block_data_copy(datar82d, GFS_data(nb)%coupling%psurfi_cpl, Atm_block, nb)
! Instantaneous Surface height (m)
case ('inst_surface_height')
call block_data_copy(datar82d, GFS_data(nb)%coupling%oro_cpl, Atm_block, nb)
! Instantaneous NET long wave radiation flux (W/m**2)
case ('inst_net_lw_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nlwsfci_cpl, Atm_block, nb)
! Instantaneous NET solar radiation flux over the ocean (W/m**2)
case ('inst_net_sw_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nswsfci_cpl, Atm_block, nb)
! Instantaneous sfc downward nir direct flux (W/m**2)
case ('inst_down_sw_ir_dir_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dnirbmi_cpl, Atm_block, nb)
! Instantaneous sfc downward nir diffused flux (W/m**2)
case ('inst_down_sw_ir_dif_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dnirdfi_cpl, Atm_block, nb)
! Instantaneous sfc downward uv+vis direct flux (W/m**2)
case ('inst_down_sw_vis_dir_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dvisbmi_cpl, Atm_block, nb)
! Instantaneous sfc downward uv+vis diffused flux (W/m**2)
case ('inst_down_sw_vis_dif_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dvisdfi_cpl, Atm_block, nb)
! Instantaneous net sfc nir direct flux (W/m**2)
case ('inst_net_sw_ir_dir_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nnirbmi_cpl, Atm_block, nb)
! Instantaneous net sfc nir diffused flux (W/m**2)
case ('inst_net_sw_ir_dif_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nnirdfi_cpl, Atm_block, nb)
! Instantaneous net sfc uv+vis direct flux (W/m**2)
case ('inst_net_sw_vis_dir_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nvisbmi_cpl, Atm_block, nb)
! Instantaneous net sfc uv+vis diffused flux (W/m**2)
case ('inst_net_sw_vis_dif_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nvisdfi_cpl, Atm_block, nb)
! Land/Sea mask (sea:0,land:1)
case ('inst_land_sea_mask')
call block_data_copy(datar82d, GFS_data(nb)%coupling%slmsk_cpl, Atm_block, nb)
!--- Mean quantities
! MEAN Zonal compt of momentum flux (N/m**2)
case ('mean_zonal_moment_flx_atm')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dusfc_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN Merid compt of momentum flux (N/m**2)
case ('mean_merid_moment_flx_atm')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dvsfc_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN Sensible heat flux (W/m**2)
case ('mean_sensi_heat_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dtsfc_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN Latent heat flux (W/m**2)
case ('mean_laten_heat_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dqsfc_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN Downward LW heat flux (W/m**2)
case ('mean_down_lw_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dlwsfc_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN Downward SW heat flux (W/m**2)
case ('mean_down_sw_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dswsfc_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN NET long wave radiation flux (W/m**2)
case ('mean_net_lw_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nlwsfc_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN NET solar radiation flux over the ocean (W/m**2)
case ('mean_net_sw_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nswsfc_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN sfc downward nir direct flux (W/m**2)
case ('mean_down_sw_ir_dir_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dnirbm_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN sfc downward nir diffused flux (W/m**2)
case ('mean_down_sw_ir_dif_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dnirdf_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN sfc downward uv+vis direct flux (W/m**2)
case ('mean_down_sw_vis_dir_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dvisbm_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN sfc downward uv+vis diffused flux (W/m**2)
case ('mean_down_sw_vis_dif_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%dvisdf_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN NET sfc nir direct flux (W/m**2)
case ('mean_net_sw_ir_dir_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nnirbm_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN NET sfc nir diffused flux (W/m**2)
case ('mean_net_sw_ir_dif_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nnirdf_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN NET sfc uv+vis direct flux (W/m**2)
case ('mean_net_sw_vis_dir_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nvisbm_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN NET sfc uv+vis diffused flux (W/m**2)
case ('mean_net_sw_vis_dif_flx')
call block_data_copy(datar82d, GFS_data(nb)%coupling%nvisdf_cpl, Atm_block, nb, scale_factor=rtime)
! MEAN precipitation rate (kg/m2/s)
case ('mean_prec_rate')
call block_data_copy(datar82d, GFS_data(nb)%coupling%rain_cpl, Atm_block, nb, scale_factor=rtimek)
! MEAN snow precipitation rate (kg/m2/s)
case ('mean_fprec_rate')
call block_data_copy(datar82d, GFS_data(nb)%coupling%snow_cpl, Atm_block, nb, scale_factor=rtimek)
! oceanfrac used by atm to calculate fluxes
case ('openwater_frac_in_atm')
call block_data_combine_fractions(datar82d, GFS_data(nb)%sfcprop%oceanfrac, GFS_Data(nb)%sfcprop%fice, Atm_block, nb)
!--- Dycore quantities
! bottom layer temperature (t)
case('inst_temp_height_lowest')
call block_data_copy_or_fill(datar82d, DYCORE_data(nb)%coupling%t_bot, zeror8, Atm_block, nb)
! bottom layer specific humidity (q)
! ! ! CHECK if tracer 1 is for specific humidity ! ! !
case('inst_spec_humid_height_lowest')
call block_data_copy_or_fill(datar82d, DYCORE_data(nb)%coupling%tr_bot, 1, zeror8, Atm_block, nb)
! bottom layer zonal wind (u)
case('inst_zonal_wind_height_lowest')
call block_data_copy_or_fill(datar82d, DYCORE_data(nb)%coupling%u_bot, zeror8, Atm_block, nb)
! bottom layer meridionalw wind (v)
case('inst_merid_wind_height_lowest')
call block_data_copy_or_fill(datar82d, DYCORE_data(nb)%coupling%v_bot, zeror8, Atm_block, nb)
! bottom layer pressure (p)
case('inst_pres_height_lowest')
call block_data_copy_or_fill(datar82d, DYCORE_data(nb)%coupling%p_bot, zeror8, Atm_block, nb)
! bottom layer height (z)
case('inst_height_lowest')
call block_data_copy_or_fill(datar82d, DYCORE_data(nb)%coupling%z_bot, zeror8, Atm_block, nb)
!--- JEDI fields
case ('u')
call block_atmos_copy(datar83d, Atm(mygrid)%u, Atm_block, nb)
case ('v')
call block_atmos_copy(datar83d, Atm(mygrid)%v, Atm_block, nb)
case ('ua')
call block_atmos_copy(datar83d, Atm(mygrid)%ua, Atm_block, nb)
case ('va')
call block_atmos_copy(datar83d, Atm(mygrid)%va, Atm_block, nb)
case ('t')
call block_atmos_copy(datar83d, Atm(mygrid)%pt, Atm_block, nb)
case ('delp')
call block_atmos_copy(datar83d, Atm(mygrid)%delp, Atm_block, nb)
case ('sphum')
sphum = get_tracer_index(MODEL_ATMOS, 'sphum')
call block_atmos_copy(datar83d, Atm(mygrid)%q, sphum, Atm_block, nb)
case ('ice_wat')
ice_wat = get_tracer_index(MODEL_ATMOS, 'ice_wat')
call block_atmos_copy(datar83d, Atm(mygrid)%q, ice_wat, Atm_block, nb)
case ('liq_wat')
liq_wat = get_tracer_index(MODEL_ATMOS, 'liq_wat')
call block_atmos_copy(datar83d, Atm(mygrid)%q, liq_wat, Atm_block, nb)
case ('o3mr')
o3mr = get_tracer_index(MODEL_ATMOS, 'o3mr')
call block_atmos_copy(datar83d, Atm(mygrid)%q, o3mr, Atm_block, nb)
case ('phis')
call block_atmos_copy(datar82d, Atm(mygrid)%phis, Atm_block, nb)
case ('u_srf')
call block_atmos_copy(datar82d, Atm(mygrid)%u_srf, Atm_block, nb)
case ('v_srf')
call block_atmos_copy(datar82d, Atm(mygrid)%v_srf, Atm_block, nb)
case ('slmsk')
call block_data_copy(datar82d, GFS_data(nb)%sfcprop%slmsk, Atm_block, nb)
case ('weasd')
call block_data_copy(datar82d, GFS_data(nb)%sfcprop%weasd, Atm_block, nb)
case ('tsea')
call block_data_copy(datar82d, GFS_data(nb)%sfcprop%tsfco, Atm_block, nb)
case ('vtype')
call block_data_copy(datar82d, GFS_data(nb)%sfcprop%vtype, Atm_block, nb)
case ('stype')
call block_data_copy(datar82d, GFS_data(nb)%sfcprop%stype, Atm_block, nb)
case ('vfrac')
call block_data_copy(datar82d, GFS_data(nb)%sfcprop%vfrac, Atm_block, nb)
case ('stc')
call block_data_copy(datar83d, GFS_data(nb)%sfcprop%stc, Atm_block, nb)
case ('smc')
call block_data_copy(datar83d, GFS_data(nb)%sfcprop%smc, Atm_block, nb)
case ('snwdph')
call block_data_copy(datar82d, GFS_data(nb)%sfcprop%snowd, Atm_block, nb)
case ('f10m')
call block_data_copy(datar82d, GFS_data(nb)%sfcprop%f10m, Atm_block, nb)
case ('zorl')
call block_data_copy(datar82d, GFS_data(nb)%sfcprop%zorl, Atm_block, nb)
case ('t2m')
call block_data_copy(datar82d, GFS_data(nb)%sfcprop%t2m, Atm_block, nb)
end select
enddo
endif
enddo ! exportFields

!---
Expand Down
Loading

0 comments on commit 72ec69e

Please sign in to comment.