Skip to content

Commit

Permalink
added activeHRU_inactiveCELL and inactiveHRU_activeCELL arrays, merge…
Browse files Browse the repository at this point in the history
… with prms 5.3.0
  • Loading branch information
rsregan committed Feb 10, 2024
1 parent b5c1148 commit 0d26b8d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
2 changes: 0 additions & 2 deletions GSFLOW/src/gsflow/gsflow_modflow.f
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ INTEGER FUNCTION gsfdecl()
& /, 25X, 'HFB, HUF, LAK LPF, MNW1, MNW2, NWT, PCG,',
& /, 25X, 'AG, SFR, SIP, UPW, UZF, WEL, SWI, SWT, LMT', /)

WRITE(*,'(24X,A)') 'Github Commit Hash dcb5350'

! Allocate local module variables
ALLOCATE ( Mfq2inch_conv(Nhrucell), Mfvol2inch_conv(Nhrucell) )
ALLOCATE ( Gvr2cell_conv(Nhrucell), Cellarea(Ngwcell) )
Expand Down
8 changes: 4 additions & 4 deletions GSFLOW/src/gsflow/gsflow_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ MODULE PRMS_MODULE
& EQULS = '=========================================================================='
character(len=*), parameter :: MODDESC = 'PRMS Computation Order'
character(len=11), parameter :: MODNAME = 'gsflow_prms'
character(len=*), parameter :: GSFLOW_versn = '2.3.1 12/15/2023'
character(len=*), parameter :: PRMS_versn = '2023-12-15'
character(len=*), parameter :: PRMS_VERSION = 'Version 5.2.2.1 12/15/2023'
character(len=*), parameter :: GSFLOW_versn = '2.3.0 02/22/2024'
character(len=*), parameter :: PRMS_versn = '2024-02-10'
character(len=*), parameter :: PRMS_VERSION = 'Version 5.3.0 02/10/2024'
character(len=*), parameter :: Version_read_control_file = '2022-10-20'
character(len=*), parameter :: Version_read_parameter_file = '2022-01-12'
character(len=*), parameter :: Version_read_data_file = '2022-06-02'
Expand All @@ -36,7 +36,7 @@ MODULE PRMS_MODULE
INTEGER, SAVE :: PRMS_output_unit, Restart_inunit, Restart_outunit
INTEGER, SAVE :: Dynamic_flag, Dynamic_soil_flag, Water_use_flag, Soilzone_add_water_use
INTEGER, SAVE :: Elapsed_time_start(8), Elapsed_time_end(8), Elapsed_time_minutes
INTEGER, SAVE :: Nowyear, Nowmonth, Nowday
INTEGER, SAVE :: Nowyear, Nowmonth, Nowday, Nhru_nmonths
INTEGER, SAVE :: Gwr_transfer_water_use, Gwr_add_water_use
INTEGER, SAVE :: Lake_transfer_water_use, Lake_add_water_use
REAL, SAVE :: Execution_time_start, Execution_time_end, Elapsed_time
Expand Down
33 changes: 17 additions & 16 deletions GSFLOW/src/gsflow/gsflow_prms.f90
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ SUBROUTINE gsflow_prms(Process_mode, AFR, MS_GSF_converge, Nsegshold, Nlakeshold

ENDIF

WRITE(*,'(/,4X,A,/)') 'Github Commit Hash 95924d7053e26baac6416b9cbe55049cd546ac19'

IF ( GSFLOW_flag==ACTIVE ) ierr = gsfdecl()
IF ( Model==MODSIM_MODFLOW ) THEN
Nsegshold = NSS
Expand Down Expand Up @@ -593,7 +595,7 @@ SUBROUTINE gsflow_prms(Process_mode, AFR, MS_GSF_converge, Nsegshold, Nlakeshold
9001 FORMAT (/, 26X, 27('='), /, 26X, 'Normal completion of GSFLOW', /, 26X, 27('='), /)
9002 FORMAT (//, A, /, 'Please give careful consideration to fixing all ERROR and WARNING messages', /, A)
9003 FORMAT ('Execution ', A, ' date and time (yyyy/mm/dd hh:mm:ss)', I5, 2('/',I2.2), I3, 2(':',I2.2), /)
9004 FORMAT (/, 2A, /)
9004 FORMAT (/, 2A)

END SUBROUTINE gsflow_prms

Expand Down Expand Up @@ -644,7 +646,6 @@ SUBROUTINE setdims(AFR, Diversions, Idivert, EXCHANGE, DELTAVOL, LAKEVOL, Nsegsh

IF ( control_integer(Parameter_check_flag, 'parameter_check_flag')/=0 ) Parameter_check_flag = OFF
IF ( control_integer(forcing_check_flag, 'forcing_check_flag')/=0 ) forcing_check_flag = OFF
IF ( control_integer(seg2hru_flag, 'seg2hru_flag')/=0 ) seg2hru_flag = OFF

IF ( control_string(Model_mode, 'model_mode')/=0 ) CALL read_error(5, 'model_mode')
IF ( Model_mode(:4)==' ' ) Model_mode = 'GSFLOW5'
Expand Down Expand Up @@ -806,19 +807,12 @@ SUBROUTINE setdims(AFR, Diversions, Idivert, EXCHANGE, DELTAVOL, LAKEVOL, Nsegsh
IF ( control_string(Var_save_file, 'var_save_file')/=0 ) CALL read_error(5, 'var_save_file')
ENDIF

Temp_module = 'temp_1sta'
IF ( control_string(Temp_module, 'temp_module')/=0 ) CALL read_error(5, 'temp_module')
Precip_module = 'precip_1sta'
IF ( control_string(Precip_module, 'precip_module')/=0 ) CALL read_error(5, 'precip_module')
Transp_module = 'transp_index'
IF ( control_string(Transp_module, 'transp_module')/=0 ) CALL read_error(5, 'transp_module')
Et_module = 'potet_jh'
IF ( control_string(Et_module, 'et_module')/=0 ) CALL read_error(5, 'et_module')
Srunoff_module = 'srunoff_smidx'
IF ( control_string(Srunoff_module, 'srunoff_module')/=0 ) CALL read_error(5, 'srunoff_module')
Solrad_module = 'ddsolrad'
IF ( control_string(Solrad_module, 'solrad_module')/=0 ) CALL read_error(5, 'solrad_module')
Soilzone_module = 'soilzone'
IF ( control_string(Soilzone_module, 'soilzone_module')/=0 ) CALL read_error(5, 'soilzone_module')
AG_flag = OFF
IF ( Soilzone_module=='soilzone_ag' ) AG_flag = ACTIVE
Expand Down Expand Up @@ -928,6 +922,7 @@ SUBROUTINE setdims(AFR, Diversions, Idivert, EXCHANGE, DELTAVOL, LAKEVOL, Nsegsh
IF ( control_integer(Soilzone_aet_flag, 'soilzone_aet_flag')/=0 ) Soilzone_aet_flag = OFF
IF ( control_integer(Iter_aet_flag, 'iter_aet_flag')/=0 ) Iter_aet_flag = OFF
IF ( control_integer(snow_cloudcover_flag, 'snow_cloudcover_flag')/=0 ) snow_cloudcover_flag = OFF
IF ( control_integer(seg2hru_flag, 'seg2hru_flag')/=0 ) seg2hru_flag = OFF

IF ( control_integer(Humidity_cbh_flag, 'humidity_cbh_flag')/=0 ) Humidity_cbh_flag = OFF
IF ( control_integer(Windspeed_cbh_flag, 'windspeed_cbh_flag')/=0 ) Windspeed_cbh_flag = OFF
Expand Down Expand Up @@ -986,11 +981,13 @@ SUBROUTINE setdims(AFR, Diversions, Idivert, EXCHANGE, DELTAVOL, LAKEVOL, Nsegsh
PRINT '(/,2A)', 'ERROR, invalid strmflow_module value: ', Strmflow_module
Inputerror_flag = 1
ENDIF

Stream_order_flag = OFF
IF ( Strmflow_flag>1 .AND. PRMS_flag==ACTIVE ) THEN
!print *, nsegment, strmflow_flag, strmflow_module
Stream_order_flag = ACTIVE ! strmflow_in_out, muskingum, muskingum_lake, muskingum_mann
ENDIF

! cascade dimensions
IF ( decldim('ncascade', 0, MAXDIM, &
& 'Number of HRU links for cascading flow')/=0 ) CALL read_error(7, 'ncascade')
Expand Down Expand Up @@ -1168,6 +1165,7 @@ INTEGER FUNCTION check_dims(Nsegshold, Nlakeshold)

Nhru = getdim('nhru')
IF ( Nhru==-1 ) CALL read_error(7, 'nhru')
Nhru_nmonths = Nhru * Nmonths

Nssr = getdim('nssr')
IF ( Nssr==-1 ) CALL read_error(7, 'nssr')
Expand Down Expand Up @@ -1296,8 +1294,8 @@ INTEGER FUNCTION check_dims(Nsegshold, Nlakeshold)
ENDIF

IF ( Nsegment<1 ) THEN
IF ( Stream_order_flag==ACTIVE .OR. Call_cascade==1 ) THEN
PRINT *, 'ERROR, streamflow and cascade routing requires nsegment > 0, specified as:', Nsegment
IF ( Stream_order_flag==ACTIVE .OR. Call_cascade==ACTIVE ) THEN
PRINT *, 'ERROR, streamflow and cascade routing require nsegment > 0, specified as:', Nsegment
Inputerror_flag = 1
ENDIF
ENDIF
Expand Down Expand Up @@ -1556,7 +1554,7 @@ END SUBROUTINE put_prms_control_file
! gsflow_prms_restart - write or read restart file
!***********************************************************************
SUBROUTINE gsflow_prms_restart(In_out)
USE PRMS_CONSTANTS, ONLY: OFF
USE PRMS_CONSTANTS, ONLY: OFF, SAVE_INIT
USE PRMS_MODULE
use prms_utils, only: check_restart, check_restart_dimen
IMPLICIT NONE
Expand All @@ -1570,11 +1568,11 @@ SUBROUTINE gsflow_prms_restart(In_out)
CHARACTER(LEN=MAXCONTROL_LENGTH) :: model_test
CHARACTER(LEN=11) :: module_name
!***********************************************************************
IF ( In_out==0 ) THEN
IF ( In_out==SAVE_INIT ) THEN
IF ( text_restart_flag==OFF ) THEN
WRITE ( Restart_outunit ) MODNAME
WRITE ( Restart_outunit ) Timestep, Nhru, Dprst_flag, Nsegment, Temp_flag, Et_flag, &
Cascade_flag, Cascadegw_flag, Nhrucell, Nlake, Transp_flag, Model_mode
& Cascade_flag, Cascadegw_flag, Nhrucell, Nlake, Transp_flag, Model_mode
WRITE ( Restart_outunit ) Starttime, Endtime
ELSE
WRITE ( Restart_outunit, * ) MODNAME
Expand All @@ -1588,7 +1586,7 @@ SUBROUTINE gsflow_prms_restart(In_out)
READ ( Restart_inunit ) module_name
CALL check_restart(MODNAME, module_name)
READ ( Restart_inunit ) time_step, nhru_test, dprst_test, nsegment_test, temp_test, et_test, &
cascade_test, cascdgw_test, nhrucell_test, nlake_test, transp_test, model_test
& cascade_test, cascdgw_test, nhrucell_test, nlake_test, transp_test, model_test
READ ( Restart_inunit ) start_time, end_time
ELSE
READ ( Restart_inunit, * ) module_name
Expand Down Expand Up @@ -1645,7 +1643,10 @@ SUBROUTINE gsflow_prms_restart(In_out)
ierr = 1
ENDIF
ENDIF
IF ( ierr==1 ) ERROR STOP ERROR_restart
IF ( ierr==1 ) THEN
PRINT *, 'ERROR READING RESTART FILE'
ERROR STOP ERROR_restart
ENDIF
ENDIF
END SUBROUTINE gsflow_prms_restart

Expand Down
15 changes: 11 additions & 4 deletions GSFLOW/src/gsflow/gsflow_prms2mf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ MODULE GSFPRMS2MF
! Module Variables
character(len=*), parameter :: MODDESC = 'GSFLOW PRMS to MODFLOW'
character(len=*), parameter :: MODNAME = 'gsflow_prms2mf'
character(len=*), parameter :: Version_gsflow_prms2mf = '2022-02-19'
character(len=*), parameter :: Version_gsflow_prms2mf = '2024-02-10'
REAL, PARAMETER :: SZ_CHK = 0.00001
DOUBLE PRECISION, PARAMETER :: PCT_CHK = 0.000005D0
INTEGER, SAVE :: NTRAIL_CHK, Nlayp1
! Number of stream reaches in each stream segment
INTEGER, SAVE, ALLOCATABLE :: Numreach_segment(:)
INTEGER, SAVE, ALLOCATABLE :: Numreach_segment(:), activeHru_inactiveCell(:), inactiveHru_activeCell(:)
REAL, SAVE, ALLOCATABLE :: Excess(:)
DOUBLE PRECISION, SAVE :: Totalarea
! Declared Variables
Expand Down Expand Up @@ -291,12 +291,16 @@ INTEGER FUNCTION prms2mfinit()
Cell_drain_rate = 0.0 ! dimension ngwcell
finf_cell = 0.0 ! dimension ngwcell

ALLOCATE ( activeHru_inactiveCell(Nhru) )
ALLOCATE ( inactiveHru_activeCell(Nhru) )
ierr = 0
IF ( Nhru/=Nhrucell ) THEN
ALLOCATE ( hru_pct(Nhru), newpct(Nhru), temp_pct(Nhrucell) )
hru_pct = 0.0D0
newpct = 0.0D0
ENDIF
activeHru_inactiveCell = 0
inactiveHru_activeCell = 0
DO i = 1, Nhrucell
ihru = Gvr_hru_id(i)
IF ( Nhru/=Nhrucell ) THEN
Expand All @@ -310,12 +314,15 @@ INTEGER FUNCTION prms2mfinit()
icol = Gwc_col(icell)
IF ( Print_debug>DEBUG_less ) THEN
IF ( Hru_type(ihru)==0 ) THEN
IF ( IUZFBND(icol, irow)/=0 ) &
& PRINT *, 'WARNING, HRU inactive & UZF cell active, irow:', irow, 'icell:', icell, ' HRU:', ihru
IF ( IUZFBND(icol, irow)/=0 ) THEN
PRINT *, 'WARNING, HRU inactive & UZF cell active, irow:', irow, 'icell:', icell, ' HRU:', ihru
inactiveHru_activeCell(ihru) = 1
ENDIF
ENDIF
IF ( IUZFBND(icol, irow)==0 ) THEN
IF ( Hru_type(ihru) > 0 ) then
PRINT *, 'WARNING, UZF cell inactive, irow:', irow, ' icol:',icol,'icell:',icell, ' HRU is active:', ihru
activeHru_inactiveCell(ihru) = 1
end if
ENDIF
ENDIF
Expand Down

0 comments on commit 0d26b8d

Please sign in to comment.