Skip to content

Commit

Permalink
Merge pull request #294 from climbfuji/bugfix_ruclsm_ice_temp_landmas…
Browse files Browse the repository at this point in the history
…k_landuse_inconsistencies

Bugfix RUC LSM ice temperature initialization, landmask/landuse inconsistencies
  • Loading branch information
climbfuji committed Aug 13, 2019
2 parents c2bbaea + e4e75a3 commit db6046a
Show file tree
Hide file tree
Showing 5 changed files with 390 additions and 233 deletions.
136 changes: 136 additions & 0 deletions physics/GFS_debug.F90
Original file line number Diff line number Diff line change
Expand Up @@ -933,3 +933,139 @@ subroutine GFS_abort_run (Model, blkno, errmsg, errflg)
end subroutine GFS_abort_run

end module GFS_abort

module GFS_checkland

private

public GFS_checkland_init, GFS_checkland_run, GFS_checkland_finalize

contains

subroutine GFS_checkland_init ()
end subroutine GFS_checkland_init

subroutine GFS_checkland_finalize ()
end subroutine GFS_checkland_finalize

!> \section arg_table_GFS_checkland_run Argument Table
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |--------------|---------------------------------------|----------------------------------------------------------|-------|------|-----------|-----------|--------|----------|
!! | me | mpi_rank | current MPI-rank | index | 0 | integer | | in | F |
!! | master | mpi_root | master MPI-rank | index | 0 | integer | | in | F |
!! | blkno | ccpp_block_number | number of block for explicit data blocking in CCPP | index | 0 | integer | | in | F |
!! | im | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F |
!! | kdt | index_of_time_step | current number of time steps | index | 0 | integer | | in | F |
!! | iter | ccpp_loop_counter | loop counter for subcycling loops in CCPP | index | 0 | integer | | in | F |
!! | flag_iter | flag_for_iteration | flag for iteration | flag | 1 | logical | | in | F |
!! | flag_guess | flag_for_guess_run | flag for guess run | flag | 1 | logical | | in | F |
!! | flag_init | flag_for_first_time_step | flag signaling first time step for time integration loop | flag | 0 | logical | | in | F |
!! | flag_restart | flag_for_restart | flag for restart (warmstart) or coldstart | flag | 0 | logical | | in | F |
!! | frac_grid | flag_for_fractional_grid | flag for fractional grid | flag | 0 | logical | | in | F |
!! | isot | soil_type_dataset_choice | soil type dataset choice | index | 0 | integer | | in | F |
!! | ivegsrc | vegetation_type_dataset_choice | land use dataset choice | index | 0 | integer | | in | F |
!! | stype | soil_type_classification_real | soil type for lsm | index | 1 | real | kind_phys | in | F |
!! | vtype | vegetation_type_classification_real | vegetation type for lsm | index | 1 | real | kind_phys | in | F |
!! | slope | surface_slope_classification_real | sfc slope type for lsm | index | 1 | real | kind_phys | in | F |
!! | soiltyp | soil_type_classification | soil type at each grid cell | index | 1 | integer | | in | F |
!! | vegtype | vegetation_type_classification | vegetation type at each grid cell | index | 1 | integer | | in | F |
!! | slopetyp | surface_slope_classification | surface slope type at each grid cell | index | 1 | integer | | in | F |
!! | dry | flag_nonzero_land_surface_fraction | flag indicating some land surface area fraction | flag | 1 | logical | | in | F |
!! | icy | flag_nonzero_sea_ice_surface_fraction | flag indicating some sea ice surface area fraction | flag | 1 | logical | | in | F |
!! | wet | flag_nonzero_wet_surface_fraction | flag indicating some ocean or lake surface area fraction | flag | 1 | logical | | in | F |
!! | lake | flag_nonzero_lake_surface_fraction | flag indicating some lake surface area fraction | flag | 1 | logical | | in | F |
!! | ocean | flag_nonzero_ocean_surface_fraction | flag indicating some ocean surface area fraction | flag | 1 | logical | | in | F |
!! | oceanfrac | sea_area_fraction | fraction of horizontal grid area occupied by ocean | frac | 1 | real | kind_phys | in | F |
!! | landfrac | land_area_fraction | fraction of horizontal grid area occupied by land | frac | 1 | real | kind_phys | in | F |
!! | lakefrac | lake_area_fraction | fraction of horizontal grid area occupied by lake | frac | 1 | real | kind_phys | in | F |
!! | slmsk | sea_land_ice_mask_real | landmask: sea/land/ice=0/1/2 | flag | 1 | real | kind_phys | in | F |
!! | islmsk | sea_land_ice_mask | sea/land/ice mask (=0/1/2) | flag | 1 | integer | | in | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
subroutine GFS_checkland_run (me, master, blkno, im, kdt, iter, flag_iter, flag_guess, &
flag_init, flag_restart, frac_grid, isot, ivegsrc, stype, vtype, slope, &
soiltyp, vegtype, slopetyp, dry, icy, wet, lake, ocean, &
oceanfrac, landfrac, lakefrac, slmsk, islmsk, errmsg, errflg )

use machine, only: kind_phys

implicit none

! Interface variables
integer, intent(in ) :: me
integer, intent(in ) :: master
integer, intent(in ) :: blkno
integer, intent(in ) :: im
integer, intent(in ) :: kdt
integer, intent(in ) :: iter
logical, intent(in ) :: flag_iter(im)
logical, intent(in ) :: flag_guess(im)
logical, intent(in ) :: flag_init
logical, intent(in ) :: flag_restart
logical, intent(in ) :: frac_grid
integer, intent(in ) :: isot
integer, intent(in ) :: ivegsrc
real(kind_phys), intent(in ) :: stype(im)
real(kind_phys), intent(in ) :: vtype(im)
real(kind_phys), intent(in ) :: slope(im)
integer, intent(in ) :: soiltyp(im)
integer, intent(in ) :: vegtype(im)
integer, intent(in ) :: slopetyp(im)
logical, intent(in ) :: dry(im)
logical, intent(in ) :: icy(im)
logical, intent(in ) :: wet(im)
logical, intent(in ) :: lake(im)
logical, intent(in ) :: ocean(im)
real(kind_phys), intent(in ) :: oceanfrac(im)
real(kind_phys), intent(in ) :: landfrac(im)
real(kind_phys), intent(in ) :: lakefrac(im)
real(kind_phys), intent(in ) :: slmsk(im)
integer, intent(in ) :: islmsk(im)
character(len=*), intent( out) :: errmsg
integer, intent( out) :: errflg

! Local variables
integer :: i

errflg = 0
errmsg = ''

write(0,'(a,i5)') 'YYY: me :', me
write(0,'(a,i5)') 'YYY: master :', master
write(0,'(a,i5)') 'YYY: blkno :', blkno
write(0,'(a,i5)') 'YYY: im :', im
write(0,'(a,i5)') 'YYY: kdt :', kdt
write(0,'(a,i5)') 'YYY: iter :', iter
write(0,'(a,1x,l)') 'YYY: flag_init :', flag_init
write(0,'(a,1x,l)') 'YYY: flag_restart :', flag_restart
write(0,'(a,1x,l)') 'YYY: frac_grid :', frac_grid
write(0,'(a,i5)') 'YYY: isot :', isot
write(0,'(a,i5)') 'YYY: ivegsrc :', ivegsrc

do i=1,im
!if (vegtype(i)==15) then
write(0,'(a,2i5,1x,1x,l)') 'YYY: i, blk, flag_iter(i) :', i, blkno, flag_iter(i)
write(0,'(a,2i5,1x,1x,l)') 'YYY: i, blk, flag_guess(i) :', i, blkno, flag_guess(i)
write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, stype(i) :', i, blkno, stype(i)
write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, vtype(i) :', i, blkno, vtype(i)
write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, slope(i) :', i, blkno, slope(i)
write(0,'(a,2i5,1x,i5)') 'YYY: i, blk, soiltyp(i) :', i, blkno, soiltyp(i)
write(0,'(a,2i5,1x,i5)') 'YYY: i, blk, vegtype(i) :', i, blkno, vegtype(i)
write(0,'(a,2i5,1x,i5)') 'YYY: i, blk, slopetyp(i) :', i, blkno, slopetyp(i)
write(0,'(a,2i5,1x,1x,l)') 'YYY: i, blk, dry(i) :', i, blkno, dry(i)
write(0,'(a,2i5,1x,1x,l)') 'YYY: i, blk, icy(i) :', i, blkno, icy(i)
write(0,'(a,2i5,1x,1x,l)') 'YYY: i, blk, wet(i) :', i, blkno, wet(i)
write(0,'(a,2i5,1x,1x,l)') 'YYY: i, blk, lake(i) :', i, blkno, lake(i)
write(0,'(a,2i5,1x,1x,l)') 'YYY: i, blk, ocean(i) :', i, blkno, ocean(i)
write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, oceanfrac(i) :', i, blkno, oceanfrac(i)
write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, landfrac(i) :', i, blkno, landfrac(i)
write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, lakefrac(i) :', i, blkno, lakefrac(i)
write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, slmsk(i) :', i, blkno, slmsk(i)
write(0,'(a,2i5,1x,i5)') 'YYY: i, blk, islmsk(i) :', i, blkno, islmsk(i)
!end if
end do

end subroutine GFS_checkland_run

end module GFS_checkland
6 changes: 0 additions & 6 deletions physics/GFS_phys_time_vary.scm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -367,25 +367,19 @@ subroutine GFS_phys_time_vary_run (Grid, Statein, Model, Tbd, Sfcprop, Cldprop,
sec_zero = nint(Model%fhzero*con_hr)
if (sec_zero >= nint(max(Model%fhswr,Model%fhlwr))) then
if (mod(Model%kdt,Model%nszero) == 1) then
do nb = 1,nblks
call Diag%rad_zero (Model)
call Diag%phys_zero (Model)
!!!! THIS IS THE POINT AT WHICH DIAG%ZHOUR NEEDS TO BE UPDATED
enddo
endif
else
if (mod(Model%kdt,Model%nszero) == 1) then
do nb = 1,nblks
call Diag%phys_zero (Model)
!!!! THIS IS THE POINT AT WHICH DIAG%ZHOUR NEEDS TO BE UPDATED
enddo
endif
kdt_rad = nint(min(Model%fhswr,Model%fhlwr)/Model%dtp)
if (mod(Model%kdt, kdt_rad) == 1) then
do nb = 1,nblks
call Diag%rad_zero (Model)
!!!! THIS IS THE POINT AT WHICH DIAG%ZHOUR NEEDS TO BE UPDATED
enddo
endif
endif

Expand Down
26 changes: 13 additions & 13 deletions physics/module_mp_thompson.F90
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,8 @@ SUBROUTINE thompson_init(nwfa2d, nifa2d, nwfa, nifa, &
enddo
enddo

if (mpirank==mpiroot) WRITE (*,*)'CREATING MICROPHYSICS LOOKUP TABLES ... '
if (mpirank==mpiroot) WRITE (*,'(a, f5.2, a, f5.2, a, f5.2, a, f5.2)') &
if (mpirank==mpiroot) write (*,*)'creating microphysics lookup tables ... '
if (mpirank==mpiroot) write (*,'(a, f5.2, a, f5.2, a, f5.2, a, f5.2)') &
' using: mu_c=',mu_c,' mu_i=',mu_i,' mu_r=',mu_r,' mu_g=',mu_g

!> - Call table_ccnact() to read a static file containing CCN activation of aerosols. The
Expand All @@ -883,18 +883,18 @@ SUBROUTINE thompson_init(nwfa2d, nifa2d, nwfa, nifa, &
! This computation is cheap compared to the others below, and
! doing it always ensures that the correct data is in the SIONlib
! file containing the precomputed tables *DH
WRITE (*,*) ' calling table_ccnAct routine'
if (mpirank==mpiroot) write(0,*) ' calling table_ccnAct routine'
call table_ccnAct(errmsg,errflg)
if (.not. errflg==0) return

!> - Call table_efrw() and table_efsw() to creat collision efficiency table
!! between rain/snow and cloud water
WRITE (*,*)' creating qc collision eff tables'
if (mpirank==mpiroot) write(0,*) ' creating qc collision eff tables'
call table_Efrw
call table_Efsw

!> - Call table_dropevap() to creat rain drop evaporation table
WRITE(*,*) ' creating rain evap table'
if (mpirank==mpiroot) write(0,*) ' creating rain evap table'
call table_dropEvap

call cpu_time(etime)
Expand Down Expand Up @@ -930,15 +930,15 @@ SUBROUTINE thompson_init(nwfa2d, nifa2d, nwfa, nifa, &

!$OMP section
!> - Call qr_acr_qg() to create rain collecting graupel & graupel collecting rain table
WRITE (*,*) ' creating rain collecting graupel table'
if (mpirank==mpiroot) write(0,*) ' creating rain collecting graupel table'
call cpu_time(stime)
call qr_acr_qg
call cpu_time(etime)
if (mpirank==mpiroot) print '("Computing rain collecting graupel table took ",f10.3," seconds.")', etime-stime

!$OMP section
!> - Call qr_acr_qs() to create rain collecting snow & snow collecting rain table
WRITE (*,*) ' creating rain collecting snow table'
if (mpirank==mpiroot) write (*,*) ' creating rain collecting snow table'
call cpu_time(stime)
call qr_acr_qs
call cpu_time(etime)
Expand All @@ -949,14 +949,14 @@ SUBROUTINE thompson_init(nwfa2d, nifa2d, nwfa, nifa, &
!$OMP end parallel

!> - Call freezeh2o() to create cloud water and rain freezing (Bigg, 1953) table
WRITE (*,*) ' creating freezing of water drops table'
if (mpirank==mpiroot) write(0,*) ' creating freezing of water drops table'
call cpu_time(stime)
call freezeH2O(threads)
call cpu_time(etime)
if (mpirank==mpiroot) print '("Computing freezing of water drops table took ",f10.3," seconds.")', etime-stime

!> - Call qi_aut_qs() to create conversion of some ice mass into snow category
WRITE (*,*) ' creating ice converting to snow table'
if (mpirank==mpiroot) write(0,*) ' creating ice converting to snow table'
call cpu_time(stime)
call qi_aut_qs
call cpu_time(etime)
Expand Down Expand Up @@ -988,7 +988,7 @@ SUBROUTINE thompson_init(nwfa2d, nifa2d, nwfa, nifa, &

endif if_not_iiwarm

WRITE (*,*) ' ... DONE microphysical lookup tables'
if (mpirank==mpiroot) write(0,*) ' ... DONE microphysical lookup tables'

endif if_micro_init

Expand Down Expand Up @@ -3733,7 +3733,7 @@ subroutine qr_acr_qg
call MPI_BARRIER(mpi_communicator,ierr)
#endif
IF ( lexist ) THEN
write(0,*) "ThompMP: read qr_acr_qg.dat instead of computing"
!write(0,*) "ThompMP: read qr_acr_qg.dat instead of computing"
OPEN(63,file="qr_acr_qg.dat",form="unformatted",err=1234)
!sms$serial begin
READ(63,err=1234) tcg_racg
Expand Down Expand Up @@ -3909,7 +3909,7 @@ subroutine qr_acr_qs
call MPI_BARRIER(mpi_communicator,ierr)
#endif
IF ( lexist ) THEN
write(0,*) "ThompMP: read qr_acr_qs.dat instead of computing"
!write(0,*) "ThompMP: read qr_acr_qs.dat instead of computing"
OPEN(63,file="qr_acr_qs.dat",form="unformatted",err=1234)
!sms$serial begin
READ(63,err=1234)tcs_racs1
Expand Down Expand Up @@ -4170,7 +4170,7 @@ subroutine freezeH2O(threads)
call MPI_BARRIER(mpi_communicator,ierr)
#endif
IF ( lexist ) THEN
write(0,*) "ThompMP: read freezeH2O.dat instead of computing"
!write(0,*) "ThompMP: read freezeH2O.dat instead of computing"
OPEN(63,file="freezeH2O.dat",form="unformatted",err=1234)
!sms$serial begin
READ(63,err=1234)tpi_qrfz
Expand Down
29 changes: 19 additions & 10 deletions physics/module_sf_ruclsm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7020,7 +7020,7 @@ END SUBROUTINE SOILVEGIN
!> This subroutine computes liquid and forezen soil moisture from the
!! total soil moisture, and also computes soil moisture availability in
!! the top soil layer.
SUBROUTINE RUCLSMINIT( debug_print, &
SUBROUTINE RUCLSMINIT( debug_print, landmask, &
nzs, isltyp, ivgtyp, xice, mavail, &
sh2o, smfr3d, tslb, smois, &
ims,ime, jms,jme, kms,kme, &
Expand All @@ -7044,6 +7044,9 @@ SUBROUTINE RUCLSMINIT( debug_print, &
INTENT(IN) :: TSLB, &
SMOIS

REAL, DIMENSION( ims:ime, jms:jme ) , &
INTENT(IN) :: LANDMASK

INTEGER, DIMENSION( ims:ime, jms:jme ) , &
INTENT(INOUT) :: ISLTYP,IVGTYP

Expand Down Expand Up @@ -7072,6 +7075,9 @@ SUBROUTINE RUCLSMINIT( debug_print, &
errflag = 0
DO j = jts,jtf
DO i = its,itf
! land-only version
IF ( LANDMASK( i,j ) .NE. 1 ) CYCLE
!
IF ( ISLTYP( i,j ) .LT. 0 ) THEN
errflag = 1
print *, &
Expand All @@ -7086,18 +7092,21 @@ SUBROUTINE RUCLSMINIT( debug_print, &
ENDIF

DO J=jts,jtf
DO I=its,itf
DO I=its,itf

! land-only version
IF ( LANDMASK( i,j ) .NE. 1 ) CYCLE

!--- Computation of volumetric content of ice in soil
!--- and initialize MAVAIL
if(ISLTYP(I,J) > 0) then
DQM = MAXSMC (ISLTYP(I,J)) - &
DRYSMC (ISLTYP(I,J))
REF = REFSMC (ISLTYP(I,J))
PSIS = - SATPSI (ISLTYP(I,J))
QMIN = DRYSMC (ISLTYP(I,J))
BCLH = BB (ISLTYP(I,J))
endif
if(ISLTYP(I,J) > 0) then
DQM = MAXSMC (ISLTYP(I,J)) - &
DRYSMC (ISLTYP(I,J))
REF = REFSMC (ISLTYP(I,J))
PSIS = - SATPSI (ISLTYP(I,J))
QMIN = DRYSMC (ISLTYP(I,J))
BCLH = BB (ISLTYP(I,J))
endif


! in Zobler classification isltyp=0 for water. Statsgo classification
Expand Down
Loading

0 comments on commit db6046a

Please sign in to comment.