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

updates in inline post and restart files and bug fix in ugwd #27

Merged
merged 7 commits into from
Dec 26, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion atmos_cubed_sphere
34 changes: 28 additions & 6 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ module atmos_model_mod
FV3GFS_diag_register, FV3GFS_diag_output, &
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
use module_fv3_config, only: output_1st_tstep_rst, first_kdt, nsout, &
frestart, restart_endfcst

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

Expand Down Expand Up @@ -221,7 +222,8 @@ module atmos_model_mod
logical,parameter :: flip_vc = .true.
#endif

real(kind=IPD_kind_phys), parameter :: zero=0.0, one=1.0
real(kind=IPD_kind_phys), parameter :: zero = 0.0_IPD_kind_phys, &
one = 1.0_IPD_kind_phys

contains

Expand Down Expand Up @@ -944,17 +946,19 @@ end subroutine update_atmos_model_state
subroutine atmos_model_end (Atmos)
type (atmos_data_type), intent(inout) :: Atmos
!---local variables
integer :: idx
integer :: idx, seconds
#ifdef CCPP
integer :: ierr
#endif

!-----------------------------------------------------------------------
!---- termination routine for atmospheric model ----

call atmosphere_end (Atmos % Time, Atmos%grid)
call FV3GFS_restart_write (IPD_Data, IPD_Restart, Atm_block, &
IPD_Control, Atmos%domain)
call atmosphere_end (Atmos % Time, Atmos%grid, restart_endfcst)
if(restart_endfcst) then
call FV3GFS_restart_write (IPD_Data, IPD_Restart, Atm_block, &
IPD_Control, Atmos%domain)
endif

#ifdef CCPP
! Fast physics (from dynamics) are finalized in atmosphere_end above;
Expand Down Expand Up @@ -1457,6 +1461,24 @@ subroutine update_atmos_chemistry(state, rc)
enddo
enddo

! -- zero out accumulated fields
!$OMP parallel do default (none) &
!$OMP shared (nj, ni, Atm_block, IPD_Control, IPD_Data) &
!$OMP private (j, jb, i, ib, nb, ix)
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)
IPD_Data(nb)%coupling%rainc_cpl(ix) = zero
if (.not.IPD_Control%cplflx) then
IPD_Data(nb)%coupling%rain_cpl(ix) = zero
IPD_Data(nb)%coupling%snow_cpl(ix) = zero
end if
enddo
enddo

if (IPD_Control%debug) then
! -- diagnostics
write(6,'("update_atmos: prsi - min/max/avg",3g16.6)') minval(prsi), maxval(prsi), sum(prsi)/size(prsi)
Expand Down
18 changes: 12 additions & 6 deletions fv3_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module fv3gfs_cap_mod
calendar, calendar_type, cpl, &
force_date_from_configure, &
cplprint_flag,output_1st_tstep_rst, &
first_kdt
first_kdt,num_restart_interval

use module_fv3_io_def, only: num_pes_fcst,write_groups,app_domain, &
num_files, filename_base, &
Expand Down Expand Up @@ -278,9 +278,16 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
CALL ESMF_ConfigLoadFile(config=CF ,filename='model_configure' ,rc=RC)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
!
CALL ESMF_ConfigGetAttribute(config=CF,value=restart_interval, &
label ='restart_interval:',rc=rc)
num_restart_interval = ESMF_ConfigGetLen(config=CF, label ='restart_interval:',rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
if(mype == 0) print *,'af nems config,num_restart_interval=',num_restart_interval
if (num_restart_interval<=0) num_restart_interval = 1
allocate(restart_interval(num_restart_interval))
restart_interval = 0
CALL ESMF_ConfigGetAttribute(CF,valueList=restart_interval,label='restart_interval:', &
count=num_restart_interval, rc=RC)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
if(mype == 0) print *,'af nems config,restart_interval=',restart_interval
!
CALL ESMF_ConfigGetAttribute(config=CF,value=calendar, &
label ='calendar:',rc=rc)
Expand Down Expand Up @@ -326,9 +333,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
label ='app_domain:',rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

if(mype == 0) print *,'af nems config,restart_interval=',restart_interval, &
'quilting=',quilting,'write_groups=',write_groups,wrttasks_per_group, &
'calendar=',trim(calendar),'calendar_type=',calendar_type
if(mype == 0) print *,'af nems config,quilting=',quilting,'write_groups=', &
write_groups,wrttasks_per_group,'calendar=',trim(calendar),'calendar_type=',calendar_type
!
CALL ESMF_ConfigGetAttribute(config=CF,value=num_files, &
label ='num_files:',rc=rc)
Expand Down
2 changes: 1 addition & 1 deletion gfsphysics/GFS_layer/GFS_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, &
call cires_ugwp_init(Model%me, Model%master, Model%nlunit, Init_parm%logunit, &
Model%fn_nml, Model%lonr, Model%latr, Model%levs, &
Init_parm%ak, Init_parm%bk, p_ref, Model%dtp, &
Model%cdmbgwd, Model%cgwf, Model%prslrd0, Model%ral_ts)
Model%cdmbgwd(1:2), Model%cgwf, Model%prslrd0, Model%ral_ts)
endif
#endif

Expand Down
8 changes: 6 additions & 2 deletions gfsphysics/GFS_layer/GFS_physics_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3184,9 +3184,13 @@ subroutine GFS_physics_driver &
dtdt(1:im,:) = Stateout%gt0(1:im,:)
endif ! end if_ldiag3d/cnvgwd

if (Model%ldiag3d) then
if (Model%ldiag3d .or. Model%cplchm) then
dqdt(1:im,:,1) = Stateout%gq0(1:im,:,1)
endif ! end if_ldiag3d
endif ! end if_ldiag3d/cplchm

if (Model%cplchm) then
Coupling%dqdti(1:im,:) = zero
endif ! end if_cplchm

#ifdef GFS_HYDRO
call get_phi(im, ix, levs, ntrac, Stateout%gt0, Stateout%gq0, &
Expand Down
38 changes: 30 additions & 8 deletions gfsphysics/GFS_layer/GFS_radiation_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2116,18 +2116,40 @@ subroutine GFS_radiation_driver &
Diag%fluxr(i,11-j) = Diag%fluxr(i,11-j) + tem0d * Statein%prsi(i,itop+kt)
Diag%fluxr(i,14-j) = Diag%fluxr(i,14-j) + tem0d * Statein%prsi(i,ibtc+kb)
Diag%fluxr(i,17-j) = Diag%fluxr(i,17-j) + tem0d * Statein%tgrs(i,itop)
enddo
enddo

! Anning adds optical depth and emissivity output
tem1 = 0.
tem2 = 0.
do k=ibtc,itop
tem1 = tem1 + cldtausw(i,k) ! approx .55 mu channel
tem2 = tem2 + cldtaulw(i,k) ! approx 10. mu channel
if (Model%lsswr .and. (nday > 0)) then
do j = 1, 3
do i = 1, IM
tem0d = raddt * cldsa(i,j)
itop = mtopa(i,j) - kd
ibtc = mbota(i,j) - kd
tem1 = 0.
do k=ibtc,itop
tem1 = tem1 + cldtausw(i,k) ! approx .55 um channel
enddo
Diag%fluxr(i,43-j) = Diag%fluxr(i,43-j) + tem0d * tem1
enddo
Diag%fluxr(i,43-j) = Diag%fluxr(i,43-j) + tem0d * tem1
Diag%fluxr(i,46-j) = Diag%fluxr(i,46-j) + tem0d * (1.0-exp(-tem2))
enddo
enddo
endif

if (Model%lslwr) then
do j = 1, 3
do i = 1, IM
tem0d = raddt * cldsa(i,j)
itop = mtopa(i,j) - kd
ibtc = mbota(i,j) - kd
tem2 = 0.
do k=ibtc,itop
tem2 = tem2 + cldtaulw(i,k) ! approx 10. um channel
enddo
Diag%fluxr(i,46-j) = Diag%fluxr(i,46-j) + tem0d * (1.0-exp(-tem2))
enddo
enddo
endif

endif

endif ! end_if_lssav
Expand Down
1 change: 1 addition & 0 deletions gfsphysics/physics/sflx.f
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ subroutine sflx &
runoff2 = 0.0
runoff3 = 0.0
snomlt = 0.0
rc = 0.0

! --- ... define local variable ice to achieve:
! sea-ice case, ice = 1
Expand Down
4 changes: 3 additions & 1 deletion gfsphysics/physics/ugwp_driver_v0.f
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ subroutine cires_ugwp_driver_v0(me, master,
&, rain

real(kind=kind_phys), intent(in), dimension(im,levs) :: ugrs
&, vgrs, tgrs, qgrs, prsi, prsl, prslk, phii, phil, del
&, vgrs, tgrs, qgrs, prsl, prslk, phil, del
real(kind=kind_phys), intent(in), dimension(im,levs+1) :: prsi
&, phii

! real(kind=kind_phys), intent(in) :: oro_stat(im,nmtvr)
real(kind=kind_phys), intent(in), dimension(im) :: hprime, oc
Expand Down
4 changes: 2 additions & 2 deletions io/FV3GFS_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ subroutine FV3GFS_restart_write (IPD_Data, IPD_Restart, Atm_block, Model, fv_dom
type(domain2d), intent(in) :: fv_domain
character(len=32), optional, intent(in) :: timestamp

!--- read in surface data from chgres
!--- write surface data from chgres
call sfc_prop_restart_write (IPD_Data%Sfcprop, Atm_block, Model, fv_domain, timestamp)

!--- read in physics restart data
!--- write physics restart data
call phys_restart_write (IPD_Restart, Atm_block, Model, fv_domain, timestamp)

end subroutine FV3GFS_restart_write
Expand Down
Loading