From 84ba585b4b811bc5228dbb97e004a2e05325db1e Mon Sep 17 00:00:00 2001 From: Philip Pegion Date: Tue, 5 May 2020 09:45:48 -0500 Subject: [PATCH 01/21] addition of cloud perts --- atmos_model.F90 | 7 ++- gfsphysics/GFS_layer/GFS_driver.F90 | 54 +++++++++++++------ gfsphysics/GFS_layer/GFS_physics_driver.F90 | 16 ++++-- gfsphysics/GFS_layer/GFS_radiation_driver.F90 | 42 +++++++++++++-- gfsphysics/GFS_layer/GFS_typedefs.F90 | 6 +++ gfsphysics/physics/radiation_surface.f | 2 +- 6 files changed, 100 insertions(+), 27 deletions(-) diff --git a/atmos_model.F90 b/atmos_model.F90 index 23e30e76c..c02b34abc 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -305,7 +305,8 @@ subroutine update_atmos_radiation_physics (Atmos) !--- call stochastic physics pattern generation / cellular automata if (IPD_Control%do_sppt .OR. IPD_Control%do_shum .OR. IPD_Control%do_skeb .OR. IPD_Control%do_sfcperts) then - call run_stochastic_physics(IPD_Control, IPD_Data(:)%Grid, IPD_Data(:)%Coupling, nthrds) + print*,'in atmos_model=',SIZE(IPD_Data(1)%Grid%xlat) + call run_stochastic_physics(IPD_Control, IPD_Data(:)%Grid, IPD_Data(:)%Coupling) end if if(IPD_Control%do_ca)then @@ -622,8 +623,10 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step) if (IPD_Control%do_sppt .OR. IPD_Control%do_shum .OR. IPD_Control%do_skeb .OR. IPD_Control%do_sfcperts) then ! Initialize stochastic physics - call init_stochastic_physics(IPD_Control, Init_parm, mpp_npes(), nthrds) + call init_stochastic_physics(IPD_Control, Init_parm, IPD_Data(:)%Grid) if(IPD_Control%me == IPD_Control%master) print *,'do_skeb=',IPD_Control%do_skeb + if(IPD_Control%me == IPD_Control%master) print *,'do_sppt=',IPD_Control%do_sppt + if(IPD_Control%me == IPD_Control%master) print *,'do_shum=',IPD_Control%do_shum end if #ifdef CCPP diff --git a/gfsphysics/GFS_layer/GFS_driver.F90 b/gfsphysics/GFS_layer/GFS_driver.F90 index 3b6a94336..cfdf38b44 100644 --- a/gfsphysics/GFS_layer/GFS_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_driver.F90 @@ -607,14 +607,14 @@ subroutine GFS_time_vary_step (Model, Statein, Stateout, Sfcprop, Coupling, & endif ! kludge for output - if (Model%do_skeb) then - do nb = 1,nblks - do k=1,Model%levs - Diag(nb)%skebu_wts(:,k) = Coupling(nb)%skebu_wts(:,Model%levs-k+1) - Diag(nb)%skebv_wts(:,k) = Coupling(nb)%skebv_wts(:,Model%levs-k+1) - enddo - enddo - endif + !if (Model%do_skeb) then + ! do nb = 1,nblks + ! do k=1,Model%levs + ! !Diag(nb)%skebu_wts(:,k) = Coupling(nb)%skebu_wts(:,Model%levs-k+1) + ! !Diag(nb)%skebv_wts(:,k) = Coupling(nb)%skebv_wts(:,Model%levs-k+1) + ! enddo + ! enddo + !endif !if (Model%do_sppt) then ! do nb = 1,nblks ! do k=1,Model%levs @@ -622,13 +622,13 @@ subroutine GFS_time_vary_step (Model, Statein, Stateout, Sfcprop, Coupling, & ! enddo ! enddo !endif - if (Model%do_shum) then - do nb = 1,nblks - do k=1,Model%levs - Diag(nb)%shum_wts(:,k)=Coupling(nb)%shum_wts(:,Model%levs-k+1) - enddo - enddo - endif + !if (Model%do_shum) then + ! do nb = 1,nblks + ! do k=1,Model%levs + ! Diag(nb)%shum_wts(:,k)=Coupling(nb)%shum_wts(:,Model%levs-k+1) + ! enddo + ! enddo + !endif end subroutine GFS_time_vary_step @@ -682,7 +682,7 @@ subroutine GFS_stochastic_driver (Model, Statein, Stateout, Sfcprop, Coupling, & type(GFS_diag_type), intent(inout) :: Diag #endif !--- local variables - integer :: k, i + integer :: k, i, l real(kind=kind_phys) :: upert, vpert, tpert, qpert, qnew,sppt_vwt !real(kind=kind_phys),dimension(size(Statein%tgrs,1),size(Statein%tgrs,2)) :: tconvtend, & ! qconvtend,uconvtend,vconvtend @@ -710,7 +710,7 @@ subroutine GFS_stochastic_driver (Model, Statein, Stateout, Sfcprop, Coupling, & if (Model%use_zmtnblck)then Coupling%sppt_wts(i,k)=(Coupling%sppt_wts(i,k)-1)*sppt_vwt+1.0 endif - Diag%sppt_wts(i,Model%levs-k+1)=Coupling%sppt_wts(i,k) + Diag%sppt_wts(i,k)=Coupling%sppt_wts(i,k) ! if(Model%isppt_deep)then @@ -744,6 +744,16 @@ subroutine GFS_stochastic_driver (Model, Statein, Stateout, Sfcprop, Coupling, & Stateout%gq0(i,k,1) = qnew Stateout%gt0(i,k) = Statein%tgrs(i,k) + tpert + Tbd%dtdtr(i,k) endif + if (Model%pert_mp) then + do l=1,Model%ncld + qpert = (Stateout%gq0(i,k,l+1) - Statein%qgrs(i,k,l+1)) * Coupling%sppt_wts(i,k) + qnew = Statein%qgrs(i,k,l+1)+qpert + Stateout%gq0(i,k,l+1) = qnew + if (qnew < 0.0) then + Stateout%gq0(i,k,l+1) = 0.0 + endif + enddo + endif enddo enddo @@ -776,6 +786,10 @@ subroutine GFS_stochastic_driver (Model, Statein, Stateout, Sfcprop, Coupling, & if (Model%cplflx) then Coupling%rain_cpl(:) = Coupling%rain_cpl(:) + (Coupling%sppt_wts(:,15) - 1.0)*Tbd%drain_cpl(:) Coupling%snow_cpl(:) = Coupling%snow_cpl(:) + (Coupling%sppt_wts(:,15) - 1.0)*Tbd%dsnow_cpl(:) + do i = 1,size(Statein%tgrs,1) + if (Coupling%rain_cpl(i) .LT. 0.0) Coupling%rain_cpl(i)=0.0 + if (Coupling%snow_cpl(i) .LT. 0.0) Coupling%snow_cpl(i)=0.0 + enddo endif !endif @@ -783,11 +797,17 @@ subroutine GFS_stochastic_driver (Model, Statein, Stateout, Sfcprop, Coupling, & endif if (Model%do_shum) then + Diag%shum_wts(:,:)=Coupling%shum_wts(:,:) + Stateout%gq0(:,:,1) = Stateout%gq0(:,:,1)*(1.0 + Coupling%shum_wts(:,:)) Stateout%gq0(:,:,1) = Stateout%gq0(:,:,1)*(1.0 + Coupling%shum_wts(:,:)) endif if (Model%do_skeb) then do k = 1,size(Statein%tgrs,2) + do i = 1,size(Statein%tgrs,1) + Diag%skebu_wts(i,k)=Coupling%skebu_wts(i,k) + Diag%skebv_wts(i,k)=Coupling%skebv_wts(i,k) + enddo Stateout%gu0(:,k) = Stateout%gu0(:,k)+Coupling%skebu_wts(:,k)*(Statein%diss_est(:,k)) Stateout%gv0(:,k) = Stateout%gv0(:,k)+Coupling%skebv_wts(:,k)*(Statein%diss_est(:,k)) ! print*,'in do skeb',Coupling%skebu_wts(1,k),Statein%diss_est(1,k) diff --git a/gfsphysics/GFS_layer/GFS_physics_driver.F90 b/gfsphysics/GFS_layer/GFS_physics_driver.F90 index 5b67f7faa..2ecf9ce74 100644 --- a/gfsphysics/GFS_layer/GFS_physics_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_physics_driver.F90 @@ -1430,11 +1430,21 @@ subroutine GFS_physics_driver & adjnirbmd, adjnirdfd, adjvisbmd, adjvisdfd & ) + endif ! -! save temp change due to radiation - need for sttp stochastic physics +! save temp change due to radiation - need for sppt stochastic physics !--------------------------------------------------------------------- - endif ! + + if (Model%do_sppt) then + if (Model%pert_radtend) then +!--- cloudy radiation heating rate + Tbd%dtdtr(1:im,:) = dtdtc(1:im,:)*dtf + else + Tbd%dtdtr(1:im,:) = dtdt(1:im,:)*dtf + endif + endif + if (Model%lsidea) then !idea jw dtdt(:,:) = zero endif @@ -5234,8 +5244,6 @@ subroutine GFS_physics_driver & ! endif if (Model%do_sppt) then -!--- radiation heating rate - Tbd%dtdtr(1:im,:) = Tbd%dtdtr(1:im,:) + dtdtc(1:im,:)*dtf do i = 1, im if (t850(i) > 273.16) then !--- change in change in rain precip diff --git a/gfsphysics/GFS_layer/GFS_radiation_driver.F90 b/gfsphysics/GFS_layer/GFS_radiation_driver.F90 index c7323d6bb..8ad9ad218 100644 --- a/gfsphysics/GFS_layer/GFS_radiation_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_radiation_driver.F90 @@ -329,7 +329,7 @@ module module_radiation_driver ! & aer_init, aer_update, & & NSPC1 use module_radiation_surface, only: NF_ALBD, sfc_init, setalb, & - & setemis + & setemis,ppfbet use module_radiation_clouds, only: NF_CLDS, cld_init, & & progcld1, progcld2, & & progcld3, progcld4, & @@ -1240,12 +1240,16 @@ subroutine GFS_radiation_driver & real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levr+ltp,min(4,Model%ncnd)) :: ccnd ! mg, sfc perts - real(kind=kind_phys), dimension(size(Grid%xlon,1)) :: alb1d + real(kind=kind_phys), dimension(size(Grid%xlon,1)) :: alb1d,cldp1d real(kind=kind_phys) :: cdfz real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levr+ltp) :: cldtausw real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levr+ltp) :: cldtaulw + real (kind=kind_phys) :: alpha,beta,m,s,cldtmp,tmp_wt + real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levr+ltp) :: cldcovp + integer :: iflag + !--- TYPED VARIABLES type (cmpfsw_type), dimension(size(Grid%xlon,1)) :: scmpsw @@ -1788,10 +1792,42 @@ subroutine GFS_radiation_driver & cldcov, dz, delp, im, lmk, lmp, & clouds, cldsa, mtopa, mbota, de_lgth) ! --- outputs else + if (Model%pert_clds) then + cldp1d(:) = 0. + do i=1,im + tmp_wt= -1*log( ( 2.0 / ( Coupling%sppt_wts(i,38) ) ) - 1 ) + call cdfnor(tmp_wt,cdfz) + cldp1d(i) = cdfz + !Diag%shum_wts(i,1)=cldp1d(i) ! debug diagnostic + enddo + do i = 1, IM + do k = 1, LM + ! compute beta distribution parameters + m = cldcov(i,k+kd) + if (m<0.99) then + s = Model%sppt_amp*m*(1.-m) + alpha = m*m*(1.-m)/(s*s)-m + beta = alpha*(1.-m)/m + ! compute beta distribution value corresponding + ! to the given percentile albPpert to use as new albedo + call ppfbet(cldp1d(i),alpha,beta,iflag,cldtmp) + cldcovp(i,k+kd) = cldtmp + !Diag%skebu_wts(i,k)=cldtmp !debug diagnostic + !Diag%skebv_wts(i,k)=cldcov(i,k+kd) !debug diagnostic + else + cldcovp(i,k+kd) = m + !Diag%skebu_wts(i,k)=m + !Coupling%skebv_wts(i,k)=cldcov(i,k+kd) !debug diagnostic + endif + enddo ! end_do_i_loop + enddo ! end_do_k_loop + else + cldcovp=cldcov + endif call progclduni (plyr, plvl, tlyr, tvly, ccnd, ncndl, &! --- inputs Grid%xlat, Grid%xlon, Sfcprop%slmsk, dz,delp,& - IM, LMK, LMP, cldcov, & + IM, LMK, LMP, cldcovp, & effrl, effri, effrr, effrs, Model%effr_in, & clouds, cldsa, mtopa, mbota, de_lgth) ! --- outputs ! call progcld4o (plyr, plvl, tlyr, tvly, qlyr, qstl, rhly, & ! --- inputs diff --git a/gfsphysics/GFS_layer/GFS_typedefs.F90 b/gfsphysics/GFS_layer/GFS_typedefs.F90 index 39520b0d4..696d7144a 100644 --- a/gfsphysics/GFS_layer/GFS_typedefs.F90 +++ b/gfsphysics/GFS_layer/GFS_typedefs.F90 @@ -929,6 +929,9 @@ module GFS_typedefs logical :: use_zmtnblck logical :: do_shum logical :: do_skeb + logical :: pert_clds + logical :: pert_mp + logical :: pert_radtend integer :: skeb_npass logical :: do_sfcperts integer :: nsfcpert=6 @@ -938,6 +941,7 @@ module GFS_typedefs real(kind=kind_phys) :: pertlai(5) ! mg, sfc-perts real(kind=kind_phys) :: pertalb(5) ! mg, sfc-perts real(kind=kind_phys) :: pertvegf(5) ! mg, sfc-perts + real(kind=kind_phys) :: sppt_amp ! pjp cloud perturbations !--- tracer handling character(len=32), pointer :: tracer_names(:) !< array of initialized tracers from dynamic core integer :: ntrac !< number of tracers @@ -2524,6 +2528,7 @@ subroutine coupling_create (Coupling, IM, Model) endif !--- stochastic shum option + if (Model%me.EQ.0) print*,'allocating shum_wts',Model%do_shum if (Model%do_shum) then allocate (Coupling%shum_wts (IM,Model%levs)) Coupling%shum_wts = clear_val @@ -5025,6 +5030,7 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%skebv_wts(IM,Model%levs)) allocate (Diag%sppt_wts(IM,Model%levs)) allocate (Diag%shum_wts(IM,Model%levs)) + if (Model%me.EQ.0) print*,'diag allocating shum_wts' allocate (Diag%zmtnblck(IM)) allocate (Diag%ca_out (IM)) diff --git a/gfsphysics/physics/radiation_surface.f b/gfsphysics/physics/radiation_surface.f index e02ea32b9..e68201a0f 100644 --- a/gfsphysics/physics/radiation_surface.f +++ b/gfsphysics/physics/radiation_surface.f @@ -120,7 +120,7 @@ module module_radiation_surface ! !> global surface emissivity contrl flag set up in 'sfc_init' integer :: iemslw = 0 ! - public sfc_init, setalb, setemis + public sfc_init, setalb, setemis, ppfbet ! ================= contains From 7a30acc9820522a4b08d3a4d4f07411e54f73c10 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Wed, 2 Dec 2020 19:03:51 +0000 Subject: [PATCH 02/21] update submodule pointer to my fork --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index d253f6966..4da46575d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,5 +8,5 @@ branch = master [submodule "ccpp/physics"] path = ccpp/physics - url = https://github.com/NCAR/ccpp-physics - branch = master + url = https://github.com/pjpegion/ccpp-physics + branch = pert_clds_mp From 80af57f3d8dc583c97d6ac21fcc4be72023f51d7 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Mon, 14 Dec 2020 15:31:38 +0000 Subject: [PATCH 03/21] add temporary diagnostic for land perts --- CMakeLists.txt | 1 + atmos_model.F90 | 4 ++- ccpp/physics | 2 +- coupler_main.F90 | 2 ++ gfsphysics/GFS_layer/GFS_diagnostics.F90 | 22 +++++++++++++ gfsphysics/GFS_layer/GFS_typedefs.F90 | 8 ++++- gfsphysics/GFS_layer/GFS_typedefs.meta | 13 ++++++++ makefile | 2 +- module_fcst_grid_comp.F90 | 2 ++ .../stochastic_physics_wrapper.F90 | 33 ++++++++++--------- 10 files changed, 70 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5013e53e..766290b6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,6 +178,7 @@ if(CCPP) target_link_libraries(fv3atm PUBLIC ccppdriver ccppphys ccpp) endif() target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/stochastic_physics) +target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../stochastic_physics) target_compile_definitions(fv3atm PRIVATE "${_fv3atm_defs_private}") target_link_libraries(fv3atm PUBLIC fv3dycore diff --git a/atmos_model.F90 b/atmos_model.F90 index f61735eb8..899f3aa02 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -951,6 +951,7 @@ end subroutine update_atmos_model_state ! subroutine atmos_model_end (Atmos) + use get_stochy_pattern_mod, only: write_stoch_restart_atm type (atmos_data_type), intent(inout) :: Atmos !---local variables integer :: idx, seconds @@ -963,12 +964,13 @@ subroutine atmos_model_end (Atmos) call atmosphere_end (Atmos % Time, Atmos%grid, restart_endfcst) - call stochastic_physics_wrapper_end(IPD_Control) if(restart_endfcst) then call FV3GFS_restart_write (IPD_Data, IPD_Restart, Atm_block, & IPD_Control, Atmos%domain) + call write_stoch_restart_atm('RESTART/atm_stoch.res.nc') endif + call stochastic_physics_wrapper_end(IPD_Control) #ifdef CCPP ! Fast physics (from dynamics) are finalized in atmosphere_end above; diff --git a/ccpp/physics b/ccpp/physics index 4e39b50a2..ac42e80f6 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 4e39b50a248fc093c055fc6a8ae245065da7c730 +Subproject commit ac42e80f60d89ebca802a159abda6ee7c1f6f954 diff --git a/coupler_main.F90 b/coupler_main.F90 index 3f36fb550..58a7ff281 100644 --- a/coupler_main.F90 +++ b/coupler_main.F90 @@ -66,6 +66,7 @@ program coupler_main get_base_date, diag_manager_set_time_end use data_override_mod, only: data_override_init +use get_stochy_pattern_mod, only: write_stoch_restart_atm implicit none @@ -158,6 +159,7 @@ program coupler_main if ((nc /= num_cpld_calls) .and. (Time_atmos == Time_restart)) then timestamp = date_to_string (Time_restart) call atmos_model_restart(Atm, timestamp) + call write_stoch_restart_atm('RESTART/'//trim(timestamp)//'.atm_stoch.res.nc') call coupler_res(timestamp) Time_restart = Time_restart + Time_step_restart endif diff --git a/gfsphysics/GFS_layer/GFS_diagnostics.F90 b/gfsphysics/GFS_layer/GFS_diagnostics.F90 index a289df88a..48f366930 100644 --- a/gfsphysics/GFS_layer/GFS_diagnostics.F90 +++ b/gfsphysics/GFS_layer/GFS_diagnostics.F90 @@ -2037,6 +2037,28 @@ subroutine GFS_externaldiag_populate (ExtDiag, Model, Statein, Stateout, Sfcprop ExtDiag(idx)%data(nb)%var3 => IntDiag(nb)%shum_wts(:,:) enddo + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'sfc_wts1' + ExtDiag(idx)%desc = 'perturbation amplitude' + ExtDiag(idx)%unit = 'none' + ExtDiag(idx)%mod_name = 'gfs_phys' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%sfc_wts(:,1) + enddo + + idx = idx + 1 + ExtDiag(idx)%axes = 2 + ExtDiag(idx)%name = 'sfc_wts2' + ExtDiag(idx)%desc = 'perturbation amplitude' + ExtDiag(idx)%unit = 'none' + ExtDiag(idx)%mod_name = 'gfs_phys' + allocate (ExtDiag(idx)%data(nblks)) + do nb = 1,nblks + ExtDiag(idx)%data(nb)%var2 => IntDiag(nb)%sfc_wts(:,2) + enddo + idx = idx + 1 ExtDiag(idx)%axes = 2 ExtDiag(idx)%name = 'ca1' diff --git a/gfsphysics/GFS_layer/GFS_typedefs.F90 b/gfsphysics/GFS_layer/GFS_typedefs.F90 index 86aec9420..fac1c9a95 100644 --- a/gfsphysics/GFS_layer/GFS_typedefs.F90 +++ b/gfsphysics/GFS_layer/GFS_typedefs.F90 @@ -1099,6 +1099,7 @@ module GFS_typedefs !--- stochastic physics control parameters logical :: do_sppt + logical :: do_pertmp logical :: use_zmtnblck logical :: do_shum logical :: do_skeb @@ -1597,6 +1598,7 @@ module GFS_typedefs real (kind=kind_phys), pointer :: skebv_wts(:,:) => null() !< 10 meter v wind speed real (kind=kind_phys), pointer :: sppt_wts(:,:) => null() !< real (kind=kind_phys), pointer :: shum_wts(:,:) => null() !< + real (kind=kind_phys), pointer :: sfc_wts(:,:) => null() !< real (kind=kind_phys), pointer :: zmtnblck(:) => null() ! null() !< u momentum change due to physics real (kind=kind_phys), pointer :: dv3dt (:,:,:) => null() !< v momentum change due to physics @@ -3458,6 +3460,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- stochastic physics control parameters logical :: do_sppt = .false. + logical :: do_pertmp = .false. logical :: use_zmtnblck = .false. logical :: do_shum = .false. logical :: do_skeb = .false. @@ -3548,7 +3551,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & do_deep, jcap, & cs_parm, flgmin, cgwf, ccwf, cdmbgwd, sup, ctei_rm, crtrh, & dlqf, rbcr, shoc_parm, psauras, prauras, wminras, & - do_sppt, do_shum, do_skeb, lndp_type, n_var_lndp, & + do_sppt, do_pertmp, do_shum, do_skeb, lndp_type, n_var_lndp,& !--- Rayleigh friction prslrd0, ral_ts, ldiag_ugwp, do_ugwp, do_tofd, & ! --- Ferrier-Aligo @@ -4202,6 +4205,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & ! physics that are parsed here and then compared in init_stochastic_physics ! to the stochastic physics namelist parametersto ensure consistency. Model%do_sppt = do_sppt + Model%do_pertmp = do_pertmp Model%use_zmtnblck = use_zmtnblck Model%do_shum = do_shum Model%do_skeb = do_skeb @@ -5303,6 +5307,7 @@ subroutine control_print(Model) print *, ' ' print *, 'stochastic physics' print *, ' do_sppt : ', Model%do_sppt + print *, ' do_pertmp : ', Model%do_pertmp print *, ' do_shum : ', Model%do_shum print *, ' do_skeb : ', Model%do_skeb print *, ' lndp_type : ', Model%lndp_type @@ -5832,6 +5837,7 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%skebv_wts(IM,Model%levs)) allocate (Diag%sppt_wts(IM,Model%levs)) allocate (Diag%shum_wts(IM,Model%levs)) + allocate (Diag%sfc_wts(IM,Model%n_var_lndp)) if (Model%me.EQ.0) print*,'diag allocating shum_wts' allocate (Diag%zmtnblck(IM)) allocate (Diag%ca1 (IM)) diff --git a/gfsphysics/GFS_layer/GFS_typedefs.meta b/gfsphysics/GFS_layer/GFS_typedefs.meta index 84e447237..a5652434b 100644 --- a/gfsphysics/GFS_layer/GFS_typedefs.meta +++ b/gfsphysics/GFS_layer/GFS_typedefs.meta @@ -4131,6 +4131,12 @@ units = flag dimensions = () type = logical +[do_pertmp] + standard_name = flag_for_stochastic_microphysics_perturbations + long_name = flag for stochastic microphysics perturbations + units = flag + dimensions = () + type = logical [use_zmtnblck] standard_name = flag_for_mountain_blocking long_name = flag for mountain blocking @@ -6401,6 +6407,13 @@ dimensions = (horizontal_loop_extent,vertical_dimension) type = real kind = kind_phys +[sfc_wts] + standard_name = weights_for_stochastic_surface_physics_perturbation_flipped + long_name = weights for stochastic surface physics perturbation, flipped + units = none + dimensions = (horizontal_loop_extent,number_of_land_surface_variables_perturbed) + type = real + kind = kind_phys [zmtnblck] standard_name = level_of_dividing_streamline long_name = level of the dividing streamline diff --git a/makefile b/makefile index 4191b4777..6b89a1478 100644 --- a/makefile +++ b/makefile @@ -12,7 +12,7 @@ ifeq ($(strip $(exist)),) endif -FFLAGS += -I$(FMS_DIR) -Igfsphysics -Iipd -Icpl -Iio -Iatmos_cubed_sphere -Iccpp/driver -Istochastic_physics +FFLAGS += -I$(FMS_DIR) -Igfsphysics -Iipd -Icpl -Iio -Iatmos_cubed_sphere -Iccpp/driver -Istochastic_physics -I../stochastic_physics CPPDEFS += -DESMF_VERSION_MAJOR=$(ESMF_VERSION_MAJOR) # Flag to CCPP build for 32bit dynamics diff --git a/module_fcst_grid_comp.F90 b/module_fcst_grid_comp.F90 index 7742eefbc..fe2bb60b1 100644 --- a/module_fcst_grid_comp.F90 +++ b/module_fcst_grid_comp.F90 @@ -73,6 +73,7 @@ module module_fcst_grid_comp quilting, calendar_type, cpl, & cplprint_flag, force_date_from_configure, & num_restart_interval, frestart, restart_endfcst + use get_stochy_pattern_mod, only: write_stoch_restart_atm ! !----------------------------------------------------------------------- ! @@ -827,6 +828,7 @@ subroutine fcst_run_phase_2(fcst_comp, importState, exportState,clock,rc) atm_int_state%Time_restart = atm_int_state%Time_atstart + restart_inctime timestamp = date_to_string (atm_int_state%Time_restart) call atmos_model_restart(atm_int_state%Atm, timestamp) + call write_stoch_restart_atm('RESTART/'//trim(timestamp)//'.atm_stoch.res.nc') call wrt_atmres_timestamp(atm_int_state,timestamp) endif diff --git a/stochastic_physics/stochastic_physics_wrapper.F90 b/stochastic_physics/stochastic_physics_wrapper.F90 index 5a3701aa8..558dd774f 100644 --- a/stochastic_physics/stochastic_physics_wrapper.F90 +++ b/stochastic_physics/stochastic_physics_wrapper.F90 @@ -81,9 +81,15 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) initalize_stochastic_physics: if (GFS_Control%kdt==0) then if (GFS_Control%do_sppt .OR. GFS_Control%do_shum .OR. GFS_Control%do_skeb .OR. (GFS_Control%lndp_type .GT. 0) ) then + allocate(xlat(1:Atm_block%nblks,maxval(GFS_Control%blksz))) + allocate(xlon(1:Atm_block%nblks,maxval(GFS_Control%blksz))) + do nb=1,Atm_block%nblks + xlat(nb,1:GFS_Control%blksz(nb)) = GFS_Data(nb)%Grid%xlat(:) + xlon(nb,1:GFS_Control%blksz(nb)) = GFS_Data(nb)%Grid%xlon(:) + end do ! Initialize stochastic physics call init_stochastic_physics(GFS_Control%levs, GFS_Control%blksz, GFS_Control%dtp, & - GFS_Control%input_nml_file, GFS_Control%fn_nml, GFS_Control%nlunit, GFS_Control%do_sppt, GFS_Control%do_shum, & + GFS_Control%input_nml_file, GFS_Control%fn_nml, GFS_Control%nlunit, xlon, xlat, GFS_Control%do_sppt, GFS_Control%do_shum, & GFS_Control%do_skeb, GFS_Control%lndp_type, GFS_Control%n_var_lndp, GFS_Control%use_zmtnblck, GFS_Control%skeb_npass, & GFS_Control%lndp_var_list, GFS_Control%lndp_prt_list, & GFS_Control%ak, GFS_Control%bk, nthreads, GFS_Control%master, GFS_Control%communicator, ierr) @@ -92,8 +98,6 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) return endif end if - allocate(xlat(1:Atm_block%nblks,maxval(GFS_Control%blksz))) - allocate(xlon(1:Atm_block%nblks,maxval(GFS_Control%blksz))) if (GFS_Control%do_sppt) then allocate(sppt_wts(1:Atm_block%nblks,maxval(GFS_Control%blksz),1:GFS_Control%levs)) end if @@ -115,17 +119,13 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) allocate(vfrac(1:Atm_block%nblks,maxval(GFS_Control%blksz))) endif - do nb=1,Atm_block%nblks - xlat(nb,1:GFS_Control%blksz(nb)) = GFS_Data(nb)%Grid%xlat(:) - xlon(nb,1:GFS_Control%blksz(nb)) = GFS_Data(nb)%Grid%xlon(:) - end do if ( GFS_Control%lndp_type .EQ. 1 ) then ! this scheme sets perts once allocate(sfc_wts(1:Atm_block%nblks,maxval(GFS_Control%blksz),GFS_Control%n_var_lndp)) - call run_stochastic_physics(GFS_Control%levs, GFS_Control%kdt, GFS_Control%phour, GFS_Control%blksz, xlat=xlat, xlon=xlon, & + call run_stochastic_physics(GFS_Control%levs, GFS_Control%kdt, GFS_Control%fhour, GFS_Control%blksz, & sppt_wts=sppt_wts, shum_wts=shum_wts, skebu_wts=skebu_wts, skebv_wts=skebv_wts, sfc_wts=sfc_wts, & nthreads=nthreads) - ! Copy contiguous data back; no need to copy xlat/xlon, these are intent(in) - just deallocate + ! Copy contiguous data back do nb=1,Atm_block%nblks GFS_Data(nb)%Coupling%sfc_wts(:,:) = sfc_wts(nb,1:GFS_Control%blksz(nb),:) end do @@ -142,12 +142,11 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) endif else initalize_stochastic_physics - if (GFS_Control%do_sppt .OR. GFS_Control%do_shum .OR. GFS_Control%do_skeb .OR. (GFS_Control%lndp_type .EQ. 2) ) then - call run_stochastic_physics(GFS_Control%levs, GFS_Control%kdt, GFS_Control%phour, GFS_Control%blksz, xlat=xlat, xlon=xlon, & + call run_stochastic_physics(GFS_Control%levs, GFS_Control%kdt, GFS_Control%fhour, GFS_Control%blksz, & sppt_wts=sppt_wts, shum_wts=shum_wts, skebu_wts=skebu_wts, skebv_wts=skebv_wts, sfc_wts=sfc_wts, & nthreads=nthreads) - ! Copy contiguous data back; no need to copy xlat/xlon, these are intent(in) - just deallocate + ! Copy contiguous data back if (GFS_Control%do_sppt) then do nb=1,Atm_block%nblks GFS_Data(nb)%Coupling%sppt_wts(:,:) = sppt_wts(nb,1:GFS_Control%blksz(nb),:) @@ -178,14 +177,18 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) end do ! determine whether land paramaters have been over-written - if (mod(GFS_Control%kdt,GFS_Control%nscyc) == 1) then ! logic copied from GFS_driver + if (GFS_Control%nscyc> 1) then ! logic copied from GFS_driver + if (mod(GFS_Control%kdt,GFS_Control%nscyc) == 1) then ! logic copied from GFS_driver param_update_flag = .true. - else + else param_update_flag = .false. + endif + else + param_update_flag = .false. endif call lndp_apply_perts( GFS_Control%blksz, GFS_Control%lsm, GFS_Control%lsoil, GFS_Control%dtf, & GFS_Control%n_var_lndp, GFS_Control%lndp_var_list, GFS_Control%lndp_prt_list, & - sfc_wts, xlon, xlat, stype, maxsmc,param_update_flag, smc, slc,stc, vfrac, ierr) + sfc_wts, stype, maxsmc,param_update_flag, smc, slc,stc, vfrac, ierr) if (ierr/=0) then write(6,*) 'call to GFS_apply_lndp failed' return From 4b8ed3d6e922a9e690e851d329792d61e65bdf88 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Mon, 14 Dec 2020 15:45:42 +0000 Subject: [PATCH 04/21] update submodules --- ccpp/framework | 2 +- ccpp/physics | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ccpp/framework b/ccpp/framework index f1dc8d6f0..e5a69bbb7 160000 --- a/ccpp/framework +++ b/ccpp/framework @@ -1 +1 @@ -Subproject commit f1dc8d6f038e590508c272070f673d1fd7ea566f +Subproject commit e5a69bbb71c6744ce14403f8437ba2c0b741dcd9 diff --git a/ccpp/physics b/ccpp/physics index ac42e80f6..6782e0e00 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit ac42e80f60d89ebca802a159abda6ee7c1f6f954 +Subproject commit 6782e0e006083c210663adc8c73ef21b37bb5bb7 From 4fcfc4eee363dd489a9fac3f88f35e958eca2108 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Tue, 22 Dec 2020 18:37:09 +0000 Subject: [PATCH 05/21] modifictations to CMakelists, still not building properly --- CMakeLists.txt | 4 +- CMakeLists.txt.good_for_coupled | 217 ++++++++++++++++++++++++++++++++ 2 files changed, 219 insertions(+), 2 deletions(-) create mode 100644 CMakeLists.txt.good_for_coupled diff --git a/CMakeLists.txt b/CMakeLists.txt index 766290b6c..deaa9b654 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,8 +184,8 @@ target_compile_definitions(fv3atm PRIVATE "${_fv3atm_defs_private}") target_link_libraries(fv3atm PUBLIC fv3dycore cpl io - stochastic_physics stochastic_physics_wrapper) +# stochastic_physics target_link_libraries(fv3atm PUBLIC nemsio::nemsio w3emc::w3emc_d @@ -206,7 +206,7 @@ endif() ### Install ############################################################################### install( - TARGETS fv3atm fv3dycore io ipd gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics stochastic_physics_wrapper + TARGETS fv3atm fv3dycore io ipd gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics_wrapper EXPORT fv3atm-config LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) diff --git a/CMakeLists.txt.good_for_coupled b/CMakeLists.txt.good_for_coupled new file mode 100644 index 000000000..6df71eff5 --- /dev/null +++ b/CMakeLists.txt.good_for_coupled @@ -0,0 +1,217 @@ +if(CCPP) + + if(DEBUG) + set(_ccpp_debug_arg "--debug") + endif() + if(DEFINED CCPP_SUITES) + set(_ccpp_suites_arg "--suites=${CCPP_SUITES}") + message("Calling CCPP code generator (ccpp_prebuild.py) for suites ${_ccpp_suites_arg} ...") + else() + message("Calling CCPP code generator (ccpp_prebuild.py) for all available suites ...") + endif() + execute_process(COMMAND ${Python_EXECUTABLE} + "ccpp/framework/scripts/ccpp_prebuild.py" + "--config=ccpp/config/ccpp_prebuild_config.py" + "--builddir=${CMAKE_CURRENT_BINARY_DIR}" ${_ccpp_suites_arg} ${_ccpp_debug_arg} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/ccpp_prebuild.out + ERROR_FILE ${CMAKE_CURRENT_BINARY_DIR}/ccpp_prebuild.err + RESULT_VARIABLE RC) + # Check return code from ccpp_prebuild.py + if(NOT RC EQUAL 0) + message(FATAL_ERROR "An error occured while running ccpp_prebuild.py, check ${CMAKE_CURRENT_BINARY_DIR}/ccpp_prebuild.{out,err}") + endif() + # this should not be necessary; including CCPP_*.cmake here and passing + # SCHEMES, CAPS and TYPEDEFS via environment variables to CCPP build. + # CCPP should be able to directly include those three .cmake files. + include(${CMAKE_CURRENT_BINARY_DIR}/ccpp/physics/CCPP_SCHEMES.cmake) + include(${CMAKE_CURRENT_BINARY_DIR}/ccpp/physics/CCPP_CAPS.cmake) + include(${CMAKE_CURRENT_BINARY_DIR}/ccpp/physics/CCPP_TYPEDEFS.cmake) + set(ENV{CCPP_SCHEMES} "${SCHEMES}") + set(ENV{CCPP_CAPS} "${CAPS}") + set(ENV{CCPP_TYPEDEFS} "${TYPEDEFS}") + +endif() + +add_subdirectory(cpl) +add_subdirectory(gfsphysics) +add_subdirectory(ipd) +add_subdirectory(io) + +############################################################################### +### fv3dycore +############################################################################### +list(APPEND _fv3dycore_srcs + atmos_cubed_sphere/model/a2b_edge.F90 + atmos_cubed_sphere/model/multi_gases.F90 + atmos_cubed_sphere/model/boundary.F90 + atmos_cubed_sphere/model/dyn_core.F90 + atmos_cubed_sphere/model/fv_arrays.F90 + atmos_cubed_sphere/model/fv_control.F90 + atmos_cubed_sphere/model/fv_dynamics.F90 + atmos_cubed_sphere/model/fv_fill.F90 + atmos_cubed_sphere/model/fv_grid_utils.F90 + atmos_cubed_sphere/model/fv_mapz.F90 + atmos_cubed_sphere/model/fv_nesting.F90 + atmos_cubed_sphere/model/fv_regional_bc.F90 + atmos_cubed_sphere/model/fv_sg.F90 + atmos_cubed_sphere/model/fv_tracer2d.F90 + atmos_cubed_sphere/model/fv_update_phys.F90 + atmos_cubed_sphere/model/sw_core.F90 + atmos_cubed_sphere/model/tp_core.F90 + atmos_cubed_sphere/model/nh_core.F90 + atmos_cubed_sphere/model/nh_utils.F90 + atmos_cubed_sphere/tools/external_ic.F90 + atmos_cubed_sphere/tools/external_sst.F90 + atmos_cubed_sphere/tools/fv_diagnostics.F90 + atmos_cubed_sphere/tools/fv_eta.F90 + atmos_cubed_sphere/tools/fv_grid_tools.F90 + atmos_cubed_sphere/tools/fv_io.F90 + atmos_cubed_sphere/tools/fv_mp_mod.F90 + atmos_cubed_sphere/tools/fv_nudge.F90 + atmos_cubed_sphere/tools/fv_treat_da_inc.F90 + atmos_cubed_sphere/tools/fv_iau_mod.F90 + atmos_cubed_sphere/tools/fv_restart.F90 + atmos_cubed_sphere/tools/fv_surf_map.F90 + atmos_cubed_sphere/tools/fv_timing.F90 + atmos_cubed_sphere//tools/init_hydro.F90 + atmos_cubed_sphere/tools/sim_nc_mod.F90 + atmos_cubed_sphere/tools/sorted_index.F90 + atmos_cubed_sphere/tools/test_cases.F90 + atmos_cubed_sphere/driver/fvGFS/DYCORE_typedefs.F90 + atmos_cubed_sphere/driver/fvGFS/fv_nggps_diag.F90 + atmos_cubed_sphere/driver/fvGFS/atmosphere.F90) + +if(NOT CCPP) + list(APPEND _fv3dycore_srcs atmos_cubed_sphere/model/fv_cmp.F90) +endif() + +add_library(fv3dycore ${_fv3dycore_srcs}) + +list(APPEND _fv3dycore_defs_private SPMD + use_WRTCOMP + GFS_PHYS + USE_GFSL63 + MOIST_CAPPA + USE_COND) + +if(MULTI_GASES) + list(APPEND _fv3dycore_defs_private MULTI_GASES) +endif() + +if(32BIT) + list(APPEND _fv3dycore_defs_private OVERLOAD_R4 + OVERLOAD_R8) +endif() + +if(CCPP) + list(APPEND _fv3dycore_defs_private CCPP) +endif() + +if(OpenMP_Fortran_FOUND) + list(APPEND _fv3dycore_defs_private OPENMP) +endif() + +set_property(SOURCE atmos_cubed_sphere/model/nh_utils.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FAST}") +set_property(SOURCE atmos_cubed_sphere/model/fv_mapz.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FAST}") + +set_target_properties(fv3dycore PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) + +target_compile_definitions(fv3dycore PRIVATE "${_fv3dycore_defs_private}") +target_include_directories(fv3dycore PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/atmos_cubed_sphere) +target_include_directories(fv3dycore INTERFACE $ + $) + +target_link_libraries(fv3dycore PUBLIC fms + gfsphysics + ipd + esmf) +if(OpenMP_Fortran_FOUND) + target_link_libraries(fv3dycore PUBLIC OpenMP::OpenMP_Fortran) +endif() + +############################################################################### +### ccpp +############################################################################### +if(CCPP) + add_subdirectory(ccpp) + add_subdirectory(ccpp/driver) + add_dependencies(gfsphysics ccpp ccppphys) + add_dependencies(ccppdriver ccpp ccppphys) + add_dependencies(ccppphys ccpp) + target_include_directories(fv3dycore PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/ccpp/framework/src + ${CMAKE_CURRENT_BINARY_DIR}/ccpp/driver) + target_link_libraries(ccppphys PRIVATE sp::sp_d + w3nco::w3nco_d) +endif() + +############################################################################### +### stochastic_physics +############################################################################### +# When specifying an out-of-tree source a binary directory must be explicitly specified. +#add_subdirectory(../stochastic_physics stochastic_physics) +add_subdirectory(stochastic_physics) + +############################################################################### +### fv3atm +############################################################################### +add_library(fv3atm + atmos_model.F90 + fv3_cap.F90 + module_fv3_config.F90 + module_fcst_grid_comp.F90 + time_utils.F90) + +list(APPEND _fv3atm_defs_private GFS_PHYS + INTERNAL_FILE_NML + ESMF_VERSION_MAJOR=${ESMF_VERSION_MAJOR}) + +set_target_properties(fv3atm PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) +target_include_directories(fv3atm INTERFACE $ + $) + +if(CCPP) + list(APPEND _fv3atm_defs_private CCPP) + target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/ccpp/driver/mod) + set(CCPP_LIBRARIES ccppdriver ccppphys ccpp) + add_dependencies(fv3atm ccppdriver ccppphys ccpp) + target_link_libraries(fv3atm PUBLIC ccppdriver ccppphys ccpp) +endif() +target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/stochastic_physics) +target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../stochastic_physics) +target_compile_definitions(fv3atm PRIVATE "${_fv3atm_defs_private}") + +target_link_libraries(fv3atm PUBLIC fv3dycore + cpl + io + stochastic_physics + stochastic_physics_wrapper) + +target_link_libraries(fv3atm PUBLIC nemsio::nemsio + w3emc::w3emc_d + w3nco::w3nco_d + sp::sp_d + bacio::bacio_4 + esmf) + +if(INLINE_POST) + target_link_libraries(fv3atm PUBLIC upp::upp) +endif() + +if(OpenMP_Fortran_FOUND) + target_link_libraries(fv3atm PUBLIC OpenMP::OpenMP_Fortran) +endif() + +############################################################################### +### Install +############################################################################### +install( + TARGETS fv3atm fv3dycore io ipd gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics_wrapper + EXPORT fv3atm-config + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod DESTINATION ${CMAKE_INSTALL_PREFIX}) + +install(EXPORT fv3atm-config + DESTINATION lib/cmake) From 5037f12015e15dd7abcf87e18cc3e792e8750ad6 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Wed, 23 Dec 2020 22:14:12 +0000 Subject: [PATCH 06/21] merge with upstream NOAA-EMC --- ccpp/framework | 2 +- ccpp/physics | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ccpp/framework b/ccpp/framework index f1dc8d6f0..e5a69bbb7 160000 --- a/ccpp/framework +++ b/ccpp/framework @@ -1 +1 @@ -Subproject commit f1dc8d6f038e590508c272070f673d1fd7ea566f +Subproject commit e5a69bbb71c6744ce14403f8437ba2c0b741dcd9 diff --git a/ccpp/physics b/ccpp/physics index 8785df534..9ff5e8065 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 8785df534f865df712e2e33f31c7103c32a68497 +Subproject commit 9ff5e806537e3339561fe9f965827910c1a9eeda From 15d00c6f00ea75898940969afc475654fd5b7889 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Wed, 6 Jan 2021 15:36:37 +0000 Subject: [PATCH 07/21] update cmake lists and typedefs for cld_perts --- CMakeLists.txt | 3 +- gfsphysics/GFS_layer/GFS_physics_driver.F90 | 16 ++++----- gfsphysics/GFS_layer/GFS_typedefs.F90 | 36 +++++++++++-------- gfsphysics/GFS_layer/GFS_typedefs.meta | 36 ++++++++++++------- .../stochastic_physics_wrapper.F90 | 4 +-- 5 files changed, 57 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ad007805..f76709def 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,8 +184,8 @@ target_compile_definitions(fv3atm PRIVATE "${_fv3atm_defs_private}") target_link_libraries(fv3atm PUBLIC fv3dycore cpl io + stochastic_physics stochastic_physics_wrapper) -# stochastic_physics target_link_libraries(fv3atm PUBLIC nemsio::nemsio w3emc::w3emc_d @@ -206,6 +206,7 @@ endif() ### Install ############################################################################### install( + #TARGETS fv3atm fv3dycore io ipd gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics stochastic_physics_wrapper TARGETS fv3atm fv3dycore io ipd gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics_wrapper EXPORT fv3atm-config LIBRARY DESTINATION lib diff --git a/gfsphysics/GFS_layer/GFS_physics_driver.F90 b/gfsphysics/GFS_layer/GFS_physics_driver.F90 index 3af028a83..2eca62f82 100644 --- a/gfsphysics/GFS_layer/GFS_physics_driver.F90 +++ b/gfsphysics/GFS_layer/GFS_physics_driver.F90 @@ -543,7 +543,7 @@ subroutine GFS_physics_driver & smsoil, stsoil, slsoil real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levs) :: & - del, rhc, dtdt, dudt, dvdt, dtdtc, & + del, rhc, dtdt, dudt, dvdt, dtdtnp, & ud_mf, dd_mf, dt_mf, prnum, dkt ! ud_mf, dd_mf, dt_mf, prnum, dkt, sigmatot, sigmafrac, txa real(kind=kind_phys), allocatable, dimension(:,:) :: sigmatot, & @@ -1285,10 +1285,10 @@ subroutine GFS_physics_driver & do k=1,levs do i=1,im - dudt(i,k) = zero - dvdt(i,k) = zero - dtdt(i,k) = zero - dtdtc(i,k) = zero + dudt(i,k) = zero + dvdt(i,k) = zero + dtdt(i,k) = zero + dtdtnp(i,k) = zero !## CCPP ##* GFS_typedefs.F90/interstitial_phys_reset !vay-2018 @@ -1469,7 +1469,7 @@ subroutine GFS_physics_driver & Model%fhswr, dry, icy, wet, & ! lprnt, ipr, & ! --- input/output: - dtdt, dtdtc, & + dtdt, dtdtnp, & ! --- outputs: adjsfcdsw, adjsfcnsw, adjsfcdlw, adjsfculw3, xmu, xcosz, & adjnirbmu, adjnirdfu, adjvisbmu, adjvisdfu, & @@ -1484,7 +1484,7 @@ subroutine GFS_physics_driver & if (Model%do_sppt .or. Model%ca_global)then if (Model%pert_radtend) then !--- cloudy radiation heating rate - Tbd%dtdtr(1:im,:) = dtdtc(1:im,:)*dtf + Tbd%dtdtr(1:im,:) = dtdtnp(1:im,:)*dtf else Tbd%dtdtr(1:im,:) = dtdt(1:im,:)*dtf endif @@ -2994,7 +2994,7 @@ subroutine GFS_physics_driver & ! write(0,*) ' dvsfc1=',dvsfc1(ipr),' kdt=',kdt ! write(0,*)' dtsfc1=',dtsfc1(ipr)*hffac(ipr) ! write(0,*)' dqsfc1=',dqsfc1(ipr)*hefac(ipr) -! write(0,*)' dtdtc=',(dtdt(ipr,k),k=1,15) +! write(0,*)' dtdtnp=',(dtdt(ipr,k),k=1,15) ! write(0,*)' dqdtc=',(dqdt(ipr,k,1),k=1,15) ! print *,' dudtm=',dudt(ipr,:) ! endif diff --git a/gfsphysics/GFS_layer/GFS_typedefs.F90 b/gfsphysics/GFS_layer/GFS_typedefs.F90 index f328d2403..ec63e9cfc 100644 --- a/gfsphysics/GFS_layer/GFS_typedefs.F90 +++ b/gfsphysics/GFS_layer/GFS_typedefs.F90 @@ -1101,15 +1101,15 @@ module GFS_typedefs !--- stochastic physics control parameters logical :: do_sppt - logical :: do_pertmp + logical :: pert_clds + logical :: pert_radtend + logical :: pert_mp logical :: use_zmtnblck logical :: do_shum logical :: do_skeb - logical :: pert_clds - logical :: pert_mp - logical :: pert_radtend integer :: skeb_npass integer :: lndp_type + real(kind=kind_phys) :: sppt_amp ! pjp cloud perturbations integer :: n_var_lndp character(len=3) :: lndp_var_list(6) ! dimension here must match n_var_max_lndp in stochy_nml_def real(kind=kind_phys) :: lndp_prt_list(6) ! dimension here must match n_var_max_lndp in stochy_nml_def @@ -1322,7 +1322,7 @@ module GFS_typedefs real (kind=kind_phys), pointer :: acvt (:) => null() !< arrays used by cnvc90 top (cnvc90.f) !--- Stochastic physics properties calculated in physics_driver - real (kind=kind_phys), pointer :: dtdtr (:,:) => null() !< temperature change due to radiative heating per time step (K) + real (kind=kind_phys), pointer :: dtdtnp (:,:) => null() !< temperature change from physics that should not be perturbed with SPPT (k) real (kind=kind_phys), pointer :: dtotprcp (:) => null() !< change in totprcp (diag_type) real (kind=kind_phys), pointer :: dcnvprcp (:) => null() !< change in cnvprcp (diag_type) real (kind=kind_phys), pointer :: drain_cpl (:) => null() !< change in rain_cpl (coupling_type) @@ -1805,7 +1805,7 @@ module GFS_typedefs real (kind=kind_phys), pointer :: drain(:) => null() !< real (kind=kind_phys), pointer :: drain_in_m_sm1(:) => null() !< real (kind=kind_phys), pointer :: dtdt(:,:) => null() !< - real (kind=kind_phys), pointer :: dtdtc(:,:) => null() !< + real (kind=kind_phys), pointer :: dtdtnp(:,:) => null() !< real (kind=kind_phys), pointer :: dtsfc1(:) => null() !< real (kind=kind_phys), pointer :: dtzm(:) => null() !< real (kind=kind_phys), pointer :: dt_mf(:,:) => null() !< @@ -3466,7 +3466,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & !--- stochastic physics control parameters logical :: do_sppt = .false. - logical :: do_pertmp = .false. + logical :: pert_mp = .false. + logical :: pert_clds = .false. + logical :: pert_radtend = .true. logical :: use_zmtnblck = .false. logical :: do_shum = .false. logical :: do_skeb = .false. @@ -3557,7 +3559,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & do_deep, jcap, & cs_parm, flgmin, cgwf, ccwf, cdmbgwd, sup, ctei_rm, crtrh, & dlqf, rbcr, shoc_parm, psauras, prauras, wminras, & - do_sppt, do_pertmp, do_shum, do_skeb, lndp_type, n_var_lndp,& + do_sppt, do_shum, do_skeb, lndp_type, n_var_lndp, & + pert_mp,pert_clds,pert_radtend, & !--- Rayleigh friction prslrd0, ral_ts, ldiag_ugwp, do_ugwp, do_tofd, & ! --- Ferrier-Aligo @@ -4217,7 +4220,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & ! physics that are parsed here and then compared in init_stochastic_physics ! to the stochastic physics namelist parametersto ensure consistency. Model%do_sppt = do_sppt - Model%do_pertmp = do_pertmp + Model%pert_mp = pert_mp + Model%pert_clds = pert_clds + Model%pert_radtend = pert_radtend Model%use_zmtnblck = use_zmtnblck Model%do_shum = do_shum Model%do_skeb = do_skeb @@ -5320,7 +5325,9 @@ subroutine control_print(Model) print *, ' ' print *, 'stochastic physics' print *, ' do_sppt : ', Model%do_sppt - print *, ' do_pertmp : ', Model%do_pertmp + print *, ' pert_mp : ', Model%pert_mp + print *, ' pert_clds : ', Model%pert_clds + print *, ' pert_radtend : ', Model%pert_radtend print *, ' do_shum : ', Model%do_shum print *, ' do_skeb : ', Model%do_skeb print *, ' lndp_type : ', Model%lndp_type @@ -5567,10 +5574,10 @@ subroutine tbd_create (Tbd, IM, Model) endif if (Model%do_sppt .or. Model%ca_global) then - allocate (Tbd%dtdtr (IM,Model%levs)) + allocate (Tbd%dtdtnp (IM,Model%levs)) allocate (Tbd%dtotprcp (IM)) allocate (Tbd%dcnvprcp (IM)) - Tbd%dtdtr = clear_val + Tbd%dtdtnp = clear_val Tbd%dtotprcp = clear_val Tbd%dcnvprcp = clear_val endif @@ -6504,7 +6511,7 @@ subroutine interstitial_create (Interstitial, IM, Model) allocate (Interstitial%dqsfc1 (IM)) allocate (Interstitial%drain (IM)) allocate (Interstitial%dtdt (IM,Model%levs)) - allocate (Interstitial%dtdtc (IM,Model%levs)) + allocate (Interstitial%dtdtnp (IM,Model%levs)) allocate (Interstitial%dtsfc1 (IM)) allocate (Interstitial%dt_mf (IM,Model%levs)) allocate (Interstitial%dtzm (IM)) @@ -7187,7 +7194,7 @@ subroutine interstitial_phys_reset (Interstitial, Model) Interstitial%drain = clear_val Interstitial%dt_mf = clear_val Interstitial%dtdt = clear_val - Interstitial%dtdtc = clear_val + Interstitial%dtdtnp = clear_val Interstitial%dtsfc1 = clear_val Interstitial%dtzm = clear_val Interstitial%dudt = clear_val @@ -7541,7 +7548,6 @@ subroutine interstitial_print(Interstitial, Model, mpirank, omprank, blkno) write (0,*) 'sum(Interstitial%dqsfc1 ) = ', sum(Interstitial%dqsfc1 ) write (0,*) 'sum(Interstitial%drain ) = ', sum(Interstitial%drain ) write (0,*) 'sum(Interstitial%dtdt ) = ', sum(Interstitial%dtdt ) - write (0,*) 'sum(Interstitial%dtdtc ) = ', sum(Interstitial%dtdtc ) write (0,*) 'sum(Interstitial%dtsfc1 ) = ', sum(Interstitial%dtsfc1 ) write (0,*) 'sum(Interstitial%dtzm ) = ', sum(Interstitial%dtzm ) write (0,*) 'sum(Interstitial%dt_mf ) = ', sum(Interstitial%dt_mf ) diff --git a/gfsphysics/GFS_layer/GFS_typedefs.meta b/gfsphysics/GFS_layer/GFS_typedefs.meta index a38fdf4fc..5e416abbd 100644 --- a/gfsphysics/GFS_layer/GFS_typedefs.meta +++ b/gfsphysics/GFS_layer/GFS_typedefs.meta @@ -4151,12 +4151,31 @@ units = flag dimensions = () type = logical -[do_pertmp] +[pert_mp] standard_name = flag_for_stochastic_microphysics_perturbations long_name = flag for stochastic microphysics perturbations units = flag dimensions = () type = logical +[pert_clds] + standard_name = flag_for_stochastic_cloud_fraction_perturbations + long_name = flag for stochastic cloud fraction perturbations + units = flag + dimensions = () + type = logical +[sppt_amp] + standard_name = total_ampltiude_of_sppt_perturbation + long_name = toal ampltidue of stochastic sppt perturbation + units = none + dimensions = () + type = real + kind = kind_phys +[pert_radtend] + standard_name = flag_for_stochastic_radiative_heating_perturbations + long_name = flag for stochastic radiative heating perturbations + units = flag + dimensions = () + type = logical [use_zmtnblck] standard_name = flag_for_mountain_blocking long_name = flag for mountain blocking @@ -5199,10 +5218,10 @@ dimensions = (horizontal_loop_extent) type = real kind = kind_phys -[dtdtr] - standard_name = tendency_of_air_temperature_due_to_radiative_heating_on_physics_time_step - long_name = temp. change due to radiative heating per time step - units = K +[dtdtnp] + standard_name = tendency_of_air_temperature_to_withold_from_sppt + long_name = temp. change from physics that should not be perturbed by sppt + units = K s-1 dimensions = (horizontal_loop_extent,vertical_dimension) type = real kind = kind_phys @@ -7876,13 +7895,6 @@ dimensions = (horizontal_loop_extent,vertical_dimension) type = real kind = kind_phys -[dtdtc] - standard_name = tendency_of_air_temperature_due_to_radiative_heating_assuming_clear_sky - long_name = clear sky radiative (shortwave + longwave) heating rate at current time - units = K s-1 - dimensions = (horizontal_loop_extent,vertical_dimension) - type = real - kind = kind_phys [dtsfc1] standard_name = instantaneous_surface_upward_sensible_heat_flux long_name = surface upward sensible heat flux diff --git a/stochastic_physics/stochastic_physics_wrapper.F90 b/stochastic_physics/stochastic_physics_wrapper.F90 index 558dd774f..4a34f1591 100644 --- a/stochastic_physics/stochastic_physics_wrapper.F90 +++ b/stochastic_physics/stochastic_physics_wrapper.F90 @@ -88,7 +88,7 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) xlon(nb,1:GFS_Control%blksz(nb)) = GFS_Data(nb)%Grid%xlon(:) end do ! Initialize stochastic physics - call init_stochastic_physics(GFS_Control%levs, GFS_Control%blksz, GFS_Control%dtp, & + call init_stochastic_physics(GFS_Control%levs, GFS_Control%blksz, GFS_Control%dtp, GFS_Control%sppt_amp, & GFS_Control%input_nml_file, GFS_Control%fn_nml, GFS_Control%nlunit, xlon, xlat, GFS_Control%do_sppt, GFS_Control%do_shum, & GFS_Control%do_skeb, GFS_Control%lndp_type, GFS_Control%n_var_lndp, GFS_Control%use_zmtnblck, GFS_Control%skeb_npass, & GFS_Control%lndp_var_list, GFS_Control%lndp_prt_list, & @@ -122,7 +122,7 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) if ( GFS_Control%lndp_type .EQ. 1 ) then ! this scheme sets perts once allocate(sfc_wts(1:Atm_block%nblks,maxval(GFS_Control%blksz),GFS_Control%n_var_lndp)) - call run_stochastic_physics(GFS_Control%levs, GFS_Control%kdt, GFS_Control%fhour, GFS_Control%blksz, & + call run_stochastic_physics(GFS_Control%levs, GFS_Control%kdt, GFS_Control%fhour, GFS_Control%blksz, & sppt_wts=sppt_wts, shum_wts=shum_wts, skebu_wts=skebu_wts, skebv_wts=skebv_wts, sfc_wts=sfc_wts, & nthreads=nthreads) ! Copy contiguous data back From db8684eb5552432a4ed2861b9174ba72f16e1960 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Tue, 12 Jan 2021 21:28:44 +0000 Subject: [PATCH 08/21] update submodules --- atmos_cubed_sphere | 2 +- ccpp/framework | 2 +- ccpp/physics | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/atmos_cubed_sphere b/atmos_cubed_sphere index 9ed4a1985..34a6fdf47 160000 --- a/atmos_cubed_sphere +++ b/atmos_cubed_sphere @@ -1 +1 @@ -Subproject commit 9ed4a1985cc1524deb98d73a72a2a2c9d40faad0 +Subproject commit 34a6fdf47f68485cd300220391af76589793f676 diff --git a/ccpp/framework b/ccpp/framework index d4d131d5b..612dd1aa9 160000 --- a/ccpp/framework +++ b/ccpp/framework @@ -1 +1 @@ -Subproject commit d4d131d5bdb9cbbd75ace82f0c2b93a1a6b32bb1 +Subproject commit 612dd1aa9ed6f8c08b4c280ba1c992dd5357fc59 diff --git a/ccpp/physics b/ccpp/physics index 2980ce11f..264fa1bce 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 2980ce11f76a7263641140a2ab518aee747b6314 +Subproject commit 264fa1bce151d758bcc2082d6978be603a2c5dea From 4bae42069de41518d53fd89679e1585a6e07c905 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Fri, 22 Jan 2021 17:04:48 +0000 Subject: [PATCH 09/21] update ccpp-physics submodule --- ccpp/physics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccpp/physics b/ccpp/physics index 264fa1bce..f2bc20010 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 264fa1bce151d758bcc2082d6978be603a2c5dea +Subproject commit f2bc2001020aa1d20fd27d94349d77157ffe8366 From b7f26aa1de0fc84e9128dd200995dfcb15d90b20 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Tue, 2 Feb 2021 20:08:19 +0000 Subject: [PATCH 10/21] remove MKL from CmakeLists.txt --- ccpp/CMakeLists.txt | 12 ------------ ccpp/physics | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/ccpp/CMakeLists.txt b/ccpp/CMakeLists.txt index 760e09a8e..7f7575cd6 100644 --- a/ccpp/CMakeLists.txt +++ b/ccpp/CMakeLists.txt @@ -220,18 +220,6 @@ else (SIONLIB) message (STATUS "Disable SIONlib support") endif (SIONLIB) -#------------------------------------------------------------------------------ -# Set Intel MKL flags for preprocessor, compiler and linker (if defined) -if(MKL_DIR) - set (MKL_INC "-m64 -I${MKL_DIR}/include") - set (MKL_LIB "-L${MKL_DIR}/lib -Wl,-rpath,${MKL_DIR}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl") - set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${MKL_INC} ${MKL_LIB}") - ADD_DEFINITIONS(-DMKL) - message (STATUS "Enable Intel MKL support") -else(MKL_DIR) - message (STATUS "Disable Intel MKL support") -endif(MKL_DIR) - #------------------------------------------------------------------------------ # Set netCDF flags for preprocessor, compiler and linker (if defined) # Legacy settings for old make build diff --git a/ccpp/physics b/ccpp/physics index f2bc20010..f304650eb 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit f2bc2001020aa1d20fd27d94349d77157ffe8366 +Subproject commit f304650eb492c18ad8879476ec42a685b66b429d From 06eba2cf0e5efc60349f5d4d0ca693c55c8d1692 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Fri, 5 Feb 2021 16:44:50 +0000 Subject: [PATCH 11/21] remove test CMake file --- CMakeLists.txt.good_for_coupled | 217 -------------------------------- 1 file changed, 217 deletions(-) delete mode 100644 CMakeLists.txt.good_for_coupled diff --git a/CMakeLists.txt.good_for_coupled b/CMakeLists.txt.good_for_coupled deleted file mode 100644 index 6df71eff5..000000000 --- a/CMakeLists.txt.good_for_coupled +++ /dev/null @@ -1,217 +0,0 @@ -if(CCPP) - - if(DEBUG) - set(_ccpp_debug_arg "--debug") - endif() - if(DEFINED CCPP_SUITES) - set(_ccpp_suites_arg "--suites=${CCPP_SUITES}") - message("Calling CCPP code generator (ccpp_prebuild.py) for suites ${_ccpp_suites_arg} ...") - else() - message("Calling CCPP code generator (ccpp_prebuild.py) for all available suites ...") - endif() - execute_process(COMMAND ${Python_EXECUTABLE} - "ccpp/framework/scripts/ccpp_prebuild.py" - "--config=ccpp/config/ccpp_prebuild_config.py" - "--builddir=${CMAKE_CURRENT_BINARY_DIR}" ${_ccpp_suites_arg} ${_ccpp_debug_arg} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/ccpp_prebuild.out - ERROR_FILE ${CMAKE_CURRENT_BINARY_DIR}/ccpp_prebuild.err - RESULT_VARIABLE RC) - # Check return code from ccpp_prebuild.py - if(NOT RC EQUAL 0) - message(FATAL_ERROR "An error occured while running ccpp_prebuild.py, check ${CMAKE_CURRENT_BINARY_DIR}/ccpp_prebuild.{out,err}") - endif() - # this should not be necessary; including CCPP_*.cmake here and passing - # SCHEMES, CAPS and TYPEDEFS via environment variables to CCPP build. - # CCPP should be able to directly include those three .cmake files. - include(${CMAKE_CURRENT_BINARY_DIR}/ccpp/physics/CCPP_SCHEMES.cmake) - include(${CMAKE_CURRENT_BINARY_DIR}/ccpp/physics/CCPP_CAPS.cmake) - include(${CMAKE_CURRENT_BINARY_DIR}/ccpp/physics/CCPP_TYPEDEFS.cmake) - set(ENV{CCPP_SCHEMES} "${SCHEMES}") - set(ENV{CCPP_CAPS} "${CAPS}") - set(ENV{CCPP_TYPEDEFS} "${TYPEDEFS}") - -endif() - -add_subdirectory(cpl) -add_subdirectory(gfsphysics) -add_subdirectory(ipd) -add_subdirectory(io) - -############################################################################### -### fv3dycore -############################################################################### -list(APPEND _fv3dycore_srcs - atmos_cubed_sphere/model/a2b_edge.F90 - atmos_cubed_sphere/model/multi_gases.F90 - atmos_cubed_sphere/model/boundary.F90 - atmos_cubed_sphere/model/dyn_core.F90 - atmos_cubed_sphere/model/fv_arrays.F90 - atmos_cubed_sphere/model/fv_control.F90 - atmos_cubed_sphere/model/fv_dynamics.F90 - atmos_cubed_sphere/model/fv_fill.F90 - atmos_cubed_sphere/model/fv_grid_utils.F90 - atmos_cubed_sphere/model/fv_mapz.F90 - atmos_cubed_sphere/model/fv_nesting.F90 - atmos_cubed_sphere/model/fv_regional_bc.F90 - atmos_cubed_sphere/model/fv_sg.F90 - atmos_cubed_sphere/model/fv_tracer2d.F90 - atmos_cubed_sphere/model/fv_update_phys.F90 - atmos_cubed_sphere/model/sw_core.F90 - atmos_cubed_sphere/model/tp_core.F90 - atmos_cubed_sphere/model/nh_core.F90 - atmos_cubed_sphere/model/nh_utils.F90 - atmos_cubed_sphere/tools/external_ic.F90 - atmos_cubed_sphere/tools/external_sst.F90 - atmos_cubed_sphere/tools/fv_diagnostics.F90 - atmos_cubed_sphere/tools/fv_eta.F90 - atmos_cubed_sphere/tools/fv_grid_tools.F90 - atmos_cubed_sphere/tools/fv_io.F90 - atmos_cubed_sphere/tools/fv_mp_mod.F90 - atmos_cubed_sphere/tools/fv_nudge.F90 - atmos_cubed_sphere/tools/fv_treat_da_inc.F90 - atmos_cubed_sphere/tools/fv_iau_mod.F90 - atmos_cubed_sphere/tools/fv_restart.F90 - atmos_cubed_sphere/tools/fv_surf_map.F90 - atmos_cubed_sphere/tools/fv_timing.F90 - atmos_cubed_sphere//tools/init_hydro.F90 - atmos_cubed_sphere/tools/sim_nc_mod.F90 - atmos_cubed_sphere/tools/sorted_index.F90 - atmos_cubed_sphere/tools/test_cases.F90 - atmos_cubed_sphere/driver/fvGFS/DYCORE_typedefs.F90 - atmos_cubed_sphere/driver/fvGFS/fv_nggps_diag.F90 - atmos_cubed_sphere/driver/fvGFS/atmosphere.F90) - -if(NOT CCPP) - list(APPEND _fv3dycore_srcs atmos_cubed_sphere/model/fv_cmp.F90) -endif() - -add_library(fv3dycore ${_fv3dycore_srcs}) - -list(APPEND _fv3dycore_defs_private SPMD - use_WRTCOMP - GFS_PHYS - USE_GFSL63 - MOIST_CAPPA - USE_COND) - -if(MULTI_GASES) - list(APPEND _fv3dycore_defs_private MULTI_GASES) -endif() - -if(32BIT) - list(APPEND _fv3dycore_defs_private OVERLOAD_R4 - OVERLOAD_R8) -endif() - -if(CCPP) - list(APPEND _fv3dycore_defs_private CCPP) -endif() - -if(OpenMP_Fortran_FOUND) - list(APPEND _fv3dycore_defs_private OPENMP) -endif() - -set_property(SOURCE atmos_cubed_sphere/model/nh_utils.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FAST}") -set_property(SOURCE atmos_cubed_sphere/model/fv_mapz.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FAST}") - -set_target_properties(fv3dycore PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) - -target_compile_definitions(fv3dycore PRIVATE "${_fv3dycore_defs_private}") -target_include_directories(fv3dycore PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/atmos_cubed_sphere) -target_include_directories(fv3dycore INTERFACE $ - $) - -target_link_libraries(fv3dycore PUBLIC fms - gfsphysics - ipd - esmf) -if(OpenMP_Fortran_FOUND) - target_link_libraries(fv3dycore PUBLIC OpenMP::OpenMP_Fortran) -endif() - -############################################################################### -### ccpp -############################################################################### -if(CCPP) - add_subdirectory(ccpp) - add_subdirectory(ccpp/driver) - add_dependencies(gfsphysics ccpp ccppphys) - add_dependencies(ccppdriver ccpp ccppphys) - add_dependencies(ccppphys ccpp) - target_include_directories(fv3dycore PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/ccpp/framework/src - ${CMAKE_CURRENT_BINARY_DIR}/ccpp/driver) - target_link_libraries(ccppphys PRIVATE sp::sp_d - w3nco::w3nco_d) -endif() - -############################################################################### -### stochastic_physics -############################################################################### -# When specifying an out-of-tree source a binary directory must be explicitly specified. -#add_subdirectory(../stochastic_physics stochastic_physics) -add_subdirectory(stochastic_physics) - -############################################################################### -### fv3atm -############################################################################### -add_library(fv3atm - atmos_model.F90 - fv3_cap.F90 - module_fv3_config.F90 - module_fcst_grid_comp.F90 - time_utils.F90) - -list(APPEND _fv3atm_defs_private GFS_PHYS - INTERNAL_FILE_NML - ESMF_VERSION_MAJOR=${ESMF_VERSION_MAJOR}) - -set_target_properties(fv3atm PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) -target_include_directories(fv3atm INTERFACE $ - $) - -if(CCPP) - list(APPEND _fv3atm_defs_private CCPP) - target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/ccpp/driver/mod) - set(CCPP_LIBRARIES ccppdriver ccppphys ccpp) - add_dependencies(fv3atm ccppdriver ccppphys ccpp) - target_link_libraries(fv3atm PUBLIC ccppdriver ccppphys ccpp) -endif() -target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/stochastic_physics) -target_include_directories(fv3atm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../stochastic_physics) -target_compile_definitions(fv3atm PRIVATE "${_fv3atm_defs_private}") - -target_link_libraries(fv3atm PUBLIC fv3dycore - cpl - io - stochastic_physics - stochastic_physics_wrapper) - -target_link_libraries(fv3atm PUBLIC nemsio::nemsio - w3emc::w3emc_d - w3nco::w3nco_d - sp::sp_d - bacio::bacio_4 - esmf) - -if(INLINE_POST) - target_link_libraries(fv3atm PUBLIC upp::upp) -endif() - -if(OpenMP_Fortran_FOUND) - target_link_libraries(fv3atm PUBLIC OpenMP::OpenMP_Fortran) -endif() - -############################################################################### -### Install -############################################################################### -install( - TARGETS fv3atm fv3dycore io ipd gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics_wrapper - EXPORT fv3atm-config - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod DESTINATION ${CMAKE_INSTALL_PREFIX}) - -install(EXPORT fv3atm-config - DESTINATION lib/cmake) From 7e90b586d3f16087e2ac73a3a46c208aba6cfc2a Mon Sep 17 00:00:00 2001 From: pjpegion Date: Fri, 5 Feb 2021 17:06:55 +0000 Subject: [PATCH 12/21] remove unused coupler_main.F90 --- coupler_main.F90 | 508 ----------------------------------------------- 1 file changed, 508 deletions(-) delete mode 100644 coupler_main.F90 diff --git a/coupler_main.F90 b/coupler_main.F90 deleted file mode 100644 index 58a7ff281..000000000 --- a/coupler_main.F90 +++ /dev/null @@ -1,508 +0,0 @@ -!*********************************************************************** -!* GNU General Public License * -!* This file is a part of fvGFS. * -!* * -!* fvGFS is free software; you can redistribute it and/or modify it * -!* and are expected to follow the terms of the GNU General Public * -!* License as published by the Free Software Foundation; either * -!* version 2 of the License, or (at your option) any later version. * -!* * -!* fvGFS is distributed in the hope that it will be useful, but * -!* WITHOUT ANY WARRANTY; without even the implied warranty of * -!* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * -!* General Public License for more details. * -!* * -!* For the full text of the GNU General Public License, * -!* write to: Free Software Foundation, Inc., * -!* 675 Mass Ave, Cambridge, MA 02139, USA. * -!* or see: http://www.gnu.org/licenses/gpl.html * -!*********************************************************************** - -program coupler_main - -!----------------------------------------------------------------------- -! -! program that couples component models for the atmosphere, -! ocean (amip), land, and sea-ice using the exchange module -! -!----------------------------------------------------------------------- - -use time_manager_mod, only: time_type, set_calendar_type, set_time, & - set_date, days_in_month, month_name, & - operator(+), operator (<), operator (>), & - operator (/=), operator (/), operator (==),& - operator (*), THIRTY_DAY_MONTHS, JULIAN, & - NOLEAP, NO_CALENDAR, date_to_string, & - get_date - -use atmos_model_mod, only: atmos_model_init, atmos_model_end, & - update_atmos_model_dynamics, & - update_atmos_radiation_physics, & - update_atmos_model_state, & - atmos_data_type, atmos_model_restart - -use constants_mod, only: constants_init -#ifdef INTERNAL_FILE_NML -use mpp_mod, only: input_nml_file -#else -use fms_mod, only: open_namelist_file -#endif -use fms_mod, only: file_exist, check_nml_error, & - error_mesg, fms_init, fms_end, close_file, & - write_version_number, uppercase - -use mpp_mod, only: mpp_init, mpp_pe, mpp_root_pe, mpp_npes, mpp_get_current_pelist, & - mpp_set_current_pelist, stdlog, mpp_error, NOTE, FATAL, WARNING -use mpp_mod, only: mpp_clock_id, mpp_clock_begin, mpp_clock_end, mpp_sync - -use mpp_io_mod, only: mpp_open, mpp_close, & - MPP_NATIVE, MPP_RDONLY, MPP_DELETE - -use mpp_domains_mod, only: mpp_get_global_domain, mpp_global_field, CORNER -use memutils_mod, only: print_memuse_stats -use sat_vapor_pres_mod,only: sat_vapor_pres_init - -use diag_manager_mod, only: diag_manager_init, diag_manager_end, & - get_base_date, diag_manager_set_time_end - -use data_override_mod, only: data_override_init -use get_stochy_pattern_mod, only: write_stoch_restart_atm - - -implicit none - -!----------------------------------------------------------------------- - -character(len=128) :: version = '$Id: coupler_main.F90,v 19.0.4.1.2.3 2014/09/09 23:51:59 Rusty.Benson Exp $' -character(len=128) :: tag = '$Name: ulm_201505 $' - -!----------------------------------------------------------------------- -!---- model defined-types ---- - - type (atmos_data_type) :: Atm - -!----------------------------------------------------------------------- -! ----- coupled model time ----- - - type (time_type) :: Time_atmos, Time_init, Time_end, & - Time_step_atmos, Time_step_ocean, & - Time_restart, Time_step_restart - integer :: num_cpld_calls, num_atmos_calls, nc, na, ret - -! ----- coupled model initial date ----- - - integer :: date_init(6) - integer :: calendar_type = -99 - -! ----- timing flags ----- - - integer :: initClock, mainClock, termClock - integer, parameter :: timing_level = 1 - -! ----- namelist ----- - integer, dimension(6) :: current_date = (/ 0, 0, 0, 0, 0, 0 /) - character(len=17) :: calendar = ' ' - logical :: force_date_from_namelist = .false. ! override restart values for date - integer :: months=0, days=0, hours=0, minutes=0, seconds=0 - integer :: dt_atmos = 0 - integer :: dt_ocean = 0 - integer :: restart_days = 0 - integer :: restart_secs = 0 - integer :: atmos_nthreads = 1 - logical :: memuse_verbose = .false. - logical :: use_hyper_thread = .false. - logical :: debug_affinity = .false. - integer :: ncores_per_node = 0 - - namelist /coupler_nml/ current_date, calendar, force_date_from_namelist, & - months, days, hours, minutes, seconds, & - dt_atmos, dt_ocean, atmos_nthreads, memuse_verbose, & - use_hyper_thread, ncores_per_node, debug_affinity, & - restart_secs, restart_days - -! ----- local variables ----- - character(len=32) :: timestamp - logical :: intrm_rst - -!####################################################################### - - call fms_init() - call mpp_init() - initClock = mpp_clock_id( 'Initialization' ) - call mpp_clock_begin (initClock) !nesting problem - - call fms_init - call constants_init - call sat_vapor_pres_init - - call coupler_init - call print_memuse_stats('after coupler init') - - call mpp_set_current_pelist() - call mpp_clock_end (initClock) !end initialization - mainClock = mpp_clock_id( 'Main loop' ) - termClock = mpp_clock_id( 'Termination' ) - call mpp_clock_begin(mainClock) !begin main loop - - do nc = 1, num_cpld_calls - - Time_atmos = Time_atmos + Time_step_atmos - - call update_atmos_model_dynamics (Atm) - - call update_atmos_radiation_physics (Atm) - - call update_atmos_model_state (Atm) - -!--- intermediate restart - if (intrm_rst) then - if ((nc /= num_cpld_calls) .and. (Time_atmos == Time_restart)) then - timestamp = date_to_string (Time_restart) - call atmos_model_restart(Atm, timestamp) - call write_stoch_restart_atm('RESTART/'//trim(timestamp)//'.atm_stoch.res.nc') - call coupler_res(timestamp) - Time_restart = Time_restart + Time_step_restart - endif - endif - - call print_memuse_stats('after full step') - - enddo - -!----------------------------------------------------------------------- - -#ifdef AVEC_TIMERS - call avec_timers_output -#endif - call mpp_set_current_pelist() - call mpp_clock_end(mainClock) - call mpp_clock_begin(termClock) - - call coupler_end - call mpp_set_current_pelist() - call mpp_clock_end(termClock) - - call fms_end - -!----------------------------------------------------------------------- - - stop - -contains - -!####################################################################### - - subroutine coupler_init - -!----------------------------------------------------------------------- -! initialize all defined exchange grids and all boundary maps -!----------------------------------------------------------------------- - integer :: total_days, total_seconds, unit, ierr, io - integer :: n, gnlon, gnlat - integer :: date(6), flags - type (time_type) :: Run_length - character(len=9) :: month - logical :: use_namelist - - logical, allocatable, dimension(:,:) :: mask - real, allocatable, dimension(:,:) :: glon_bnd, glat_bnd - integer :: omp_get_thread_num, get_cpu_affinity, base_cpu -!----------------------------------------------------------------------- -!----- initialization timing identifiers ---- - -!----- read namelist ------- -!----- for backwards compatibilty read from file coupler.nml ----- - -#ifdef INTERNAL_FILE_NML - read(input_nml_file, nml=coupler_nml, iostat=io) - ierr = check_nml_error(io, 'coupler_nml') -#else - if (file_exist('input.nml')) then - unit = open_namelist_file () - else - call error_mesg ('program coupler', & - 'namelist file input.nml does not exist', FATAL) - endif - - ierr=1 - do while (ierr /= 0) - read (unit, nml=coupler_nml, iostat=io, end=10) - ierr = check_nml_error (io, 'coupler_nml') - enddo -10 call close_file (unit) -#endif - -!----- write namelist to logfile ----- - call write_version_number (version, tag) - if (mpp_pe() == mpp_root_pe()) write(stdlog(),nml=coupler_nml) - -!----- allocate and set the pelist (to the global pelist) ----- - allocate( Atm%pelist (mpp_npes()) ) - call mpp_get_current_pelist(Atm%pelist) - -!----- read restart file ----- - - if (file_exist('INPUT/coupler.res')) then - call mpp_open( unit, 'INPUT/coupler.res', action=MPP_RDONLY ) - read (unit,*,err=999) calendar_type - read (unit,*) date_init - read (unit,*) date - goto 998 !back to fortran-4 - ! read old-style coupler.res - 999 call mpp_close (unit) - call mpp_open (unit, 'INPUT/coupler.res', action=MPP_RDONLY, form=MPP_NATIVE) - read (unit) calendar_type - read (unit) date - 998 call mpp_close(unit) - else - force_date_from_namelist = .true. - endif - -!----- use namelist value (either no restart or override flag on) --- - - if ( force_date_from_namelist ) then - - if ( sum(current_date) <= 0 ) then - call error_mesg ('program coupler', & - 'no namelist value for current_date', FATAL) - else - date = current_date - endif - -!----- override calendar type with namelist value ----- - - select case( uppercase(trim(calendar)) ) - case( 'JULIAN' ) - calendar_type = JULIAN - case( 'NOLEAP' ) - calendar_type = NOLEAP - case( 'THIRTY_DAY' ) - calendar_type = THIRTY_DAY_MONTHS - case( 'NO_CALENDAR' ) - calendar_type = NO_CALENDAR - case default - call mpp_error ( FATAL, 'COUPLER_MAIN: coupler_nml entry calendar must '// & - 'be one of JULIAN|NOLEAP|THIRTY_DAY|NO_CALENDAR.' ) - end select - - endif - -!$ base_cpu = get_cpu_affinity() -!$ call omp_set_num_threads(atmos_nthreads) -!$OMP PARALLEL NUM_THREADS(atmos_nthreads) -!$ if(omp_get_thread_num() < atmos_nthreads/2 .OR. (.not. use_hyper_thread)) then -!$ call set_cpu_affinity(base_cpu + omp_get_thread_num()) -!$ else -!$ call set_cpu_affinity(base_cpu + omp_get_thread_num() + & -!$ ncores_per_node - atmos_nthreads/2) -!$ endif -!$ if (debug_affinity) then -!$ write(6,*) mpp_pe()," atmos ",get_cpu_affinity(), base_cpu, omp_get_thread_num() -!$ call flush(6) -!$ endif -!$OMP END PARALLEL - - call set_calendar_type (calendar_type) - -!----- write current/initial date actually used to logfile file ----- - - if ( mpp_pe() == mpp_root_pe() ) then - write (stdlog(),16) date(1),trim(month_name(date(2))),date(3:6) - endif - - 16 format (' current date used = ',i4,1x,a,2i3,2(':',i2.2),' gmt') - -!----------------------------------------------------------------------- -!------ initialize diagnostics manager ------ - - call diag_manager_init (TIME_INIT=date) - -!----- always override initial/base date with diag_manager value ----- - - call get_base_date ( date_init(1), date_init(2), date_init(3), & - date_init(4), date_init(5), date_init(6) ) - -!----- use current date if no base date ------ - - if ( date_init(1) == 0 ) date_init = date - -!----- set initial and current time types ------ - - Time_init = set_date (date_init(1), date_init(2), date_init(3), & - date_init(4), date_init(5), date_init(6)) - - Time_atmos = set_date (date(1), date(2), date(3), & - date(4), date(5), date(6)) - -!----------------------------------------------------------------------- -!----- compute the ending time (compute days in each month first) ----- -! -! (NOTE: if run length in months then starting day must be <= 28) - - if ( months > 0 .and. date(3) > 28 ) & - call error_mesg ('program coupler', & - 'if run length in months then starting day must be <= 28', FATAL) - - Time_end = Time_atmos - total_days = 0 - do n = 1, months - total_days = total_days + days_in_month(Time_end) - Time_end = Time_atmos + set_time (0,total_days) - enddo - - total_days = total_days + days - total_seconds = hours*3600 + minutes*60 + seconds - Run_length = set_time (total_seconds,total_days) - Time_end = Time_atmos + Run_length - - !Need to pass Time_end into diag_manager for multiple thread case. - call diag_manager_set_time_end(Time_end) - - -!----------------------------------------------------------------------- -!----- write time stamps (for start time and end time) ------ - - call mpp_open( unit, 'time_stamp.out', nohdrs=.TRUE. ) - - month = month_name(date(2)) - if ( mpp_pe() == mpp_root_pe() ) write (unit,20) date, month(1:3) - - call get_date (Time_end, date(1), date(2), date(3), & - date(4), date(5), date(6)) - month = month_name(date(2)) - if ( mpp_pe() == mpp_root_pe() ) write (unit,20) date, month(1:3) - - call mpp_close (unit) - - 20 format (6i4,2x,a3) - -!----------------------------------------------------------------------- -!----- compute the time steps ------ - -Time_step_atmos = set_time (dt_atmos,0) -Time_step_ocean = set_time (dt_ocean,0) -num_cpld_calls = Run_length / Time_step_ocean -num_atmos_calls = Time_step_ocean / Time_step_atmos -Time_step_restart = set_time (restart_secs, restart_days) -Time_restart = Time_atmos + Time_step_restart -intrm_rst = .false. -if (restart_days > 0 .or. restart_secs > 0) intrm_rst = .true. - -!----------------------------------------------------------------------- -!------------------- some error checks --------------------------------- - -!----- initial time cannot be greater than current time ------- - - if ( Time_init > Time_atmos ) call error_mesg ('program coupler', & - 'initial time is greater than current time', FATAL) - -!----- make sure run length is a multiple of ocean time step ------ - - if ( num_cpld_calls * Time_step_ocean /= Run_length ) & - call error_mesg ('program coupler', & - 'run length must be multiple of ocean time step', FATAL) - -! ---- make sure cpld time step is a multiple of atmos time step ---- - - if ( num_atmos_calls * Time_step_atmos /= Time_step_ocean ) & - call error_mesg ('program coupler', & - 'atmos time step is not a multiple of the ocean time step', FATAL) - -!------ initialize component models ------ - - call atmos_model_init (Atm, Time_init, Time_atmos, Time_step_atmos) - - call print_memuse_stats('after atmos model init') - - call mpp_get_global_domain(Atm%Domain, xsize=gnlon, ysize=gnlat) - allocate ( glon_bnd(gnlon+1,gnlat+1), glat_bnd(gnlon+1,gnlat+1) ) - call mpp_global_field(Atm%Domain, Atm%lon_bnd, glon_bnd, position=CORNER) - call mpp_global_field(Atm%Domain, Atm%lat_bnd, glat_bnd, position=CORNER) - - call data_override_init ( ) ! Atm_domain_in = Atm%domain, & - ! Ice_domain_in = Ice%domain, & - ! Land_domain_in = Land%domain ) - -!----------------------------------------------------------------------- -!---- open and close dummy file in restart dir to check if dir exists -- - - if (mpp_pe() == 0 ) then - call mpp_open( unit, 'RESTART/file' ) - call mpp_close(unit, MPP_DELETE) - endif - -!----------------------------------------------------------------------- - - end subroutine coupler_init - -!####################################################################### - subroutine coupler_res(timestamp) - character(len=32), intent(in) :: timestamp - - integer :: unit, date(6) - -!----- compute current date ------ - - call get_date (Time_atmos, date(1), date(2), date(3), & - date(4), date(5), date(6)) - -!----- write restart file ------ - - if (mpp_pe() == mpp_root_pe())then - call mpp_open( unit, 'RESTART/'//trim(timestamp)//'.coupler.res', nohdrs=.TRUE. ) - write( unit, '(i6,8x,a)' )calendar_type, & - '(Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4)' - - write( unit, '(6i6,8x,a)' )date_init, & - 'Model start time: year, month, day, hour, minute, second' - write( unit, '(6i6,8x,a)' )date, & - 'Current model time: year, month, day, hour, minute, second' - call mpp_close(unit) - endif - end subroutine coupler_res - -!####################################################################### - - subroutine coupler_end - - integer :: unit, date(6) -!----------------------------------------------------------------------- - - call atmos_model_end (Atm) - -!----- compute current date ------ - - call get_date (Time_atmos, date(1), date(2), date(3), & - date(4), date(5), date(6)) - -!----- check time versus expected ending time ---- - - if (Time_atmos /= Time_end) call error_mesg ('program coupler', & - 'final time does not match expected ending time', WARNING) - -!----- write restart file ------ - - call mpp_open( unit, 'RESTART/coupler.res', nohdrs=.TRUE. ) - if (mpp_pe() == mpp_root_pe())then - write( unit, '(i6,8x,a)' )calendar_type, & - '(Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4)' - - write( unit, '(6i6,8x,a)' )date_init, & - 'Model start time: year, month, day, hour, minute, second' - write( unit, '(6i6,8x,a)' )date, & - 'Current model time: year, month, day, hour, minute, second' - endif - call mpp_close(unit) - -!----- final output of diagnostic fields ---- - - call diag_manager_end (Time_atmos) - -!----------------------------------------------------------------------- - - end subroutine coupler_end - -!####################################################################### - -end program coupler_main - From 5c3549c5489fe3f973cf23ce1f894de40546aeff Mon Sep 17 00:00:00 2001 From: pjpegion Date: Fri, 26 Feb 2021 22:36:20 +0000 Subject: [PATCH 13/21] revert CmakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51db05499..b6e5d9298 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,7 +194,7 @@ endif() ### Install ############################################################################### install( - TARGETS fv3atm fv3dycore io gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics_wrapper + TARGETS fv3atm fv3dycore io gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics_wrapper stochastic_physics EXPORT fv3atm-config LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) From 745727be856905f6e90d875c2fb4350ce40537c7 Mon Sep 17 00:00:00 2001 From: Philip Pegion Date: Wed, 3 Mar 2021 13:50:22 -0600 Subject: [PATCH 14/21] point to correct branch of rrtmgp and fix Cmakelists.txt --- ccpp/physics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccpp/physics b/ccpp/physics index 4a164c0b4..eaab86818 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 4a164c0b441d22c82afeccba7b65ebcbc17d6bc4 +Subproject commit eaab868187a34adbc42e84a08c3df1bc5fa90e77 From 5db5ffe53b5e593a0e701c7d501aa924f24fc573 Mon Sep 17 00:00:00 2001 From: Philip Pegion Date: Wed, 3 Mar 2021 14:52:57 -0600 Subject: [PATCH 15/21] fix Cmakelists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6e5d9298..51db05499 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,7 +194,7 @@ endif() ### Install ############################################################################### install( - TARGETS fv3atm fv3dycore io gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics_wrapper stochastic_physics + TARGETS fv3atm fv3dycore io gfsphysics ${CCPP_LIBRARIES} cpl stochastic_physics_wrapper EXPORT fv3atm-config LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) From b901cce8e32d690becc4a26fb42ed2648036a6bc Mon Sep 17 00:00:00 2001 From: pjpegion Date: Thu, 4 Mar 2021 16:26:30 +0000 Subject: [PATCH 16/21] fix CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fae19098b..4b0947f55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,7 +193,7 @@ endif() ### Install ############################################################################### install( - TARGETS fv3atm fv3dycore io ${CCPP_LIBRARIES} cpl stochastic_physics stochastic_physics_wrapper + TARGETS fv3atm fv3dycore io ${CCPP_LIBRARIES} cpl stochastic_physics_wrapper EXPORT fv3atm-config LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) From bc8df8e7851a9ec30de0ded2d5efa819e7b440ec Mon Sep 17 00:00:00 2001 From: pjpegion Date: Mon, 15 Mar 2021 19:44:51 +0000 Subject: [PATCH 17/21] Address Dom code review --- ccpp/data/GFS_typedefs.F90 | 5 ----- ccpp/physics | 2 +- stochastic_physics/stochastic_physics_wrapper.F90 | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/ccpp/data/GFS_typedefs.F90 b/ccpp/data/GFS_typedefs.F90 index 832d41516..28df46b78 100644 --- a/ccpp/data/GFS_typedefs.F90 +++ b/ccpp/data/GFS_typedefs.F90 @@ -1757,7 +1757,6 @@ module GFS_typedefs real (kind=kind_phys), pointer :: drain(:) => null() !< real (kind=kind_phys), pointer :: drain_in_m_sm1(:) => null() !< real (kind=kind_phys), pointer :: dtdt(:,:) => null() !< - real (kind=kind_phys), pointer :: dtdtnp(:,:) => null() !< real (kind=kind_phys), pointer :: dtsfc1(:) => null() !< real (kind=kind_phys), pointer :: dtzm(:) => null() !< real (kind=kind_phys), pointer :: dt_mf(:,:) => null() !< @@ -2849,7 +2848,6 @@ subroutine coupling_create (Coupling, IM, Model) endif !--- stochastic shum option - if (Model%me.EQ.0) print*,'allocating shum_wts',Model%do_shum if (Model%do_shum) then allocate (Coupling%shum_wts (IM,Model%levs)) Coupling%shum_wts = clear_val @@ -5695,7 +5693,6 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%sppt_wts(IM,Model%levs)) allocate (Diag%shum_wts(IM,Model%levs)) allocate (Diag%sfc_wts(IM,Model%n_var_lndp)) - if (Model%me.EQ.0) print*,'diag allocating shum_wts' allocate (Diag%zmtnblck(IM)) allocate (Diag%ca1 (IM)) allocate (Diag%ca2 (IM)) @@ -6280,7 +6277,6 @@ subroutine interstitial_create (Interstitial, IM, Model) allocate (Interstitial%dqsfc1 (IM)) allocate (Interstitial%drain (IM)) allocate (Interstitial%dtdt (IM,Model%levs)) - allocate (Interstitial%dtdtnp (IM,Model%levs)) allocate (Interstitial%dtsfc1 (IM)) allocate (Interstitial%dt_mf (IM,Model%levs)) allocate (Interstitial%dtzm (IM)) @@ -6974,7 +6970,6 @@ subroutine interstitial_phys_reset (Interstitial, Model) Interstitial%drain = clear_val Interstitial%dt_mf = clear_val Interstitial%dtdt = clear_val - Interstitial%dtdtnp = clear_val Interstitial%dtsfc1 = clear_val Interstitial%dtzm = clear_val Interstitial%dudt = clear_val diff --git a/ccpp/physics b/ccpp/physics index 31d99da08..daca231e7 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 31d99da08cca7a46ea4819b2389191cf747ded45 +Subproject commit daca231e7f31a8e8579e9b18596444164607e447 diff --git a/stochastic_physics/stochastic_physics_wrapper.F90 b/stochastic_physics/stochastic_physics_wrapper.F90 index c29468ba7..0d0b29164 100644 --- a/stochastic_physics/stochastic_physics_wrapper.F90 +++ b/stochastic_physics/stochastic_physics_wrapper.F90 @@ -153,7 +153,7 @@ subroutine stochastic_physics_wrapper (GFS_Control, GFS_Data, Atm_block, ierr) call run_stochastic_physics(GFS_Control%levs, GFS_Control%kdt, GFS_Control%fhour, GFS_Control%blksz, & sppt_wts=sppt_wts, shum_wts=shum_wts, skebu_wts=skebu_wts, skebv_wts=skebv_wts, sfc_wts=sfc_wts, & nthreads=nthreads) - ! Copy contiguous data back + ! Copy contiguous data back do nb=1,Atm_block%nblks GFS_Data(nb)%Coupling%sfc_wts(:,:) = sfc_wts(nb,1:GFS_Control%blksz(nb),:) end do From 955037b9564e06b2c4cd0e1b2d7ccff5cf229f42 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Thu, 18 Mar 2021 14:04:01 +0000 Subject: [PATCH 18/21] update ccpp from upstream --- ccpp/framework | 2 +- ccpp/physics | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ccpp/framework b/ccpp/framework index 612dd1aa9..9a5c9ce5e 160000 --- a/ccpp/framework +++ b/ccpp/framework @@ -1 +1 @@ -Subproject commit 612dd1aa9ed6f8c08b4c280ba1c992dd5357fc59 +Subproject commit 9a5c9ce5e35f311f3d6f25da6e85ad8ae9bbc6a1 diff --git a/ccpp/physics b/ccpp/physics index daca231e7..55f84f6c3 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit daca231e7f31a8e8579e9b18596444164607e447 +Subproject commit 55f84f6c3726d958667ed554e253f2d8f0666668 From 147559b34e5a227ce7053276e835cd9dc824b1e2 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Thu, 18 Mar 2021 14:12:45 +0000 Subject: [PATCH 19/21] update ccpp_physics submodule --- ccpp/physics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccpp/physics b/ccpp/physics index 55f84f6c3..bb0839e0c 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 55f84f6c3726d958667ed554e253f2d8f0666668 +Subproject commit bb0839e0c5db5eb320a599c37de4231c89ce3bda From bb6bc4b3cd95d38345ce13f9b69b5a8be28c8159 Mon Sep 17 00:00:00 2001 From: pjpegion Date: Fri, 19 Mar 2021 20:04:01 +0000 Subject: [PATCH 20/21] point to updated NCAR/ccpp-physics --- ccpp/physics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccpp/physics b/ccpp/physics index bb0839e0c..0f9b52d7c 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit bb0839e0c5db5eb320a599c37de4231c89ce3bda +Subproject commit 0f9b52d7c7a832afd298ed37b1af766ced080a55 From 5d13a9d8e5869bf36901a68d38fb3a5551e3a00f Mon Sep 17 00:00:00 2001 From: pjpegion Date: Fri, 19 Mar 2021 20:23:24 +0000 Subject: [PATCH 21/21] revert gitmodules --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 4da46575d..d253f6966 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,5 +8,5 @@ branch = master [submodule "ccpp/physics"] path = ccpp/physics - url = https://github.com/pjpegion/ccpp-physics - branch = pert_clds_mp + url = https://github.com/NCAR/ccpp-physics + branch = master