Skip to content

Commit

Permalink
Merge pull request #462 from arbennett/bugfix/basin_soil_drainage_in_…
Browse files Browse the repository at this point in the history
…ilook_bvar

Fix basin variable reference/initialization
  • Loading branch information
arbennett authored May 26, 2021
2 parents c151a50 + 90df88d commit f9d427d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions build/source/dshare/get_ixname.f90
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ function get_ixbvar(varName)
case('basin__AquiferBaseflow' ); get_ixbvar = iLookBVAR%basin__AquiferBaseflow ! baseflow from the aquifer (m s-1)
case('basin__AquiferTranspire' ); get_ixbvar = iLookBVAR%basin__AquiferTranspire ! transpiration from the aquifer (m s-1)
case('basin__TotalRunoff' ); get_ixbvar = iLookBVAR%basin__TotalRunoff ! total runoff to channel from all active components (m s-1)
case('basin__SoilDrainage' ); get_ixbvar = iLookBVAR%basin__SoilDrainage ! soil drainage (m s-1)
! variables to compute runoff
case('routingRunoffFuture' ); get_ixbvar = iLookBVAR%routingRunoffFuture ! runoff in future time steps (m s-1)
case('routingFractionFuture' ); get_ixbvar = iLookBVAR%routingFractionFuture ! fraction of runoff in future time steps (-)
Expand Down
1 change: 1 addition & 0 deletions build/source/dshare/popMetadat.f90
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ subroutine popMetadat(err,message)
bvar_meta(iLookBVAR%basin__AquiferBaseflow) = var_info('basin__AquiferBaseflow' , 'baseflow from the aquifer' , 'm s-1' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
bvar_meta(iLookBVAR%basin__AquiferTranspire) = var_info('basin__AquiferTranspire', 'transpiration loss from the aquifer' , 'm s-1' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
bvar_meta(iLookBVAR%basin__TotalRunoff) = var_info('basin__TotalRunoff' , 'total runoff to channel from all active components' , 'm s-1' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
bvar_meta(iLookBVAR%basin__SoilDrainage) = var_info('basin__SoilDrainage' , 'soil drainage' , 'm s-1' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
bvar_meta(iLookBVAR%routingRunoffFuture) = var_info('routingRunoffFuture' , 'runoff in future time steps' , 'm s-1' , get_ixVarType('routing'), iMissVec, iMissVec, .false.)
bvar_meta(iLookBVAR%routingFractionFuture) = var_info('routingFractionFuture' , 'fraction of runoff in future time steps' , '-' , get_ixVarType('routing'), iMissVec, iMissVec, .false.)
bvar_meta(iLookBVAR%averageInstantRunoff) = var_info('averageInstantRunoff' , 'instantaneous runoff' , 'm s-1' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
Expand Down
3 changes: 2 additions & 1 deletion build/source/dshare/var_lookup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ MODULE var_lookup
integer(i4b) :: basin__AquiferBaseflow = integerMissing ! baseflow from the aquifer (m s-1)
integer(i4b) :: basin__AquiferTranspire = integerMissing ! transpiration from the aquifer (m s-1)
integer(i4b) :: basin__TotalRunoff = integerMissing ! total runoff to channel from all active components (m s-1)
integer(i4b) :: basin__SoilDrainage = integerMissing ! soil drainage (m s-1)
! define variables for runoff
integer(i4b) :: routingRunoffFuture = integerMissing ! runoff in future time steps (m s-1)
integer(i4b) :: routingFractionFuture = integerMissing ! fraction of runoff in future time steps (-)
Expand Down Expand Up @@ -841,7 +842,7 @@ MODULE var_lookup

! named variables: basin-average variables
type(iLook_bvar), public,parameter :: iLookBVAR =ilook_bvar ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,&
11, 12)
11, 12, 13)

! named variables in varibale type structure
type(iLook_varType), public,parameter :: iLookVarType =ilook_varType ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,&
Expand Down
4 changes: 2 additions & 2 deletions build/source/engine/run_oneGRU.f90
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ subroutine run_oneGRU(&
! ***********************************************************************************************************************
! ********** END LOOP THROUGH HRUS **************************************************************************************
! ***********************************************************************************************************************
! perform the routing
associate(totalArea => bvarData%var(iLookBVAR%basin__totalArea)%dat(1) )

! compute water balance for the basin aquifer
if(model_decisions(iLookDECISIONS%spatial_gw)%iDecision == singleBasin)then
Expand All @@ -275,8 +277,6 @@ subroutine run_oneGRU(&
bvarData%var(iLookBVAR%basin__TotalRunoff)%dat(1) = bvarData%var(iLookBVAR%basin__SurfaceRunoff)%dat(1) + bvarData%var(iLookBVAR%basin__ColumnOutflow)%dat(1)/totalArea + bvarData%var(iLookBVAR%basin__SoilDrainage)%dat(1)
endif

! perform the routing
associate(totalArea => bvarData%var(iLookBVAR%basin__totalArea)%dat(1) )
call qOverland(&
! input
model_decisions(iLookDECISIONS%subRouting)%iDecision, & ! intent(in): index for routing method
Expand Down

0 comments on commit f9d427d

Please sign in to comment.