Skip to content

Commit 223d4e6

Browse files
authored
Merge pull request #590 from ashleymedin/develop
sundials develop continuing merge
2 parents 5075208 + 2db0454 commit 223d4e6

12 files changed

Lines changed: 974 additions & 113 deletions

File tree

build/source/dshare/data_types.f90

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ MODULE data_types
457457
logical(lgt) :: firstSplitOper ! intent(in): flag indicating first flux call in a splitting operation
458458
logical(lgt) :: scalarSolution ! intent(in): flag to indicate the scalar solution
459459
logical(lgt) :: deriv_desired ! intent(in): flag indicating if derivatives are desired
460+
real(rkind) :: scalarAquiferStorageTrial ! intent(in): trial value of aquifer storage (m)
460461
real(rkind), allocatable :: mLayerTempTrial(:) ! intent(in): trial temperature at the current iteration (K)
461462
real(rkind), allocatable :: mLayerMatricHeadTrial(:) ! intent(in): matric potential (m)
462463
real(rkind), allocatable :: mLayerMatricHeadLiqTrial(:) ! intent(in): liquid water matric potential (m)
@@ -648,6 +649,7 @@ MODULE data_types
648649
real(rkind) :: scalarMatricHeadLiq ! liquid matric head in the upper-most soil layer (m)
649650
real(rkind),allocatable :: mLayerMatricHead(:) ! matric head in each soil layer (m)
650651
real(rkind) :: scalarVolFracLiq ! volumetric liquid water content in the upper-most soil layer (-)
652+
real(rkind) :: scalarTotalSoilLiq ! total liquid water in the soil column (kg m-2)
651653
real(rkind),allocatable :: mLayerVolFracLiq(:) ! volumetric liquid water content in each soil layer (-)
652654
real(rkind),allocatable :: mLayerVolFracIce(:) ! volumetric ice content in each soil layer (-)
653655
! input: pre-computed derivatives (all of these would need to be recomputed if wanted a numerical derivative)
@@ -681,6 +683,17 @@ MODULE data_types
681683
real(rkind) :: wettingFrontSuction ! Green-Ampt wetting front suction (m)
682684
real(rkind) :: soilIceScale ! soil ice scaling factor in Gamma distribution used to define frozen area (m)
683685
real(rkind) :: soilIceCV ! soil ice CV in Gamma distribution used to define frozen area (-)
686+
! input: aquifer variables for FUSE parameterizations
687+
real(rkind) :: aquiferBaseflowExp ! baseflow exponent (-)
688+
real(rkind) :: scalarAquiferStorageTrial ! trial value of aquifer storage (m)
689+
real(rkind) :: aquiferScaleFactor ! scaling factor for aquifer storage in the big bucket (m)
690+
! input: FUSE parameters
691+
real(rkind) :: FUSE_Ac_max ! FUSE PRMS max saturated area
692+
real(rkind) :: FUSE_phi_tens ! FUSE PRMS tension fraction
693+
real(rkind) :: FUSE_b ! FUSE ARNO/VIC exponent
694+
real(rkind) :: FUSE_lambda ! FUSE TOPMODEL gamma distribution lambda parameter
695+
real(rkind) :: FUSE_chi ! FUSE TOPMODEL chi distribution lambda parameter
696+
real(rkind) :: FUSE_mu ! FUSE TOPMODEL mu distribution lambda parameter
684697
contains
685698
procedure :: initialize => initialize_in_surfaceFlx
686699
end type in_type_surfaceFlx
@@ -1253,7 +1266,7 @@ end subroutine finalize_out_snowLiqFlx
12531266
! **** end snowLiqFlx ****
12541267

12551268
! **** soilLiqFlx ****
1256-
subroutine initialize_in_soilLiqFlx(in_soilLiqFlx,nsnow,nSoil,nlayers,firstSplitOper,scalarSolution,firstFluxCall,&
1269+
subroutine initialize_in_soilLiqFlx(in_soilLiqFlx,nsnow,nSoil,nlayers,firstSplitOper,scalarSolution,firstFluxCall,scalarAquiferStorageTrial,&
12571270
mLayerTempTrial,mLayerMatricHeadTrial,mLayerMatricHeadLiqTrial,mLayerVolFracLiqTrial,mLayerVolFracIceTrial,&
12581271
above_soilLiqFluxDeriv,above_soildLiq_dTk,above_soilFracLiq,flux_data,deriv_data)
12591272
class(in_type_soilLiqFlx),intent(out) :: in_soilLiqFlx ! class object for intent(in) soilLiqFlx arguments
@@ -1263,6 +1276,7 @@ subroutine initialize_in_soilLiqFlx(in_soilLiqFlx,nsnow,nSoil,nlayers,firstSplit
12631276
logical(lgt),intent(in) :: firstSplitOper ! flag to indicate if we are processing the first flux call in a splitting operation
12641277
logical(lgt),intent(in) :: scalarSolution ! flag to denote if implementing the scalar solution
12651278
logical(lgt),intent(in) :: firstFluxCall ! flag to indicate if we are processing the first flux call
1279+
real(rkind),intent(in) :: scalarAquiferStorageTrial ! trial value of aquifer storage (m)
12661280
real(rkind),intent(in) :: mLayerTempTrial(:) ! trial value for temperature of each snow/soil layer (K)
12671281
real(rkind),intent(in) :: mLayerMatricHeadTrial(:) ! trial value for the total water matric potential (m)
12681282
real(rkind),intent(in) :: mLayerMatricHeadLiqTrial(:) ! trial value for the liquid water matric potential (m)
@@ -1280,6 +1294,9 @@ subroutine initialize_in_soilLiqFlx(in_soilLiqFlx,nsnow,nSoil,nlayers,firstSplit
12801294
in_soilLiqFlx % scalarSolution=(scalarSolution .and. .not.firstFluxCall) ! intent(in): flag to indicate the scalar solution
12811295
in_soilLiqFlx % deriv_desired =.true. ! intent(in): flag indicating if derivatives are desired
12821296

1297+
! intent(in) arguments: aquifer variables needed for FUSE parameterizations
1298+
in_soilLiqFlx % scalarAquiferStorageTrial = scalarAquiferStorageTrial ! intent(in): trial value of aquifer storage (m)
1299+
12831300
! intent(in) arguments: trial temperature, matric potential, and volumetric fractions
12841301
in_soilLiqFlx % mLayerTempTrial=mLayerTempTrial(nSnow+1:nLayers) ! intent(in): trial temperature at the current iteration (K)
12851302
in_soilLiqFlx % mLayerMatricHeadTrial =mLayerMatricHeadTrial(1:nSoil) ! intent(in): matric potential (m)
@@ -1739,13 +1756,15 @@ subroutine initialize_in_surfaceFlx(in_surfaceFlx,nRoots,ixIce,nSoil,ibeg,iend,i
17391756
mLayerMatricHeadLiqTrial => in_soilLiqFlx % mLayerMatricHeadLiqTrial, & ! liquid matric head in each layer at the current iteration (m)
17401757
mLayerMatricHeadTrial => in_soilLiqFlx % mLayerMatricHeadTrial, & ! intent(in): matric head in each layer at the current iteration (m)
17411758
mLayerVolFracLiqTrial => in_soilLiqFlx % mLayerVolFracLiqTrial, & ! volumetric fraction of liquid water at the current iteration (-)
1742-
mLayerVolFracIceTrial => in_soilLiqFlx % mLayerVolFracIceTrial & ! volumetric fraction of ice at the current iteration (-)
1759+
mLayerVolFracIceTrial => in_soilLiqFlx % mLayerVolFracIceTrial, & ! volumetric fraction of ice at the current iteration (-)
1760+
scalarTotalSoilLiq => diag_data%var(iLookDIAG%scalarTotalSoilLiq)%dat(1) & ! total liquid water in the soil column (kg m-2)
17431761
&)
17441762
! intent(in): state variables
17451763
in_surfaceFlx % mLayerTemp = mLayerTempTrial ! temperature (K)
17461764
in_surfaceFlx % scalarMatricHeadLiq = mLayerMatricHeadLiqTrial(1) ! liquid matric head in the upper-most soil layer (m)
17471765
in_surfaceFlx % mLayerMatricHead = mLayerMatricHeadTrial ! matric head in each soil layer (m)
17481766
in_surfaceFlx % scalarVolFracLiq = mLayerVolFracLiqTrial(1) ! volumetric liquid water content the upper-most soil layer (-)
1767+
in_surfaceFlx % scalarTotalSoilLiq = scalarTotalSoilLiq ! total liquid water in the soil column (kg m-2)
17491768
in_surfaceFlx % mLayerVolFracLiq = mLayerVolFracLiqTrial ! volumetric liquid water content in each soil layer (-)
17501769
in_surfaceFlx % mLayerVolFracIce = mLayerVolFracIceTrial ! volumetric ice content in each soil layer (-)
17511770
end associate
@@ -1832,6 +1851,34 @@ subroutine initialize_in_surfaceFlx(in_surfaceFlx,nRoots,ixIce,nSoil,ibeg,iend,i
18321851
in_surfaceFlx % soilIceScale = soilIceScale ! soil ice scaling factor in Gamma distribution used to define frozen area (m)
18331852
in_surfaceFlx % soilIceCV = soilIceCV ! soil ice CV in Gamma distribution used to define frozen area (-)
18341853
end associate
1854+
1855+
! intent(in): aquifer values for FUSE parameterizations
1856+
associate(&
1857+
aquiferBaseflowExp => mpar_data%var(iLookPARAM%aquiferBaseflowExp)%dat(1), & ! baseflow exponent (-)
1858+
scalarAquiferStorageTrial => in_soilLiqFlx % scalarAquiferStorageTrial, & ! trial value of aquifer storage (m)
1859+
aquiferScaleFactor => mpar_data%var(iLookPARAM%aquiferScaleFactor)%dat(1) & ! scaling factor for aquifer storage in the big bucket (m)
1860+
&)
1861+
in_surfaceFlx % aquiferBaseflowExp = aquiferBaseflowExp ! baseflow exponent (-)
1862+
in_surfaceFlx % scalarAquiferStorageTrial = scalarAquiferStorageTrial ! trial value of aquifer storage (m)
1863+
in_surfaceFlx % aquiferScaleFactor = aquiferScaleFactor ! scaling factor for aquifer storage in the big bucket (m)
1864+
end associate
1865+
1866+
! intent(in): FUSE parameters
1867+
associate(&
1868+
FUSE_Ac_max => mpar_data%var(iLookPARAM%FUSE_Ac_max )%dat(1), & ! FUSE PRMS max saturated area
1869+
FUSE_phi_tens => mpar_data%var(iLookPARAM%FUSE_phi_tens)%dat(1), & ! FUSE PRMS tension fraction
1870+
FUSE_b => mpar_data%var(iLookPARAM%FUSE_b )%dat(1), & ! FUSE ARNO/VIC exponent
1871+
FUSE_lambda => mpar_data%var(iLookPARAM%FUSE_lambda )%dat(1), & ! FUSE TOPMODEL gamma distribution lambda parameter
1872+
FUSE_chi => mpar_data%var(iLookPARAM%FUSE_chi )%dat(1), & ! FUSE TOPMODEL chi distribution lambda parameter
1873+
FUSE_mu => mpar_data%var(iLookPARAM%FUSE_mu )%dat(1) & ! FUSE TOPMODEL mu distribution lambda parameter
1874+
&)
1875+
in_surfaceFlx % FUSE_Ac_max = FUSE_Ac_max ! FUSE PRMS max saturated area
1876+
in_surfaceFlx % FUSE_phi_tens = FUSE_phi_tens ! FUSE PRMS tension fraction
1877+
in_surfaceFlx % FUSE_b = FUSE_b ! FUSE ARNO/VIC exponent
1878+
in_surfaceFlx % FUSE_lambda = FUSE_lambda ! FUSE TOPMODEL gamma distribution lambda parameter
1879+
in_surfaceFlx % FUSE_chi = FUSE_chi ! FUSE TOPMODEL chi distribution lambda parameter
1880+
in_surfaceFlx % FUSE_mu = FUSE_mu ! FUSE TOPMODEL mu distribution lambda parameter
1881+
end associate
18351882
end subroutine initialize_in_surfaceFlx
18361883

18371884
subroutine initialize_io_surfaceFlx(io_surfaceFlx,nSoil,io_soilLiqFlx,iLayerHydCond,iLayerDiffuse)

build/source/dshare/flxMapping.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ subroutine flxMapping(err,message)
123123
flux2state_orig(iLookFLUX%scalarCanopyTranspiration) = flux2state(state1=iname_nrgCanopy, state2=iname_nrgLayer)
124124
flux2state_orig(iLookFLUX%scalarCanopyEvaporation) = flux2state(state1=iname_nrgCanopy, state2=integerMissing)
125125
flux2state_orig(iLookFLUX%scalarGroundEvaporation) = flux2state(state1=iname_nrgCanopy, state2=iname_nrgLayer)
126-
flux2state_orig(iLookFLUX%scalarAquiferTranspire) = flux2state(state1=iname_watCanopy, state2=integerMissing)
126+
flux2state_orig(iLookFLUX%scalarAquiferTranspire) = flux2state(state1=iname_watAquifer,state2=iname_watCanopy)
127127
flux2state_orig(iLookFLUX%mLayerTranspire) = flux2state(state1=iname_matLayer, state2=integerMissing)
128128

129129
! liquid and solid water fluxes through the canopy
@@ -161,10 +161,10 @@ subroutine flxMapping(err,message)
161161
flux2state_orig(iLookFLUX%mLayerColumnOutflow) = flux2state(state1=iname_matLayer, state2=integerMissing)
162162
flux2state_orig(iLookFLUX%scalarSoilBaseflow) = flux2state(state1=iname_matLayer, state2=integerMissing)
163163
flux2state_orig(iLookFLUX%scalarSoilDrainage) = flux2state(state1=iname_matLayer, state2=integerMissing)
164-
flux2state_orig(iLookFLUX%scalarAquiferRecharge) = flux2state(state1=iname_matLayer, state2=integerMissing)
165164

166165
! liquid water fluxes for the aquifer domain
167-
flux2state_orig(iLookFLUX%scalarAquiferBaseflow) = flux2state(state1=iname_watAquifer, state2=integerMissing)
166+
flux2state_orig(iLookFLUX%scalarAquiferRecharge) = flux2state(state1=iname_watAquifer,state2=iname_matLayer)
167+
flux2state_orig(iLookFLUX%scalarAquiferBaseflow) = flux2state(state1=iname_watAquifer,state2=integerMissing)
168168

169169
! derived variables
170170
flux2state_orig(iLookFLUX%scalarTotalET) = flux2state(state1=iname_nrgCanopy, state2=iname_nrgLayer)

build/source/dshare/get_ixname.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ function get_ixParam(varName)
429429
case('zmaxLayer2_upper' ); get_ixParam = iLookPARAM%zmaxLayer2_upper ! maximum layer depth for the 2nd layer when > 2 layers (m)
430430
case('zmaxLayer3_upper' ); get_ixParam = iLookPARAM%zmaxLayer3_upper ! maximum layer depth for the 3rd layer when > 3 layers (m)
431431
case('zmaxLayer4_upper' ); get_ixParam = iLookPARAM%zmaxLayer4_upper ! maximum layer depth for the 4th layer when > 4 layers (m)
432+
! FUSE surface runoff
433+
case('FUSE_Ac_max ' ); get_ixParam = iLookPARAM%FUSE_Ac_max ! FUSE PRMS max saturated area
434+
case('FUSE_phi_tens' ); get_ixParam = iLookPARAM%FUSE_phi_tens ! FUSE PRMS tension storage fraction
435+
case('FUSE_b ' ); get_ixParam = iLookPARAM%FUSE_b ! FUSE ARNO/VIC exponent
436+
case('FUSE_lambda ' ); get_ixParam = iLookPARAM%FUSE_lambda ! FUSE TOPMODEL gamma distribution lambda parameter
437+
case('FUSE_chi ' ); get_ixParam = iLookPARAM%FUSE_chi ! FUSE TOPMODEL gamma distribution chi parameter
438+
case('FUSE_mu ' ); get_ixParam = iLookPARAM%FUSE_mu ! FUSE TOPMODEL gamma distribution mu parameter
432439
! get to here if cannot find the variable
433440
case default
434441
get_ixParam = integerMissing

build/source/dshare/popMetadat.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ subroutine popMetadat(err,message)
304304
mpar_meta(iLookPARAM%zmaxLayer2_upper) = var_info('zmaxLayer2_upper' , 'maximum layer depth for the 2nd layer when > 2 layers' , 'm' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
305305
mpar_meta(iLookPARAM%zmaxLayer3_upper) = var_info('zmaxLayer3_upper' , 'maximum layer depth for the 3rd layer when > 3 layers' , 'm' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
306306
mpar_meta(iLookPARAM%zmaxLayer4_upper) = var_info('zmaxLayer4_upper' , 'maximum layer depth for the 4th layer when > 4 layers' , 'm' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
307+
! FUSE surface runoff
308+
mpar_meta(iLookPARAM%FUSE_Ac_max ) = var_info('FUSE_Ac_max' , 'FUSE PRMS max saturated area' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
309+
mpar_meta(iLookPARAM%FUSE_phi_tens) = var_info('FUSE_phi_tens' , 'FUSE PRMS tension storage fraction' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
310+
mpar_meta(iLookPARAM%FUSE_b ) = var_info('FUSE_b' , 'FUSE ARNO/VIC exponent' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
311+
mpar_meta(iLookPARAM%FUSE_lambda ) = var_info('FUSE_lambda' , 'FUSE TOPMODEL gamma distribution lambda parameter', 'm' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
312+
mpar_meta(iLookPARAM%FUSE_chi ) = var_info('FUSE_chi' , 'FUSE TOPMODEL gamma distribution chi parameter' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
313+
mpar_meta(iLookPARAM%FUSE_mu ) = var_info('FUSE_mu' , 'FUSE TOPMODEL gamma distribution mu parameter' , 'm' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
307314
! -----
308315
! * basin parameter data...
309316
! -------------------------

build/source/dshare/var_lookup.f90

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,13 @@ MODULE var_lookup
334334
integer(i4b) :: zmaxLayer2_upper = integerMissing ! maximum layer depth for the 2nd layer when > 2 layers (m)
335335
integer(i4b) :: zmaxLayer3_upper = integerMissing ! maximum layer depth for the 3rd layer when > 3 layers (m)
336336
integer(i4b) :: zmaxLayer4_upper = integerMissing ! maximum layer depth for the 4th layer when > 4 layers (m)
337+
! FUSE surface runoff
338+
integer(i4b) :: FUSE_Ac_max = integerMissing ! FUSE PRMS max saturated area
339+
integer(i4b) :: FUSE_phi_tens = integerMissing ! FUSE PRMS tension storage fraction
340+
integer(i4b) :: FUSE_b = integerMissing ! FUSE ARNO/VIC exponent
341+
integer(i4b) :: FUSE_lambda = integerMissing ! FUSE TOPMODEL gamma distribution lambda parameter
342+
integer(i4b) :: FUSE_chi = integerMissing ! FUSE TOPMODEL gamma distribution chi parameter
343+
integer(i4b) :: FUSE_mu = integerMissing ! FUSE TOPMODEL gamma distribution mu parameter
337344
endtype ilook_param
338345

339346
! ***********************************************************************************************************
@@ -924,7 +931,8 @@ MODULE var_lookup
924931
141,142,143,144,145,146,147,148,149,150,&
925932
151,152,153,154,155,156,157,158,159,160,&
926933
161,162,163,164,165,166,167,168,169,170,&
927-
171,172,173,174,175,176,177,178,179,180)
934+
171,172,173,174,175,176,177,178,179,180,&
935+
181,182,183,184,185,186)
928936
! named variables: model prognostic (state) variables
929937
type(iLook_prog), public,parameter :: iLookPROG =iLook_prog ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,&
930938
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,&

build/source/engine/computFlux.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ end subroutine finalize_snowLiqFlx
613613

614614
! **** soilLiqFlx ****
615615
subroutine initialize_soilLiqFlx
616-
call in_soilLiqFlx%initialize(nsnow,nSoil,nlayers,firstSplitOper,scalarSolution,firstFluxCall,&
616+
call in_soilLiqFlx%initialize(nsnow,nSoil,nlayers,firstSplitOper,scalarSolution,firstFluxCall,scalarAquiferStorageTrial,&
617617
mLayerTempTrial,mLayerMatricHeadTrial,mLayerMatricHeadLiqTrial,mLayerVolFracLiqTrial,mLayerVolFracIceTrial,&
618618
above_soilLiqFluxDeriv,above_soildLiq_dTk,above_soilFracLiq,flux_data,deriv_data)
619619
call io_soilLiqFlx%initialize(nsoil,dHydCond_dMatric,flux_data,diag_data,deriv_data)

0 commit comments

Comments
 (0)