From 11e5d6f7ceb1924eb14f05c532ba8f1559191775 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Mon, 29 Jul 2019 13:19:40 -0600 Subject: [PATCH 1/6] remove loops over nblks in SCM-related GFS_phys_time_vary --- physics/GFS_phys_time_vary.scm.F90 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/physics/GFS_phys_time_vary.scm.F90 b/physics/GFS_phys_time_vary.scm.F90 index 200881d2c..a69df6c79 100644 --- a/physics/GFS_phys_time_vary.scm.F90 +++ b/physics/GFS_phys_time_vary.scm.F90 @@ -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 From b0188e4f6f0d925d676468c5c803357254b59595 Mon Sep 17 00:00:00 2001 From: climbfuji Date: Fri, 9 Aug 2019 10:16:47 -0600 Subject: [PATCH 2/6] physics/GFS_debug.F90: add new module/scheme GFS_checkland --- physics/GFS_debug.F90 | 136 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/physics/GFS_debug.F90 b/physics/GFS_debug.F90 index c0bfef12b..7eaf81434 100644 --- a/physics/GFS_debug.F90 +++ b/physics/GFS_debug.F90 @@ -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 From 00d4ddc61913e19fba734aa588bbcc8c6c762b4a Mon Sep 17 00:00:00 2001 From: climbfuji Date: Fri, 9 Aug 2019 10:27:39 -0600 Subject: [PATCH 3/6] physics/module_mp_thompson.F90: reduce debug/info output from scheme --- physics/module_mp_thompson.F90 | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/physics/module_mp_thompson.F90 b/physics/module_mp_thompson.F90 index f1b462b1e..1a8529231 100644 --- a/physics/module_mp_thompson.F90 +++ b/physics/module_mp_thompson.F90 @@ -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 @@ -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) @@ -930,7 +930,7 @@ 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) @@ -938,7 +938,7 @@ SUBROUTINE thompson_init(nwfa2d, nifa2d, nwfa, nifa, & !$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) @@ -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) @@ -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 @@ -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 @@ -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 @@ -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 From 1180673d69ec3489228ff1b2e49b17a386f22c2f Mon Sep 17 00:00:00 2001 From: climbfuji Date: Fri, 9 Aug 2019 16:22:54 -0600 Subject: [PATCH 4/6] physics/module_sf_ruclsm.F90: run ruclsminit only over land points --- physics/module_sf_ruclsm.F90 | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/physics/module_sf_ruclsm.F90 b/physics/module_sf_ruclsm.F90 index 9ffc8f49b..ea5800736 100644 --- a/physics/module_sf_ruclsm.F90 +++ b/physics/module_sf_ruclsm.F90 @@ -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, & @@ -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 @@ -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 *, & @@ -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 From 1c94e238502d6330b7ed5628aeeafeafe0dc7f30 Mon Sep 17 00:00:00 2001 From: climbfuji Date: Fri, 9 Aug 2019 16:26:46 -0600 Subject: [PATCH 5/6] physics/sfc_drv_ruc.F90: convert print to write statements, add guard to prevent using unconfigured ivegsrc, add check for inconsistent landmask and landuse classification, correctly initialize RUC subsurface data for non-land points for both Noah and RUC input data --- physics/sfc_drv_ruc.F90 | 422 +++++++++++++++++++++------------------- 1 file changed, 218 insertions(+), 204 deletions(-) diff --git a/physics/sfc_drv_ruc.F90 b/physics/sfc_drv_ruc.F90 index 5e4f37d34..bb8c46d9e 100644 --- a/physics/sfc_drv_ruc.F90 +++ b/physics/sfc_drv_ruc.F90 @@ -146,6 +146,7 @@ end subroutine lsm_ruc_finalize !! |----------------------|------------------------------------------------------------------------------|-----------------------------------------------------------------|---------------|------|-----------|-----------|--------|----------| !! | delt | time_step_for_dynamics | physics time step | s | 0 | real | kind_phys | in | F | !! | me | mpi_rank | current MPI-rank | index | 0 | integer | | in | F | +!! | master | mpi_root | master MPI-rank | index | 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 | !! | im | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F | @@ -254,7 +255,7 @@ end subroutine lsm_ruc_finalize !>\section gen_lsmruc GSD RUC LSM General Algorithm ! DH* TODO - make order of arguments the same as in the metadata table subroutine lsm_ruc_run & ! inputs - & ( iter, me, kdt, im, nlev, lsoil_ruc, lsoil, zs, & + & ( iter, me, master, kdt, im, nlev, lsoil_ruc, lsoil, zs, & & u1, v1, t1, q1, qc, soiltyp, vegtype, sigmaf, & & sfcemis, dlwflx, dswsfc, snet, delt, tg3, cm, ch, & & prsl1, zf, ddvel, shdmin, shdmax, alvwf, alnwf, & @@ -282,7 +283,7 @@ subroutine lsm_ruc_run & ! inputs real(kind=kind_phys), parameter :: stbolt = 5.670400e-8 ! --- input: - integer, intent(in) :: me + integer, intent(in) :: me, master integer, intent(in) :: im, nlev, iter, lsoil_ruc, lsoil, kdt, isot, ivegsrc integer, intent(in) :: lsm_ruc, lsm integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson @@ -407,21 +408,21 @@ subroutine lsm_ruc_run & ! inputs allocate(landusef(im,nlcat,1)) if(debug_print) then - print *,'RUC LSM run' - print *,'noah soil temp',ipr,stc(ipr,:) - print *,'noah soil mois',ipr,smc(ipr,:) - print *,'soiltyp=',ipr,soiltyp(ipr) - print *,'vegtype=',ipr,vegtype(ipr) - print *,'kdt, iter =',kdt,iter - print *,'flag_init =',flag_init - print *,'flag_restart =',flag_restart + write (0,*)'RUC LSM run' + write (0,*)'noah soil temp',ipr,stc(ipr,:) + write (0,*)'noah soil mois',ipr,smc(ipr,:) + write (0,*)'soiltyp=',ipr,soiltyp(ipr) + write (0,*)'vegtype=',ipr,vegtype(ipr) + write (0,*)'kdt, iter =',kdt,iter + write (0,*)'flag_init =',flag_init + write (0,*)'flag_restart =',flag_restart endif !> - Call rucinit() at the first time step and the first interation !! for RUC initialization,then overwrite Noah soil fields !! with initialized RUC soil fields for output. if(flag_init .and. iter==1) then - !print *,'RUC LSM initialization, kdt=', kdt + if (debug_print) write (0,'(a,i0,a,l)') 'RUC LSM initialization, kdt = ', kdt, ', flag_restart = ', flag_restart call rucinit (flag_restart, im, lsoil_ruc, lsoil, nlev, & ! in isot, soiltyp, vegtype, fice, & ! in @@ -430,7 +431,7 @@ subroutine lsm_ruc_run & ! inputs smcref2, smcwlt2, & ! inout lsm_ruc, lsm, & ! in zs, sh2o, smfrkeep, tslb, smois, wetness, & ! out - errmsg, errflg) + me, master, errmsg, errflg) endif ! flag_init=.true.,iter=1 !-- end of initialization @@ -468,6 +469,10 @@ subroutine lsm_ruc_run & ! inputs llanduse = 'MODI-RUC' ! IGBP iswater = 17 isice = 15 + else + write(errmsg, '(a,i0)') 'Logic error in sfc_drv_ruc_run: iswater/isice not configured for ivegsrc=', ivegsrc + errflg = 1 + return endif fractional_seaice = 1 @@ -496,12 +501,18 @@ subroutine lsm_ruc_run & ! inputs !> - Set flag for land and ice points. !- 10may19 - ice points are turned off. flag(i) = land(i) + if (land(i) .and. (vegtype(i)==iswater .or. vegtype(i)==isice)) then + write(errmsg,'(a,i0,a,i0)') 'Logic error in sfc_drv_ruc_run: for i=', i, & + ', land(i) is true but vegtype(i) is water or ice: ', vegtype(i) + errflg = 1 + return + end if enddo do i = 1, im ! i - horizontal loop if (flag(i) .and. flag_guess(i)) then !> - Save land-related prognostic fields for guess run. - !if(me==0 .and. i==ipr) print *,'before call to RUC guess run', i + !if(me==0 .and. i==ipr) write (0,*)'before call to RUC guess run', i weasd_old(i) = weasd(i) snwdph_old(i) = snwdph(i) tskin_old(i) = tskin(i) @@ -532,7 +543,7 @@ subroutine lsm_ruc_run & ! inputs do j = 1, 1 do i = 1, im ! i - horizontal loop if (flag_iter(i) .and. flag(i)) then - !if(me==0 .and. i==ipr) print *,'iter run', iter, i, flag_iter(i),flag_guess(i) + !if(me==0 .and. i==ipr) write (0,*)'iter run', iter, i, flag_iter(i),flag_guess(i) evap (i) = 0.0 hflx (i) = 0.0 gflux(i) = 0.0 @@ -696,7 +707,7 @@ subroutine lsm_ruc_run & ! inputs xland(i,j) = 1. xice(i,j) = 0. else - print *,'MODIS landuse is not available' + write (0,*)'MODIS landuse is not available' endif ! --- units % @@ -796,99 +807,99 @@ subroutine lsm_ruc_run & ! inputs if(debug_print) then !if(me==0 .and. i==ipr) then - print *,'before RUC smsoil = ',smsoil(i,:,j), i,j - print *,'stsoil = ',stsoil(i,:,j), i,j - print *,'soilt = ',soilt(i,j), i,j - print *,'wet = ',wet(i,j), i,j - print *,'soilt1 = ',soilt1(i,j), i,j - print *,'delt =',delt - print *,'kdt =',kdt - print *,'flag_init =',flag_init - print *,'flag_restart =',flag_restart - print *,'nsoil =',nsoil - print *,'frpcpn =',frpcpn - print *,'zs =',zs - print *,'graupelncv(i,j) =',i,j,graupelncv(i,j) - print *,'snowncv(i,j) =',i,j,snowncv(i,j) - print *,'rainncv(i,j) =',i,j,rainncv(i,j) - print *,'raincv(i,j) =',i,j,raincv(i,j) - print *,'prcp(i,j) =',i,j,prcp(i,j) - print *,'sneqv(i,j) =',i,j,sneqv(i,j) - print *,'snowh(i,j) =',i,j,snowh(i,j) - print *,'sncovr(i,j) =',i,j,sncovr(i,j) - print *,'ffrozp(i,j) =',i,j,ffrozp(i,j) - print *,'conflx2(i,1,j) =',i,j,conflx2(i,1,j) - print *,'sfcprs(i,1,j) =',i,j,sfcprs(i,1,j) - print *,'sfctmp(i,1,j) =',i,j,sfctmp(i,1,j) - print *,'q2(i,1,j) =',i,j,q2(i,1,j) - print *,'qcatm(i,1,j) =',i,j,qcatm(i,1,j) - print *,'rho2(i,1,j) =',i,j,rho2(i,1,j) - print *,'lwdn(i,j) =',i,j,lwdn(i,j) - print *,'solnet(i,j) =',i,j,solnet(i,j) - print *,'sfcems(i,j) =',i,j,sfcems(i,j) - print *,'chklowq(i,j) =',i,j,chklowq(i,j) - print *,'chs(i,j) =',i,j,chs(i,j) - print *,'flqc(i,j) =',i,j,flqc(i,j) - print *,'flhc(i,j) =',i,j,flhc(i,j) - print *,'wet(i,j) =',i,j,wet(i,j) - print *,'cmc(i,j) =',i,j,cmc(i,j) - print *,'shdfac(i,j) =',i,j,shdfac(i,j) - print *,'alb(i,j) =',i,j,alb(i,j) - print *,'znt(i,j) =',i,j,znt(i,j) - print *,'z0(i,j) =',i,j,z0(i,j) - print *,'snoalb1d(i,j) =',i,j,snoalb1d(i,j) - print *,'alb(i,j) =',i,j,alb(i,j) - print *,'landusef(i,:,j) =',i,j,landusef(i,:,j) - print *,'soilctop(i,:,j) =',i,j,soilctop(i,:,j) - print *,'nlcat=',nlcat - print *,'nscat=',nscat - print *,'qsfc(i,j) =',i,j,qsfc(i,j) - print *,'qvg(i,j) =',i,j,qvg(i,j) - print *,'qsg(i,j) =',i,j,qsg(i,j) - print *,'qcg(i,j) =',i,j,qcg(i,j) - print *,'dew(i,j) =',i,j,dew(i,j) - print *,'soilt(i,j) =',i,j,soilt(i,j) - print *,'tskin(i) =',i,j,tskin(i) - print *,'soilt1(i,j) =',i,j,soilt1(i,j) - print *,'tsnav(i,j) =',i,j,tsnav(i,j) - print *,'tbot(i,j) =',i,j,tbot(i,j) - print *,'vtype(i,j) =',i,j,vtype(i,j) - print *,'stype(i,j) =',i,j,stype(i,j) - print *,'xland(i,j) =',i,j,xland(i,j) - print *,'xice(i,j) =',i,j,xice(i,j) - print *,'iswater=',iswater - print *,'isice=',isice - print *,'xice_threshold=',xice_threshold - print *,'con_cp=',con_cp - print *,'con_rv=',con_rv - print *,'con_rd=',con_rd - print *,'con_g=',con_g - print *,'con_pi=',con_pi - print *,'con_hvap=',con_hvap - print *,'stbolt=',stbolt - print *,'smsoil(i,:,j)=',i,j,smsoil(i,:,j) - print *,'slsoil(i,:,j)=',i,j,slsoil(i,:,j) - print *,'stsoil(i,:,j)=',i,j,stsoil(i,:,j) - print *,'smfrsoil(i,:,j)=',i,j,smfrsoil(i,:,j) - print *,'keepfrsoil(i,:,j)=',i,j,keepfrsoil(i,:,j) - print *,'soilm(i,j) =',i,j,soilm(i,j) - print *,'smmax(i,j) =',i,j,smmax(i,j) - print *,'hfx(i,j) =',i,j,hfx(i,j) - print *,'qfx(i,j) =',i,j,qfx(i,j) - print *,'lh(i,j) =',i,j,lh(i,j) - print *,'infiltr(i,j) =',i,j,infiltr(i,j) - print *,'runoff1(i,j) =',i,j,runoff1(i,j) - print *,'runoff2(i,j) =',i,j,runoff2(i,j) - print *,'acrunoff(i,j) =',i,j,acrunoff(i,j) - print *,'sfcexc(i,j) =',i,j,sfcexc(i,j) - print *,'acceta(i,j) =',i,j,acceta(i,j) - print *,'ssoil(i,j) =',i,j,ssoil(i,j) - print *,'snfallac(i,j) =',i,j,snfallac(i,j) - print *,'acsn(i,j) =',i,j,acsn(i,j) - print *,'snomlt(i,j) =',i,j,snomlt(i,j) - print *,'shdmin1d(i,j) =',i,j,shdmin1d(i,j) - print *,'shdmax1d(i,j) =',i,j,shdmax1d(i,j) - print *,'rdlai2d =',rdlai2d + write (0,*)'before RUC smsoil = ',smsoil(i,:,j), i,j + write (0,*)'stsoil = ',stsoil(i,:,j), i,j + write (0,*)'soilt = ',soilt(i,j), i,j + write (0,*)'wet = ',wet(i,j), i,j + write (0,*)'soilt1 = ',soilt1(i,j), i,j + write (0,*)'delt =',delt + write (0,*)'kdt =',kdt + write (0,*)'flag_init =',flag_init + write (0,*)'flag_restart =',flag_restart + write (0,*)'nsoil =',nsoil + write (0,*)'frpcpn =',frpcpn + write (0,*)'zs =',zs + write (0,*)'graupelncv(i,j) =',i,j,graupelncv(i,j) + write (0,*)'snowncv(i,j) =',i,j,snowncv(i,j) + write (0,*)'rainncv(i,j) =',i,j,rainncv(i,j) + write (0,*)'raincv(i,j) =',i,j,raincv(i,j) + write (0,*)'prcp(i,j) =',i,j,prcp(i,j) + write (0,*)'sneqv(i,j) =',i,j,sneqv(i,j) + write (0,*)'snowh(i,j) =',i,j,snowh(i,j) + write (0,*)'sncovr(i,j) =',i,j,sncovr(i,j) + write (0,*)'ffrozp(i,j) =',i,j,ffrozp(i,j) + write (0,*)'conflx2(i,1,j) =',i,j,conflx2(i,1,j) + write (0,*)'sfcprs(i,1,j) =',i,j,sfcprs(i,1,j) + write (0,*)'sfctmp(i,1,j) =',i,j,sfctmp(i,1,j) + write (0,*)'q2(i,1,j) =',i,j,q2(i,1,j) + write (0,*)'qcatm(i,1,j) =',i,j,qcatm(i,1,j) + write (0,*)'rho2(i,1,j) =',i,j,rho2(i,1,j) + write (0,*)'lwdn(i,j) =',i,j,lwdn(i,j) + write (0,*)'solnet(i,j) =',i,j,solnet(i,j) + write (0,*)'sfcems(i,j) =',i,j,sfcems(i,j) + write (0,*)'chklowq(i,j) =',i,j,chklowq(i,j) + write (0,*)'chs(i,j) =',i,j,chs(i,j) + write (0,*)'flqc(i,j) =',i,j,flqc(i,j) + write (0,*)'flhc(i,j) =',i,j,flhc(i,j) + write (0,*)'wet(i,j) =',i,j,wet(i,j) + write (0,*)'cmc(i,j) =',i,j,cmc(i,j) + write (0,*)'shdfac(i,j) =',i,j,shdfac(i,j) + write (0,*)'alb(i,j) =',i,j,alb(i,j) + write (0,*)'znt(i,j) =',i,j,znt(i,j) + write (0,*)'z0(i,j) =',i,j,z0(i,j) + write (0,*)'snoalb1d(i,j) =',i,j,snoalb1d(i,j) + write (0,*)'alb(i,j) =',i,j,alb(i,j) + write (0,*)'landusef(i,:,j) =',i,j,landusef(i,:,j) + write (0,*)'soilctop(i,:,j) =',i,j,soilctop(i,:,j) + write (0,*)'nlcat=',nlcat + write (0,*)'nscat=',nscat + write (0,*)'qsfc(i,j) =',i,j,qsfc(i,j) + write (0,*)'qvg(i,j) =',i,j,qvg(i,j) + write (0,*)'qsg(i,j) =',i,j,qsg(i,j) + write (0,*)'qcg(i,j) =',i,j,qcg(i,j) + write (0,*)'dew(i,j) =',i,j,dew(i,j) + write (0,*)'soilt(i,j) =',i,j,soilt(i,j) + write (0,*)'tskin(i) =',i,j,tskin(i) + write (0,*)'soilt1(i,j) =',i,j,soilt1(i,j) + write (0,*)'tsnav(i,j) =',i,j,tsnav(i,j) + write (0,*)'tbot(i,j) =',i,j,tbot(i,j) + write (0,*)'vtype(i,j) =',i,j,vtype(i,j) + write (0,*)'stype(i,j) =',i,j,stype(i,j) + write (0,*)'xland(i,j) =',i,j,xland(i,j) + write (0,*)'xice(i,j) =',i,j,xice(i,j) + write (0,*)'iswater=',iswater + write (0,*)'isice=',isice + write (0,*)'xice_threshold=',xice_threshold + write (0,*)'con_cp=',con_cp + write (0,*)'con_rv=',con_rv + write (0,*)'con_rd=',con_rd + write (0,*)'con_g=',con_g + write (0,*)'con_pi=',con_pi + write (0,*)'con_hvap=',con_hvap + write (0,*)'stbolt=',stbolt + write (0,*)'smsoil(i,:,j)=',i,j,smsoil(i,:,j) + write (0,*)'slsoil(i,:,j)=',i,j,slsoil(i,:,j) + write (0,*)'stsoil(i,:,j)=',i,j,stsoil(i,:,j) + write (0,*)'smfrsoil(i,:,j)=',i,j,smfrsoil(i,:,j) + write (0,*)'keepfrsoil(i,:,j)=',i,j,keepfrsoil(i,:,j) + write (0,*)'soilm(i,j) =',i,j,soilm(i,j) + write (0,*)'smmax(i,j) =',i,j,smmax(i,j) + write (0,*)'hfx(i,j) =',i,j,hfx(i,j) + write (0,*)'qfx(i,j) =',i,j,qfx(i,j) + write (0,*)'lh(i,j) =',i,j,lh(i,j) + write (0,*)'infiltr(i,j) =',i,j,infiltr(i,j) + write (0,*)'runoff1(i,j) =',i,j,runoff1(i,j) + write (0,*)'runoff2(i,j) =',i,j,runoff2(i,j) + write (0,*)'acrunoff(i,j) =',i,j,acrunoff(i,j) + write (0,*)'sfcexc(i,j) =',i,j,sfcexc(i,j) + write (0,*)'acceta(i,j) =',i,j,acceta(i,j) + write (0,*)'ssoil(i,j) =',i,j,ssoil(i,j) + write (0,*)'snfallac(i,j) =',i,j,snfallac(i,j) + write (0,*)'acsn(i,j) =',i,j,acsn(i,j) + write (0,*)'snomlt(i,j) =',i,j,snomlt(i,j) + write (0,*)'shdmin1d(i,j) =',i,j,shdmin1d(i,j) + write (0,*)'shdmax1d(i,j) =',i,j,shdmax1d(i,j) + write (0,*)'rdlai2d =',rdlai2d !endif endif @@ -929,39 +940,39 @@ subroutine lsm_ruc_run & ! inputs & its,ite, jts,jte, kts,kte ) if(debug_print) then - print *,'after sneqv(i,j) =',i,j,sneqv(i,j) - print *,'after snowh(i,j) =',i,j,snowh(i,j) - print *,'after sncovr(i,j) =',i,j,sncovr(i,j) - print *,'after vtype(i,j) =',i,j,vtype(i,j) - print *,'after stype(i,j) =',i,j,stype(i,j) - print *,'after wet(i,j) =',i,j,wet(i,j) - print *,'after cmc(i,j) =',i,j,cmc(i,j) - print *,'after qsfc(i,j) =',i,j,qsfc(i,j) - print *,'after qvg(i,j) =',i,j,qvg(i,j) - print *,'after qsg(i,j) =',i,j,qsg(i,j) - print *,'after qcg(i,j) =',i,j,qcg(i,j) - print *,'after dew(i,j) =',i,j,dew(i,j) - print *,'after soilt(i,j) =',i,j,soilt(i,j) - print *,'after tskin(i) =',i,j,tskin(i) - print *,'after soilt1(i,j) =',i,j,soilt1(i,j) - print *,'after tsnav(i,j) =',i,j,tsnav(i,j) - print *,'after smsoil(i,:,j)=',i,j,smsoil(i,:,j) - print *,'after slsoil(i,:,j)=',i,j,slsoil(i,:,j) - print *,'after stsoil(i,:,j)=',i,j,stsoil(i,:,j) - print *,'after smfrsoil(i,:,j)=',i,j,smfrsoil(i,:,j) - print *,'after keepfrsoil(i,:,j)=',i,j,keepfrsoil(i,:,j) - print *,'after soilm(i,j) =',i,j,soilm(i,j) - print *,'after smmax(i,j) =',i,j,smmax(i,j) - print *,'after hfx(i,j) =',i,j,hfx(i,j) - print *,'after qfx(i,j) =',i,j,qfx(i,j) - print *,'after lh(i,j) =',i,j,lh(i,j) - print *,'after infiltr(i,j) =',i,j,infiltr(i,j) - print *,'after runoff1(i,j) =',i,j,runoff1(i,j) - print *,'after runoff2(i,j) =',i,j,runoff2(i,j) - print *,'after ssoil(i,j) =',i,j,ssoil(i,j) - print *,'after snfallac(i,j) =',i,j,snfallac(i,j) - print *,'after acsn(i,j) =',i,j,acsn(i,j) - print *,'after snomlt(i,j) =',i,j,snomlt(i,j) + write (0,*)'after sneqv(i,j) =',i,j,sneqv(i,j) + write (0,*)'after snowh(i,j) =',i,j,snowh(i,j) + write (0,*)'after sncovr(i,j) =',i,j,sncovr(i,j) + write (0,*)'after vtype(i,j) =',i,j,vtype(i,j) + write (0,*)'after stype(i,j) =',i,j,stype(i,j) + write (0,*)'after wet(i,j) =',i,j,wet(i,j) + write (0,*)'after cmc(i,j) =',i,j,cmc(i,j) + write (0,*)'after qsfc(i,j) =',i,j,qsfc(i,j) + write (0,*)'after qvg(i,j) =',i,j,qvg(i,j) + write (0,*)'after qsg(i,j) =',i,j,qsg(i,j) + write (0,*)'after qcg(i,j) =',i,j,qcg(i,j) + write (0,*)'after dew(i,j) =',i,j,dew(i,j) + write (0,*)'after soilt(i,j) =',i,j,soilt(i,j) + write (0,*)'after tskin(i) =',i,j,tskin(i) + write (0,*)'after soilt1(i,j) =',i,j,soilt1(i,j) + write (0,*)'after tsnav(i,j) =',i,j,tsnav(i,j) + write (0,*)'after smsoil(i,:,j)=',i,j,smsoil(i,:,j) + write (0,*)'after slsoil(i,:,j)=',i,j,slsoil(i,:,j) + write (0,*)'after stsoil(i,:,j)=',i,j,stsoil(i,:,j) + write (0,*)'after smfrsoil(i,:,j)=',i,j,smfrsoil(i,:,j) + write (0,*)'after keepfrsoil(i,:,j)=',i,j,keepfrsoil(i,:,j) + write (0,*)'after soilm(i,j) =',i,j,soilm(i,j) + write (0,*)'after smmax(i,j) =',i,j,smmax(i,j) + write (0,*)'after hfx(i,j) =',i,j,hfx(i,j) + write (0,*)'after qfx(i,j) =',i,j,qfx(i,j) + write (0,*)'after lh(i,j) =',i,j,lh(i,j) + write (0,*)'after infiltr(i,j) =',i,j,infiltr(i,j) + write (0,*)'after runoff1(i,j) =',i,j,runoff1(i,j) + write (0,*)'after runoff2(i,j) =',i,j,runoff2(i,j) + write (0,*)'after ssoil(i,j) =',i,j,ssoil(i,j) + write (0,*)'after snfallac(i,j) =',i,j,snfallac(i,j) + write (0,*)'after acsn(i,j) =',i,j,acsn(i,j) + write (0,*)'after snomlt(i,j) =',i,j,snomlt(i,j) endif @@ -976,12 +987,12 @@ subroutine lsm_ruc_run & ! inputs ! if(debug_print) then !if(me==0.and.i==ipr) then - print *,'after RUC smsoil = ',smsoil(i,:,j), i, j - print *,'stsoil = ',stsoil(i,:,j), i,j - print *,'soilt = ',soilt(i,j), i,j - print *,'wet = ',wet(i,j), i,j - print *,'soilt1 = ',soilt1(i,j), i,j - print *,'rhosnfr = ',rhosnfr(i,j), i,j + write (0,*)'after RUC smsoil = ',smsoil(i,:,j), i, j + write (0,*)'stsoil = ',stsoil(i,:,j), i,j + write (0,*)'soilt = ',soilt(i,j), i,j + write (0,*)'wet = ',wet(i,j), i,j + write (0,*)'soilt1 = ',soilt1(i,j), i,j + write (0,*)'rhosnfr = ',rhosnfr(i,j), i,j !endif endif @@ -1068,9 +1079,9 @@ subroutine lsm_ruc_run & ! inputs do j = 1, 1 do i = 1, im if (flag(i)) then - if(debug_print) print *,'end ',i,flag_guess(i),flag_iter(i) + if(debug_print) write (0,*)'end ',i,flag_guess(i),flag_iter(i) if (flag_guess(i)) then - if(debug_print) print *,'guess run' + if(debug_print) write (0,*)'guess run' weasd(i) = weasd_old(i) snwdph(i) = snwdph_old(i) tskin(i) = tskin_old(i) @@ -1094,7 +1105,7 @@ subroutine lsm_ruc_run & ! inputs smfrkeep(i,k) = smfrkeep_old(i,k) enddo else - if(debug_print) print *,'iter run', i,j, tskin(i),tsurf(i) + if(debug_print) write (0,*)'iter run', i,j, tskin(i),tsurf(i) tskin(i) = tsurf(i) tice (i) = tsurf(i) endif @@ -1145,7 +1156,7 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in smcref2, smcwlt2, & ! inout lsm_ruc, lsm, & ! in zs, sh2o, smfrkeep, tslb, smois, & ! out - wetness, errmsg, errflg) + wetness, me, master, errmsg, errflg) implicit none @@ -1176,6 +1187,8 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in real (kind=kind_phys), dimension(1:lsoil_ruc), intent (out) :: zs + integer, intent(in ) :: me + integer, intent(in ) :: master character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -1230,8 +1243,8 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in errflg = 1 return else if (debug_print) then - write(0,*) 'Start of RUC LSM initialization' - print *,'lsoil, lsoil_ruc =',lsoil, lsoil_ruc + write (0,*) 'Start of RUC LSM initialization' + write (0,*)'lsoil, lsoil_ruc =',lsoil, lsoil_ruc endif ipr = 10 @@ -1268,20 +1281,20 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in num_soil_layers = lsoil ! 4 - for Noah lsm - if( lsoil_ruc == lsoil) then - ! RUC LSM input - smadj = .false. - swi_init = .false. - flag_soil_layers = 0 ! =1 for input from the Noah LSM - flag_soil_levels = 1 ! =1 for input from RUC LSM - else - ! for Noah input set smadj and swi_init to .true. - smadj = .true. - swi_init = .true. - flag_soil_layers = 1 ! =1 for input from the Noah LSM - flag_soil_levels = 0 ! =1 for input from RUC LSM - endif - + if( lsoil_ruc == lsoil) then + ! RUC LSM input + smadj = .false. + swi_init = .false. + flag_soil_layers = 0 ! =1 for input from the Noah LSM + flag_soil_levels = 1 ! =1 for input from RUC LSM + else + ! for Noah input set smadj and swi_init to .true. + smadj = .true. + swi_init = .true. + flag_soil_layers = 1 ! =1 for input from the Noah LSM + flag_soil_levels = 0 ! =1 for input from RUC LSM + endif + if(lsoil == 4 ) then ! for Noah input st_levels_input = (/ 5, 25, 70, 150/) ! Noah centers of soil layers sm_levels_input = (/ 5, 25, 70, 150/) ! Noah centers of soil layers @@ -1294,32 +1307,35 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in else - ! For RUC input data, return here + ! For RUC restart data, return here return endif if(debug_print) then - print *,'Noah smc(ipr,:) ==', ipr, smc(ipr,:) - print *,'Noah stc(ipr,:) ==', ipr, stc(ipr,:) - print *,'Noah vegtype(ipr) ==', ipr, vegtype(ipr) - print *,'Noah soiltyp(ipr) ==', ipr, soiltyp(ipr) - print *,'its,ite,jts,jte ',its,ite,jts,jte + write (0,*)'smc(ipr,:) ==', ipr, smc(ipr,:) + write (0,*)'stc(ipr,:) ==', ipr, stc(ipr,:) + write (0,*)'vegtype(ipr) ==', ipr, vegtype(ipr) + write (0,*)'soiltyp(ipr) ==', ipr, soiltyp(ipr) + write (0,*)'its,ite,jts,jte ',its,ite,jts,jte endif do j=jts,jte ! do i=its,ite ! i = horizontal loop - tsk(i,j) = tsurf(i) - sst(i,j) = tsurf_ocn(i) - tbot(i,j)= tg3(i) - - ! land only version - ivgtyp(i,j)=vegtype(i) - isltyp(i,j)=soiltyp(i) - landmask(i,j)=1. - xice(i,j)=0. + ! land only version + if (land(i)) then + tsk(i,j) = tsurf(i) + sst(i,j) = tsurf_ocn(i) + tbot(i,j)= tg3(i) + ivgtyp(i,j)=vegtype(i) + isltyp(i,j)=soiltyp(i) + landmask(i,j)=1. + xice(i,j)=0. + else + landmask(i,j)=0. + endif ! land(i) enddo enddo @@ -1335,8 +1351,8 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in sm_input(i,1,j)=0. !--- initialize smcwlt2 and smcref2 with Noah values - smcref2 (i) = REFSMCnoah(soiltyp(i)) - smcwlt2 (i) = WLTSMCnoah(soiltyp(i)) + smcref2 (i) = REFSMCnoah(soiltyp(i)) + smcwlt2 (i) = WLTSMCnoah(soiltyp(i)) do k=1,lsoil st_input(i,k+1,j)=stc(i,k) @@ -1359,8 +1375,8 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in enddo ! jme if(debug_print) then - print *,'st_input=',ipr, st_input(ipr,:,1) - print *,'sm_input=',ipr, sm_input(ipr,:,1) + write (0,*)'st_input=',ipr, st_input(ipr,:,1) + write (0,*)'sm_input=',ipr, sm_input(ipr,:,1) endif CALL init_soil_3_real ( tsk , tbot , dumsm , dumt , & @@ -1395,13 +1411,13 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in enddo if(debug_print) then - print *,'tsk(i,j),tbot(i,j),sst(i,j),landmask(i,j)' & + write (0,*)'tsk(i,j),tbot(i,j),sst(i,j),landmask(i,j)' & ,ipr,1,tsk(ipr,1),tbot(ipr,1),sst(ipr,1),landmask(ipr,1) - print *,'tsurf(ipr)=',ipr,tsurf(ipr) - print *,'stc(ipr)=',ipr,stc(ipr,:) - print *,'smc(ipr)=',ipr,smc(ipr,:) - print *,'soilt(1,:,ipr)',ipr,soiltemp(ipr,:,1) - print *,'soilm(1,:,ipr)',ipr,soilm(ipr,:,1) + write (0,*)'tsurf(ipr)=',ipr,tsurf(ipr) + write (0,*)'stc(ipr)=',ipr,stc(ipr,:) + write (0,*)'smc(ipr)=',ipr,smc(ipr,:) + write (0,*)'soilt(1,:,ipr)',ipr,soiltemp(ipr,:,1) + write (0,*)'soilm(1,:,ipr)',ipr,soilm(ipr,:,1) endif ! debug_print ! smadj should be true when the Noah LSM is used to initialize RUC @@ -1429,9 +1445,9 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in if(debug_print) then if(i==ipr) then - print *,'from Noah to RUC: RUC bucket and Noah bucket at', & + write (0,*)'from Noah to RUC: RUC bucket and Noah bucket at', & i,j,smtotr(i,j),smtotn(i,j) - print *,'before smois=',i,j,soilm(i,:,j) + write (0,*)'before smois=',i,j,soilm(i,:,j) endif endif @@ -1452,14 +1468,14 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in soilm(i,k,j) = factorsm(k) * soilm(i,k,j) enddo if(debug_print) then - if(i==ipr) print *,'after smois=',i,j,soilm(i,:,j) + if(i==ipr) write (0,*)'after smois=',i,j,soilm(i,:,j) endif smtotr(i,j) = 0. do k=1,lsoil_ruc - 1 smtotr(i,j)=smtotr(i,j) + soilm(i,k,j) *dzs(k) enddo if(debug_print) then - if(i==ipr)print *,'after correction: RUC bucket and Noah bucket at', & + if(i==ipr) write (0,*)'after correction: RUC bucket and Noah bucket at', & i,j,smtotr(i,j),smtotn(i,j) endif @@ -1472,7 +1488,7 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in elseif (flag_soil_layers==0) then ! RUC LSM input - print *,' RUC LSM input for soil variables' + if(debug_print) write (0,*)' RUC LSM input for soil variables' do j=jts,jte do i=its,ite do k=1,lsoil_ruc @@ -1488,7 +1504,7 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in ! Initialize liquid and frozen soil moisture from total soil moisture ! and soil temperature, and also soil moisture availability in the top ! layer - call ruclsminit( debug_print, & + call ruclsminit( debug_print, landmask, & lsoil_ruc, isltyp, ivgtyp, xice, mavail, & soilh2o, smfr, soiltemp, soilm, & ims,ime, jms,jme, kms,kme, & @@ -1508,8 +1524,7 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in enddo enddo - if ( flag_soil_layers == 1 ) then - ! For Noah lsm input and non-land points, set RUC LSM fields to Noah fields + ! For non-land points, set RUC LSM fields to input (Noah or RUC) fields do i=1,im if (.not.land(i)) then do k=1,min(lsoil,lsoil_ruc) @@ -1519,12 +1534,11 @@ subroutine rucinit (restart, im, lsoil_ruc, lsoil, nlev, & ! in enddo endif enddo - endif ! flag_soil_layers==1 if(debug_print) then - print *,'End of RUC LSM initialization' - print *,'tslb(ipr)=',ipr,tslb(ipr,:) - print *,'smois(ipr)=',ipr,smois(ipr,:) + write (0,*)'End of RUC LSM initialization' + write (0,*)'tslb(ipr)=',ipr,tslb(ipr,:) + write (0,*)'smois(ipr)=',ipr,smois(ipr,:) endif ! debug_print end subroutine rucinit From e4e75a33a9218bd96565f426f6883b9aeef76a0a Mon Sep 17 00:00:00 2001 From: climbfuji Date: Mon, 12 Aug 2019 08:15:53 -0600 Subject: [PATCH 6/6] physics/sfc_drv_ruc.F90: turn error into warning for land points with vegtype == 15 --- physics/sfc_drv_ruc.F90 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/physics/sfc_drv_ruc.F90 b/physics/sfc_drv_ruc.F90 index bb8c46d9e..3ab8c9d64 100644 --- a/physics/sfc_drv_ruc.F90 +++ b/physics/sfc_drv_ruc.F90 @@ -502,10 +502,14 @@ subroutine lsm_ruc_run & ! inputs !- 10may19 - ice points are turned off. flag(i) = land(i) if (land(i) .and. (vegtype(i)==iswater .or. vegtype(i)==isice)) then - write(errmsg,'(a,i0,a,i0)') 'Logic error in sfc_drv_ruc_run: for i=', i, & - ', land(i) is true but vegtype(i) is water or ice: ', vegtype(i) - errflg = 1 - return + !write(errmsg,'(a,i0,a,i0)') 'Logic error in sfc_drv_ruc_run: for i=', i, & + ! ', land(i) is true but vegtype(i) is water or ice: ', vegtype(i) + !errflg = 1 + !return + if(flag_init .and. iter==1) then + write(0,'(a,i0,a,i0)') 'Warning: in sfc_drv_ruc_run: for i=', i, & + ', land(i) is true but vegtype(i) is water or ice: ', vegtype(i) + end if end if enddo