From 90df88dfba1cef1b0dc6041fddd0ff13a47f79f2 Mon Sep 17 00:00:00 2001 From: arbennett Date: Wed, 26 May 2021 16:27:47 -0700 Subject: [PATCH] Fix basin variable reference/initialization --- build/source/dshare/get_ixname.f90 | 1 + build/source/dshare/popMetadat.f90 | 1 + build/source/dshare/var_lookup.f90 | 3 ++- build/source/engine/run_oneGRU.f90 | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build/source/dshare/get_ixname.f90 b/build/source/dshare/get_ixname.f90 index cf4480218..3efe30f92 100755 --- a/build/source/dshare/get_ixname.f90 +++ b/build/source/dshare/get_ixname.f90 @@ -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 (-) diff --git a/build/source/dshare/popMetadat.f90 b/build/source/dshare/popMetadat.f90 index 0a1b32add..afd925d0e 100755 --- a/build/source/dshare/popMetadat.f90 +++ b/build/source/dshare/popMetadat.f90 @@ -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.) diff --git a/build/source/dshare/var_lookup.f90 b/build/source/dshare/var_lookup.f90 index 1d7744c8a..ffc18c32b 100755 --- a/build/source/dshare/var_lookup.f90 +++ b/build/source/dshare/var_lookup.f90 @@ -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 (-) @@ -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,& diff --git a/build/source/engine/run_oneGRU.f90 b/build/source/engine/run_oneGRU.f90 index 149e9fc02..17fca209f 100755 --- a/build/source/engine/run_oneGRU.f90 +++ b/build/source/engine/run_oneGRU.f90 @@ -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 @@ -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