Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/NOAA-EMC/fv3atm into rev…
Browse files Browse the repository at this point in the history
…ert_iovr4

* 'develop' of https://github.com/NOAA-EMC/fv3atm:
  Use 'model set run clock' routine in FV3 NUOPC cap. (NOAA-EMC#450)
  Wrapper for ccpp-physics NOAA-EMC#808 and 816 (roughness length over ice and NoahMP tsurf bugfix) (NOAA-EMC#452)
  Wrapper for ccpp-physics NOAA-EMC#806, NOAA-EMC#807, NOAA-EMC#813 (NOAA-EMC#447)
  CCPP cloud cover change for Thompson MP associated with Xu Randall (NOAA-EMC#443)
  Code cleanup. Remove used code/variables. Fix minor inconsistencies. (NOAA-EMC#440)
  Feature/ccpp codeowners (NOAA-EMC#442)
  • Loading branch information
mzhangw committed Dec 27, 2021
2 parents 335936a + 96a2554 commit 0bc59dc
Show file tree
Hide file tree
Showing 9 changed files with 535 additions and 1,224 deletions.
96 changes: 14 additions & 82 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ module atmos_model_mod
! DYCORE containers
!-------------------
type(DYCORE_data_type), allocatable :: DYCORE_Data(:) ! number of blocks
type(DYCORE_diag_type) :: DYCORE_Diag(25)

!----------------
! GFS containers
Expand Down Expand Up @@ -380,7 +379,7 @@ subroutine update_atmos_radiation_physics (Atmos)
if(GFS_control%print_diff_pgr) then
call atmos_timestep_diagnostics(Atmos)
endif

! Update flag for first time step of time integration
GFS_control%first_time_step = .false.

Expand Down Expand Up @@ -444,7 +443,7 @@ subroutine atmos_timestep_diagnostics(Atmos)
enddo
pcount = pcount+count
enddo

! Sum pgr stats from psum/pcount and convert to hPa/hour global avg:
sendbuf(1:2) = (/ psum, pcount /)
call MPI_Allreduce(sendbuf,recvbuf,2,MPI_DOUBLE_PRECISION,MPI_SUM,GFS_Control%communicator,ierror)
Expand All @@ -454,7 +453,7 @@ subroutine atmos_timestep_diagnostics(Atmos)
sendbuf(1:2) = (/ maxabs, dble(GFS_Control%me) /)
call MPI_Allreduce(sendbuf,recvbuf,1,MPI_2DOUBLE_PRECISION,MPI_MAXLOC,GFS_Control%communicator,ierror)
call MPI_Bcast(pmaxloc,size(pmaxloc),MPI_DOUBLE_PRECISION,nint(recvbuf(2)),GFS_Control%communicator,ierror)

if(GFS_Control%me == GFS_Control%master) then
2933 format('At forecast hour ',F9.3,' mean abs pgr change is ',F16.8,' hPa/hr')
2934 format(' max abs change ',F15.10,' bar at tile=',I0,' i=',I0,' j=',I0)
Expand Down Expand Up @@ -491,23 +490,17 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
type (atmos_data_type), intent(inout) :: Atmos
type (time_type), intent(in) :: Time_init, Time, Time_step
!--- local variables ---
integer :: unit, ntdiag, ntfamily, i, j, k
integer :: mlon, mlat, nlon, nlat, nlev, sec, dt
integer :: unit, i
integer :: mlon, mlat, nlon, nlat, nlev, sec
integer :: ierr, io, logunit
integer :: idx, tile_num
integer :: tile_num
integer :: isc, iec, jsc, jec
integer :: isd, ied, jsd, jed
integer :: blk, ibs, ibe, jbs, jbe
real(kind=GFS_kind_phys) :: dt_phys
real, allocatable :: q(:,:,:,:), p_half(:,:,:)
character(len=80) :: control
character(len=64) :: filename, filename2, pelist_name
character(len=132) :: text
logical :: p_hydro, hydro, fexist
logical :: p_hydro, hydro
logical, save :: block_message = .true.
type(GFS_init_type) :: Init_parm
integer :: bdat(8), cdat(8)
integer :: ntracers, maxhf, maxh
integer :: ntracers
character(len=32), allocatable, target :: tracer_names(:)
integer, allocatable, target :: tracer_types(:)
integer :: nthrds, nb
Expand Down Expand Up @@ -547,7 +540,7 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
!----------------------------------------------------------------------------------------------
! initialize atmospheric model - must happen AFTER atmosphere_init so that nests work correctly

IF ( file_exists('input.nml')) THEN
if (file_exists('input.nml')) then
read(input_nml_file, nml=atmos_model_nml, iostat=io)
ierr = check_nml_error(io, 'atmos_model_nml')
endif
Expand Down Expand Up @@ -635,19 +628,10 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
Init_parm%restart = Atm(mygrid)%flagstruct%warm_start
Init_parm%hydrostatic = Atm(mygrid)%flagstruct%hydrostatic

#ifdef INTERNAL_FILE_NML
! allocate required to work around GNU compiler bug 100886 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100886
allocate(Init_parm%input_nml_file, mold=input_nml_file)
Init_parm%input_nml_file => input_nml_file
Init_parm%fn_nml='using internal file'
#else
pelist_name=mpp_get_current_pelist_name()
Init_parm%fn_nml='input_'//trim(pelist_name)//'.nml'
inquire(FILE=Init_parm%fn_nml, EXIST=fexist)
if (.not. fexist ) then
Init_parm%fn_nml='input.nml'
endif
#endif

call GFS_initialize (GFS_control, GFS_data%Statein, GFS_data%Stateout, GFS_data%Sfcprop, &
GFS_data%Coupling, GFS_data%Grid, GFS_data%Tbd, GFS_data%Cldprop, GFS_data%Radtend, &
Expand Down Expand Up @@ -964,7 +948,7 @@ subroutine atmos_model_end (Atmos)
use update_ca, only: write_ca_restart
type (atmos_data_type), intent(inout) :: Atmos
!---local variables
integer :: idx, seconds, ierr
integer :: ierr

!-----------------------------------------------------------------------
!---- termination routine for atmospheric model ----
Expand Down Expand Up @@ -993,6 +977,8 @@ subroutine atmos_model_end (Atmos)
call CCPP_step (step="finalize", nblks=Atm_block%nblks, ierr=ierr)
if (ierr/=0) call mpp_error(FATAL, 'Call to CCPP finalize step failed')

call dealloc_atmos_data_type (Atmos)

end subroutine atmos_model_end

! </SUBROUTINE>
Expand Down Expand Up @@ -1541,53 +1527,6 @@ subroutine update_atmos_chemistry(state, rc)
end select

end subroutine update_atmos_chemistry
! </SUBROUTINE>

!#######################################################################
! <SUBROUTINE NAME="atmos_data_type_chksum">
!
! <OVERVIEW>
! Print checksums of the various fields in the atmos_data_type.
! </OVERVIEW>

! <DESCRIPTION>
! Routine to print checksums of the various fields in the atmos_data_type.
! </DESCRIPTION>

! <TEMPLATE>
! call atmos_data_type_chksum(id, timestep, atm)
! </TEMPLATE>

! <IN NAME="Atm" TYPE="type(atmos_data_type)">
! Derived-type variable that contains fields in the atmos_data_type.
! </INOUT>
!
! <IN NAME="id" TYPE="character">
! Label to differentiate where this routine in being called from.
! </IN>
!
! <IN NAME="timestep" TYPE="integer">
! An integer to indicate which timestep this routine is being called for.
! </IN>
!
subroutine atmos_data_type_chksum(id, timestep, atm)
type(atmos_data_type), intent(in) :: atm
character(len=*), intent(in) :: id
integer , intent(in) :: timestep
integer :: n, outunit

100 format("CHECKSUM::",A32," = ",Z20)
101 format("CHECKSUM::",A16,a,'%',a," = ",Z20)

outunit = stdout()
write(outunit,*) 'BEGIN CHECKSUM(Atmos_data_type):: ', id, timestep
write(outunit,100) ' atm%lon_bnd ', mpp_chksum(atm%lon_bnd)
write(outunit,100) ' atm%lat_bnd ', mpp_chksum(atm%lat_bnd)
write(outunit,100) ' atm%lon ', mpp_chksum(atm%lon)
write(outunit,100) ' atm%lat ', mpp_chksum(atm%lat)

end subroutine atmos_data_type_chksum

! </SUBROUTINE>

subroutine alloc_atmos_data_type (nlon, nlat, Atmos)
Expand Down Expand Up @@ -1623,7 +1562,6 @@ subroutine assign_importdata(jdat, rc)
integer :: sphum, liq_wat, ice_wat, o3mr
character(len=128) :: impfield_name, fldname
type(ESMF_TypeKind_Flag) :: datatype
real(kind=ESMF_KIND_R4), dimension(:,:), pointer :: datar42d
real(kind=ESMF_KIND_R8), dimension(:,:), pointer :: datar82d
real(kind=ESMF_KIND_R8), dimension(:,:,:), pointer:: datar83d
real(kind=GFS_kind_phys), dimension(:,:), pointer :: datar8
Expand Down Expand Up @@ -1690,10 +1628,6 @@ subroutine assign_importdata(jdat, rc)
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'in cplIMP,atmos gets ',trim(impfield_name),' datar8=', &
datar8(isc,jsc), maxval(datar8), minval(datar8)
found = .true.
! gfs physics runs with r8
! else
! call ESMF_FieldGet(importFields(n),farrayPtr=datar42d,localDE=0, rc=rc)
! datar8 = datar42d
endif

else if( dimCount == 3) then
Expand Down Expand Up @@ -2560,9 +2494,9 @@ subroutine setup_exportdata(rc)
integer, optional, intent(out) :: rc

!--- local variables
integer :: i, j, k, idx, ix
integer :: i, j, ix
integer :: isc, iec, jsc, jec
integer :: ib, jb, nb, nsb, nk
integer :: nb, nk
integer :: sphum, liq_wat, ice_wat, o3mr
real(GFS_kind_phys) :: rtime, rtimek

Expand All @@ -2586,7 +2520,6 @@ subroutine setup_exportdata(rc)
jsc = Atm_block%jsc
jec = Atm_block%jec
nk = Atm_block%npz
nsb = Atm_block%blkno(isc,jsc)

rtime = one / GFS_control%dtp
rtimek = GFS_control%rho_h2o * rtime
Expand Down Expand Up @@ -2895,7 +2828,6 @@ subroutine addLsmask2grid(fcstGrid, rc)
integer isc, iec, jsc, jec
integer i, j, nb, ix
! integer CLbnd(2), CUbnd(2), CCount(2), TLbnd(2), TUbnd(2), TCount(2)
type(ESMF_StaggerLoc) :: staggerloc
integer, allocatable :: lsmask(:,:)
integer(kind=ESMF_KIND_I4), pointer :: maskPtr(:,:)
!
Expand Down
44 changes: 13 additions & 31 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3740,46 +3740,46 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &

if(gwd_opt==1) then
if(me==master) &
write(0,*) 'FLAG: gwd_opt==1 so gwd not generic'
write(*,*) 'FLAG: gwd_opt==1 so gwd not generic'
Model%flag_for_gwd_generic_tend=.false.
elseif(me==master) then
write(0,*) 'NO FLAG: gwd is generic'
write(*,*) 'NO FLAG: gwd is generic'
endif

if(satmedmf .and. isatmedmf==0) then
if(me==master) &
write(0,*) 'FLAG: satmedmf and isatedmf=0 so pbl not generic'
write(*,*) 'FLAG: satmedmf and isatedmf=0 so pbl not generic'
Model%flag_for_pbl_generic_tend=.false.
elseif(satmedmf .and. isatmedmf==1) then
if(me==master) &
write(0,*) 'FLAG: satmedmf and isatedmf=1 so pbl not generic'
write(*,*) 'FLAG: satmedmf and isatedmf=1 so pbl not generic'
Model%flag_for_pbl_generic_tend=.false.
else if(hybedmf) then
if(me==master) &
write(0,*) 'FLAG: hybedmf so pbl not generic'
write(*,*) 'FLAG: hybedmf so pbl not generic'
Model%flag_for_pbl_generic_tend=.false.
else if(do_mynnedmf) then
if(me==master) &
write(0,*) 'FLAG: do_mynnedmf so pbl not generic'
write(*,*) 'FLAG: do_mynnedmf so pbl not generic'
Model%flag_for_pbl_generic_tend=.false.
elseif(me==master) then
write(0,*) 'NO FLAG: pbl is generic'
write(*,*) 'NO FLAG: pbl is generic'
endif

if(imfshalcnv == Model%imfshalcnv_gf) then
if(me==master) &
write(0,*) 'FLAG: imfshalcnv_gf so scnv not generic'
write(*,*) 'FLAG: imfshalcnv_gf so scnv not generic'
Model%flag_for_scnv_generic_tend=.false.
elseif(me==master) then
write(0,*) 'NO FLAG: scnv is generic'
write(*,*) 'NO FLAG: scnv is generic'
endif

if(imfdeepcnv == Model%imfdeepcnv_gf) then
if(me==master) &
write(0,*) 'FLAG: imfdeepcnv_gf so dcnv not generic'
write(*,*) 'FLAG: imfdeepcnv_gf so dcnv not generic'
Model%flag_for_dcnv_generic_tend=.false.
elseif(me==master) then
write(0,*) 'NO FLAG: dcnv is generic'
write(*,*) 'NO FLAG: dcnv is generic'
endif

!
Expand Down Expand Up @@ -5063,7 +5063,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%num_p3d = 4
Model%num_p2d = 3
Model%shcnvcw = .false.
! Model%ncnd = 1 ! ncnd is the number of cloud condensate types
Model%nT2delt = 1
Model%nqv2delt = 2
Model%nTdelt = 3
Expand All @@ -5080,7 +5079,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%npdf3d = 3
Model%num_p3d = 4
Model%num_p2d = 3
! Model%ncnd = 1
if (Model%me == Model%master) print *,'Using Zhao/Carr/Sundqvist Microphysics with PDF Cloud'

else if (Model%imp_physics == Model%imp_physics_fer_hires) then ! Ferrier-Aligo scheme
Expand All @@ -5089,8 +5087,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%num_p2d = 1
Model%pdfcld = .false.
Model%shcnvcw = .false.
! DH* REALLY ?
! Model%ncnd = 3 !???????? need to clarify this - Moorthi
Model%nleffr = 1
Model%nieffr = 2
Model%nseffr = 3
Expand All @@ -5110,7 +5106,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
!Model%num_p2d = 1
!Model%pdfcld = .false.
!Model%shcnvcw = .false.
! !Model%ncnd = 5
!Model%nleffr = 1
!Model%nieffr = 2
!Model%nseffr = 3
Expand All @@ -5122,7 +5117,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%num_p2d = 1
Model%pdfcld = .false.
Model%shcnvcw = .false.
! Model%ncnd = 5
Model%nleffr = 1
Model%nieffr = 2
Model%nseffr = 3
Expand Down Expand Up @@ -5153,7 +5147,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%num_p2d = 1
Model%pdfcld = .false.
Model%shcnvcw = .false.
! Model%ncnd = 2
Model%nleffr = 2
Model%nieffr = 3
Model%nreffr = 4
Expand All @@ -5166,16 +5159,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
print *,' Morrison-Gettelman MP requires nwat to be set to 6 - job aborted'
stop
end if
! if (abs(Model%fprcp) == 1) then
! Model%ncnd = 4
! elseif (Model%fprcp >= 2) then
! Model%ncnd = 4
! if (Model%mg_do_graupel .or. Model%mg_do_hail) then
! Model%ncnd = 5
! endif
! Model%num_p3d = 6
! Model%ngeffr = 6
! endif
if (Model%me == Model%master) &
print *,' Using Morrison-Gettelman double moment microphysics', &
' iaerclm=', Model%iaerclm, ' iccn=', Model%iccn, &
Expand Down Expand Up @@ -5212,7 +5195,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%num_p2d = 1
Model%pdfcld = .false.
Model%shcnvcw = .false.
! Model%ncnd = 5
if (nwat /= 6) then
print *,' GFDL MP requires nwat to be set to 6 - job aborted'
stop
Expand All @@ -5226,7 +5208,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
endif

if(Model%ras .or. Model%cscnv) Model%cnvcld = .false.
if(Model%do_shoc .or. Model%pdfcld .or. Model%do_mynnedmf) Model%cnvcld = .false.
if(Model%do_shoc .or. Model%pdfcld .or. Model%do_mynnedmf .or. Model%imfdeepcnv == Model%imfdeepcnv_gf) Model%cnvcld = .false.
if(Model%cnvcld) Model%ncnvcld3d = 1

!--- get cnvwind index in phy_f2d; last entry in phy_f2d array
Expand Down Expand Up @@ -5268,7 +5250,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
endif

if (me == Model%master) &
write(0,*) ' num_p3d=', Model%num_p3d, ' num_p2d=', Model%num_p2d, &
write(*,*) ' num_p3d=', Model%num_p3d, ' num_p2d=', Model%num_p2d, &
' crtrh=', Model%crtrh, ' npdf3d=', Model%npdf3d, &
' pdfcld=', Model%pdfcld, ' shcnvcw=', Model%shcnvcw, &
' cnvcld=', Model%cnvcld, ' ncnvcld3d=',Model%ncnvcld3d, &
Expand Down
Loading

0 comments on commit 0bc59dc

Please sign in to comment.