From a57fbf383b1c8d6506a45029b5b85b8f1d7ed0bb Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Thu, 30 Apr 2015 18:01:36 -0700 Subject: [PATCH 01/26] removed unused variables from var_derive.f90 --- build/source/engine/var_derive.f90 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build/source/engine/var_derive.f90 b/build/source/engine/var_derive.f90 index 064c729b6..24d7ca36c 100644 --- a/build/source/engine/var_derive.f90 +++ b/build/source/engine/var_derive.f90 @@ -41,8 +41,6 @@ subroutine calcHeight(& err,message) ! access the number of snow and soil layers USE data_struc,only:& - nSnow, & ! number of snow layers - nSoil, & ! number of soil layers nLayers ! total number of layers ! access named variables for snow and soil USE data_struc,only:ix_soil,ix_snow ! named variables for snow and soil @@ -428,7 +426,7 @@ subroutine v_shortcut(err,message) iden_water,& ! intrinsic density of liquid water (kg m-3) gravity, & ! gravitational acceleration (m s-2) Tfreeze ! freezing point of pure water (K) - USE data_struc,only:mpar_data,mvar_data,indx_data,ix_soil,ix_snow ! data structures + USE data_struc,only:mpar_data,mvar_data,ix_soil,ix_snow ! data structures USE var_lookup,only:iLookPARAM,iLookMVAR,iLookINDEX ! named variables for structure elements implicit none ! declare dummy variables From 536fda827370671394745f74aceb865fd6eba174 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 09:36:27 -0700 Subject: [PATCH 02/26] Removed unused variables in calcHeight() in var_derive.f90 Note that the variables inside the (associate ...) statement do not need to be defined in the enclosing function. --- build/source/engine/var_derive.f90 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/build/source/engine/var_derive.f90 b/build/source/engine/var_derive.f90 index 24d7ca36c..49358170c 100644 --- a/build/source/engine/var_derive.f90 +++ b/build/source/engine/var_derive.f90 @@ -59,14 +59,6 @@ subroutine calcHeight(& ! output: error control integer(i4b),intent(out) :: err ! error code character(*),intent(out) :: message ! error message - ! ---------------------------------------------------------------------------------- - ! model index variables - integer(i4b),dimension(nLayers) :: layerType ! type of the layer (ix_soil or ix_snow) - ! model variables - real(dp),dimension(nLayers) :: mLayerDepth ! depth of the layer (m) - real(dp),dimension(nLayers) :: mLayerHeight ! height of the layer mid-point (m) - real(dp),dimension(nLayers+1) :: iLayerHeight ! height of the layer interface (m) - ! ---------------------------------------------------------------------------------- ! local variables integer(i4b) :: iLayer ! loop through layers ! ---------------------------------------------------------------------------------- From 015cdbc008a52a57b9f98d88c4e7de48c33c99f3 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Thu, 30 Apr 2015 17:15:58 -0700 Subject: [PATCH 03/26] Removed unused variables from iceImpede and simplified call --- build/source/engine/soilLiqFlx.f90 | 6 ++--- build/source/engine/soil_utils.f90 | 35 +++--------------------------- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/build/source/engine/soilLiqFlx.f90 b/build/source/engine/soilLiqFlx.f90 index 14bbe53d8..ad72cc594 100644 --- a/build/source/engine/soilLiqFlx.f90 +++ b/build/source/engine/soilLiqFlx.f90 @@ -1169,8 +1169,8 @@ subroutine diagv_node(& ! compute hydraulic conductivity and its derivative in each soil layer ! compute the ice impedence factor and its derivative w.r.t. volumetric liquid water content (-) - call iceImpede(scalarVolFracIceTrial,scalarVolFracLiqTrial,theta_sat,f_impede,deriv_desired, & ! input - iceImpedeFac,dIceImpede_dLiq) ! output + call iceImpede(scalarVolFracIceTrial,f_impede, & ! input + iceImpedeFac,dIceImpede_dLiq) ! output select case(ixRichards) @@ -1241,7 +1241,7 @@ subroutine diagv_node(& !effSat = (volLiq - theta_res) / (theta_sat - volIce - theta_res) !psiLiq = matricHead(effSat,vGn_alpha,0._dp,1._dp,vGn_n,vGn_m) ! use effective saturation, so theta_res=0 and theta_sat=1 !hydCon = hydCond_psi(psiLiq,scalarSatHydCond,vGn_alpha,vGn_n,vGn_m) - !call iceImpede(volIce,volLiq,theta_sat,f_impede,deriv_desired,iceImpedeFac,dIceImpede_dLiq) + !call iceImpede(volIce,f_impede,iceImpedeFac,dIceImpede_dLiq) !hydIce = hydCon*iceImpedeFac !print*, 'test derivative: ', (psiLiq - scalarMatricHeadTrial)/dx, dPsiLiq_dTemp !print*, 'test derivative: ', (hydCon - hydCond_noIce)/dx, dHydCondMicro_dTemp diff --git a/build/source/engine/soil_utils.f90 b/build/source/engine/soil_utils.f90 index 366e5a53a..6a4329507 100644 --- a/build/source/engine/soil_utils.f90 +++ b/build/source/engine/soil_utils.f90 @@ -50,49 +50,20 @@ module soil_utils_module ! ****************************************************************************************************************************** ! public subroutine iceImpede: compute the ice impedence factor ! ****************************************************************************************************************************** - subroutine iceImpede(volFracIce,volFracLiq,theta_sat,f_impede,lTangent, & ! input - iceImpedeFactor,dIceImpede_dLiq) ! output + subroutine iceImpede(volFracIce,f_impede, & ! input + iceImpedeFactor,dIceImpede_dLiq) ! output ! computes the ice impedence factor (separate function, as used multiple times) implicit none ! input variables real(dp),intent(in) :: volFracIce ! volumetric fraction of ice (-) - real(dp),intent(in) :: volFracLiq ! volumetric fraction of liquid water (-) - real(dp),intent(in) :: theta_sat ! soil porosity (-) real(dp),intent(in) :: f_impede ! ice impedence parameter (-) - logical(lgt),intent(in) :: lTangent ! method used to compute derivative (.true. = analytical) ! output variables real(dp) :: iceImpedeFactor ! ice impedence factor (-) real(dp) :: dIceImpede_dLiq ! derivative in ice impedence factor w.r.t. volumetric liquid water content (-) - ! local variables - !real(dp) :: avCapIce ! available capacity for ice - !real(dp) :: xArg ! argument in the power function - !real(dp) :: f1 ! new function used to calculate numerical derivatives - ! compute ice impedance factor - ! NOTE: simplify so just a function of volumetric ice content + ! compute ice impedance factor as a function of volumetric ice content iceImpedeFactor = 10._dp**(-f_impede*volFracIce) dIceImpede_dLiq = 0._dp - ! compute volumetric fraction available for ice (-) - !avCapIce = theta_sat - volFracLiq - !if(volFracIce < avCapIce)then - ! - ! ! compute the ice impedence factor - ! xArg = 1._dp - volFracIce/avCapIce - ! iceImpedeFactor = xArg**f_impede - ! - ! ! compute derivative in ice impedence factor w.r.t. volumetric liquid water content (-) - ! if(lTangent)then - ! dIceImpede_dLiq = -volFracIce*(f_impede*xArg**(f_impede - 1._dp))/(avCapIce**2._dp) - ! else ! (numerical derivatives) - ! f1 = (1._dp - (volFracIce/ (theta_sat - (volFracLiq+dx)) ) )**f_impede - ! dIceImpede_dLiq = (f1 - iceImpedeFactor)/dx - ! endif - ! - ! pore space completely filled with ice - !else - ! iceImpedeFactor = 0._dp - ! dIceImpede_dLiq = 0._dp - !endif end subroutine iceImpede From 2ed19cb0b6cc4ea83454844d3062581511297cd5 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Thu, 30 Apr 2015 17:18:02 -0700 Subject: [PATCH 04/26] Removed unused local variable enthTempSoil --- build/source/engine/convE2Temp.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/build/source/engine/convE2Temp.f90 b/build/source/engine/convE2Temp.f90 index 6644335e0..ecdc4676a 100644 --- a/build/source/engine/convE2Temp.f90 +++ b/build/source/engine/convE2Temp.f90 @@ -202,7 +202,6 @@ function temp2ethpy(Tk,BulkDenWater,fc_param) real(dp) :: temp2ethpy ! return value of the function, total specific enthalpy (J m-3) ! declare local variables real(dp) :: frac_liq ! fraction of liquid water - real(dp) :: enthTempSoil ! temperature component of specific enthalpy for dry soil (J kg-1) real(dp) :: enthTempWater ! temperature component of specific enthalpy for total water (liquid and ice) (J kg-1) real(dp) :: enthMass ! mass component of specific enthalpy (J kg-1) ! NOTE: this function assumes the freezing curve for snow ... it needs modification to use vanGenuchten functions for soil From c415ee1b1ebc1604c2973cb0b6065ec6fc3c5878 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Thu, 30 Apr 2015 17:21:19 -0700 Subject: [PATCH 05/26] Removed unused variable charData --- build/source/engine/ffile_info.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/build/source/engine/ffile_info.f90 b/build/source/engine/ffile_info.f90 index 2dbf4c301..3849722a8 100644 --- a/build/source/engine/ffile_info.f90 +++ b/build/source/engine/ffile_info.f90 @@ -48,7 +48,6 @@ subroutine ffile_info(nHRU,err,message) character(*),intent(out) :: message ! error message ! define local variables character(LEN=1024),allocatable :: dataLines(:) ! vector of lines of information (non-comment lines) - character(LEN=1024),allocatable :: charData(:) ! vector of information (words) for a given line of information integer(i4b),parameter :: imiss = -999 ! missing data character(len=256) :: cmessage ! error message for downwind routine character(LEN=256) :: infile ! input filename From 00cafea1ead52a89b1e02cbc2eb62919f2a5a103 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Thu, 30 Apr 2015 17:25:57 -0700 Subject: [PATCH 06/26] Removed unused variables from read_icond.f90 --- build/source/engine/read_icond.f90 | 3 --- 1 file changed, 3 deletions(-) diff --git a/build/source/engine/read_icond.f90 b/build/source/engine/read_icond.f90 index d7603f2bb..83c63a8d4 100644 --- a/build/source/engine/read_icond.f90 +++ b/build/source/engine/read_icond.f90 @@ -61,7 +61,6 @@ subroutine read_icond(err,message) USE allocspace_module,only:alloc_mvar ! allocate space for model variables USE allocspace_module,only:alloc_indx ! allocate space for model variables ! data structures - USE data_struc,only:model_decisions ! model decision structure USE var_lookup,only:iLookDECISIONS ! named variables for elements of the decision structure USE data_struc,only:mpar_data ! data for model parameetrs USE data_struc,only:mvar_data,mvar_meta ! data/metadata for model variables @@ -116,11 +115,9 @@ subroutine read_icond(err,message) real(dp),pointer :: theta_res ! soil residual volumetric water content (-) real(dp),pointer :: snowfrz_scale ! scaling parameter for the snow freezing curve (K-1) real(dp),pointer :: FCapil ! fraction of snow pore space in tension storage (-) - real(dp) :: Tcrit ! temperature above which all water is unfrozen (K) real(dp) :: vGn_m ! van Genutchen "m" parameter (-) real(dp) :: kappa ! constant in the freezing curve function (m K-1) real(dp) :: maxVolFracLiq ! maximum volumetric fraction of liquid water (used in moisture-based form of Richards' equation) - real(dp) :: residlVolFracLiq ! volumetric fraction of liquid water in tension storage (snow) real(dp) :: h1,h2 ! used to check depth and height are consistent real(dp),pointer :: scalarCanopyTemp ! canopy temperature (K) real(dp),pointer :: scalarCanopyIce ! mass of ice on the vegetation canopy (kg m-2) From 80324a0b3d08825317a41a0c9ddd8c59131ecbe8 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Thu, 30 Apr 2015 18:09:31 -0700 Subject: [PATCH 07/26] removed unused variable from read_force.f90 --- build/source/engine/read_force.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/build/source/engine/read_force.f90 b/build/source/engine/read_force.f90 index 88859fa2b..0cbeec2b8 100644 --- a/build/source/engine/read_force.f90 +++ b/build/source/engine/read_force.f90 @@ -36,7 +36,6 @@ subroutine read_force(istep,iHRU,err,message) USE data_struc,only:forcFileInfo ! forcing file info USE data_struc,only:data_step ! length of the data step (s) USE data_struc,only:dJulianStart ! julian day of start time of simulation - USE data_struc,only:dJulianFinsh ! julian day of end time of simulation USE data_struc,only:refTime,refJulday ! reference time USE data_struc,only:fracJulDay ! fractional julian days since the start of year USE data_struc,only:yearLength ! number of days in the current year From 1ca38e6d2c4533390a81ad0b238a372a03bfe2cb Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 15:00:12 -0700 Subject: [PATCH 08/26] Removed unused variables from multi_driver.f90 --- build/source/driver/multi_driver.f90 | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/build/source/driver/multi_driver.f90 b/build/source/driver/multi_driver.f90 index 6e7ce1054..29cd180d6 100644 --- a/build/source/driver/multi_driver.f90 +++ b/build/source/driver/multi_driver.f90 @@ -65,11 +65,10 @@ program multi_driver USE snow_fileManager,only:OUTPUT_PATH,OUTPUT_PREFIX ! define output file USE snow_fileManager,only:LOCALPARAM_INFO,BASINPARAM_INFO ! files defining the default values and constraints for model parameters USE data_struc,only:doJacobian ! flag to compute the Jacobian -USE data_struc,only:forcFileInfo ! information on forcing data file USE data_struc,only:localParFallback ! local column default parameters USE data_struc,only:basinParFallback ! basin-average default parameters USE data_struc,only:mpar_meta,bpar_meta ! metadata for local column and basin-average model parameters -USE data_struc,only:data_step,numtim ! length of data step (s) and number of time steps +USE data_struc,only:numtim ! number of time steps USE data_struc,only:time_data,time_hru,refTime ! time and reference time USE data_struc,only:forc_data,forc_hru ! model forcing data USE data_struc,only:type_data,type_hru ! classification of veg, soils etc. @@ -114,7 +113,6 @@ program multi_driver integer(i4b) :: nHRU ! number of hydrologic response units integer(i4b) :: iStep=0 ! index of model time step integer(i4b) :: jStep=0 ! index of model output -integer(i4b) :: iMonth ! index of the current month ! define the re-start file logical(lgt) :: printRestart ! flag to print a re-start file integer(i4b),parameter :: ixRestart_im=1001 ! named variable to print a re-start file once per month @@ -140,27 +138,18 @@ program multi_driver real(dp),allocatable :: dt_init(:) ! used to initialize the length of the sub-step for each HRU real(dp),pointer :: totalArea=>null() ! total basin area (m2) ! exfiltration -real(dp) :: totalStorage ! total water in the soil column (m) -real(dp) :: availStorage ! water required to bring the entire soil column to saturation (m) -real(dp) :: totalInflow ! total inflow to the soil column from upstream HRUs (m s-1) real(dp),parameter :: supersatScale=0.001_dp ! scaling factor for the logistic function (-) real(dp),parameter :: xMatch = 0.99999_dp ! point where x-value and function value match (-) real(dp),parameter :: safety = 0.01_dp ! safety factor to ensure logistic function is less than 1 real(dp),parameter :: fSmall = epsilon(xMatch) ! smallest possible value to test real(dp) :: supersatThresh ! threshold in super-saturation function (-) real(dp) :: exfilMin ! minimum fraction of storage filled for exfiltration to occur (-) -real(dp) :: expFunc ! exponential function used as part of the flux calculation (-) -real(dp) :: logFunc ! logistic smoothing function (-) -real(dp) :: fracCap ! fraction of storage filled with liquid water and ice (-) -real(dp) :: exfiltration ! exfiltration (m3/s) real(dp),allocatable :: upArea(:) ! area upslope of each HRU ! general local variables real(dp) :: fracHRU ! fractional area of a given HRU (-) real(dp),allocatable :: zSoilReverseSign(:) ! height at bottom of each soil layer, negative downwards (m) real(dp),dimension(12) :: greenVegFrac_monthly ! fraction of green vegetation in each month (0-1) real(dp),parameter :: doubleMissing=-9999._dp ! missing value -integer(i4b) :: iSoil ! index of soil layer -integer(i4b) :: ixIce ! index of bottom-most ice layer ! error control integer(i4b) :: err=0 ! error code character(len=1024) :: message='' ! error message From df9153676daace85be4ead3bf903f1ab28ea6aaa Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 15:08:44 -0700 Subject: [PATCH 09/26] Removed unused variables from snowAlbedo.f90 --- build/source/engine/snowAlbedo.f90 | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/build/source/engine/snowAlbedo.f90 b/build/source/engine/snowAlbedo.f90 index 5e9f1b86b..8d2b68185 100644 --- a/build/source/engine/snowAlbedo.f90 +++ b/build/source/engine/snowAlbedo.f90 @@ -84,35 +84,6 @@ subroutine snowAlbedo(& ! output: error control integer(i4b),intent(out) :: err ! error code character(*),intent(out) :: message ! error message - ! -------------------------------------------------------------------------------------------------------------------------------------- - ! variables in data structures - ! input: model decisions - integer(i4b) :: ixCanopySrad ! index of method used for canopy sw radiation - integer(i4b) :: ixAlbedoMethod ! index of method used for snow albedo - ! input: model parameters - real(dp) :: Frad_vis ! fraction of radiation in visible part of spectrum (-) - real(dp) :: Frad_direct ! fraction direct solar radiation (-) - real(dp) :: albedoMax ! maximum snow albedo for a single spectral band (-) - real(dp) :: albedoMinWinter ! minimum snow albedo during winter for a single spectral band (-) - real(dp) :: albedoMinSpring ! minimum snow albedo during spring for a single spectral band (-) - real(dp) :: albedoMaxVisible ! maximum snow albedo in the visible part of the spectrum (-) - real(dp) :: albedoMinVisible ! minimum snow albedo in the visible part of the spectrum (-) - real(dp) :: albedoMaxNearIR ! maximum snow albedo in the near infra-red part of the spectrum (-) - real(dp) :: albedoMinNearIR ! minimum snow albedo in the near infra-red part of the spectrum (-) - real(dp) :: albedoDecayRate ! albedo decay rate (s) - real(dp) :: tempScalGrowth ! temperature scaling factor for grain growth (K-1) - real(dp) :: albedoSootLoad ! soot load factor (-) - real(dp) :: albedoRefresh ! critical mass necessary for albedo refreshment (kg m-2) - real(dp) :: snowfrz_scale ! scaling parameter for the freezing curve for snow (K-1) - ! input: model variables - real(dp) :: snowfallRate ! snowfall rate (kg m-2 s-1) - real(dp) :: surfaceTemp ! surface temperature (K) - real(dp) :: cosZenith ! cosine of the zenith angle - ! input-output: snow albedo - real(dp),dimension(nBands) :: spectralSnowAlbedoDiffuse ! diffuse snow albedo in each spectral band (-) - real(dp),dimension(nBands) :: spectralSnowAlbedoDirect ! direct snow albedo in each spectral band (-) - real(dp) :: scalarSnowAlbedo ! snow albedo for the entire spectral band (-) - ! -------------------------------------------------------------------------------------------------------------------------------------- ! local variables integer(i4b),parameter :: ixVisible=1 ! named variable to define index in array of visible part of the spectrum integer(i4b),parameter :: ixNearIR=2 ! named variable to define index in array of near IR part of the spectrum From 18921e073427bc5d54f5413e8245371192fbeab6 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 15:12:22 -0700 Subject: [PATCH 10/26] Removed unused variables from canopySnow.f90 --- build/source/engine/canopySnow.f90 | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/build/source/engine/canopySnow.f90 b/build/source/engine/canopySnow.f90 index 72022b468..af63a71b5 100644 --- a/build/source/engine/canopySnow.f90 +++ b/build/source/engine/canopySnow.f90 @@ -73,31 +73,10 @@ subroutine canopySnow(& ! output: error control integer(i4b),intent(out) :: err ! error code character(*),intent(out) :: message ! error message - ! ------------------------------------------------------------------------------------------------------------------------------- - ! variables in the data structures - ! input: model decisions - integer(i4b) :: ixSnowInterception ! choice of option to determine maximum snow interception capacity - ! input: model forcing data - real(dp) :: scalarAirtemp ! air temperature (K) - ! input: model parameters - real(dp) :: refInterceptCapSnow ! reference canopy interception capacity for snow per unit leaf area (kg m-2) - real(dp) :: ratioDrip2Unloading ! ratio of canopy drip to snow unloading (-) - real(dp) :: snowUnloadingCoeff ! time constant for unloading of snow from the forest canopy (s-1) - ! input: diagnostic variables - real(dp) :: scalarSnowfall ! computed snowfall rate (kg m-2 s-1) - real(dp) :: scalarNewSnowDensity ! density of new snow (kg m-3) - real(dp) :: scalarCanopyLiqDrainage ! liquid drainage from the vegetation canopy (kg m-2 s-1) - ! input-output: state variables - real(dp) :: scalarCanopyIce ! mass of ice on the vegetation canopy (kg m-2) - ! output: diagnostic variables - real(dp) :: scalarThroughfallSnow ! snow that reaches the ground without ever touching the canopy (kg m-2 s-1) - real(dp) :: scalarCanopySnowUnloading ! unloading of snow from the vegetion canopy (kg m-2 s-1) - ! ------------------------------------------------------------------------------------------------ ! local variables real(dp),parameter :: valueMissing=-9999._dp ! missing value integer(i4b) :: iter ! iteration index integer(i4b),parameter :: maxiter=50 ! maximum number of iterations - integer(i4b) :: itry ! index of loop used for testing real(dp) :: unloading_melt ! unloading associated with canopy drip (kg m-2 s-1) real(dp) :: airtemp_degC ! value of air temperature in degrees Celcius real(dp) :: leafScaleFactor ! scaling factor for interception based on temperature (-) From fe236a62c023fedf092f0cbaa841a71b2329c273 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 15:18:06 -0700 Subject: [PATCH 11/26] Removed unused variables from tempAdjust.f90 --- build/source/engine/tempAdjust.f90 | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/build/source/engine/tempAdjust.f90 b/build/source/engine/tempAdjust.f90 index 94ca8b06a..c25082522 100644 --- a/build/source/engine/tempAdjust.f90 +++ b/build/source/engine/tempAdjust.f90 @@ -65,18 +65,6 @@ subroutine tempAdjust(& ! output: error control integer(i4b),intent(out) :: err ! error code character(*),intent(out) :: message ! error message - ! ------------------------------------------------------------------------------------------------------------------------------- - ! variables in the data structures - ! input: model parameters for canopy thermodynamics - real(dp) :: snowfrz_scale ! scaling factor for snow freezing curve (K) - real(dp) :: specificHeatVeg ! specific heat of vegetation mass (J kg-1 K-1) - real(dp) :: maxMassVegetation ! maximum mass of vegetation (full foliage) (kg m-2) - ! input-output: state variables - real(dp) :: scalarCanopyLiq ! mass of liquid water on the vegetation canopy (kg m-2) - real(dp) :: scalarCanopyIce ! mass of ice on the vegetation canopy (kg m-2) - real(dp) :: scalarCanopyTemp ! temperature of the vegetation canopy (K) - ! output: diagnostic variables - real(dp) :: scalarBulkVolHeatCapVeg ! bulk volumetric heat capacity of vegetation (J m-3 K-1) ! ------------------------------------------------------------------------------------------------ ! local variables for canopy thermodynamics integer(i4b) :: iTry ! trial index @@ -84,22 +72,13 @@ subroutine tempAdjust(& integer(i4b),parameter :: maxiter=100 ! maximum number of iterations real(dp),parameter :: dx=1.e-6_dp ! finite difference increment (used to test derivatives) real(dp) :: fLiq ! fraction of liquid water (-) - real(dp) :: dW_dT ! derivative in canopy ice content w.r.t canopy temperature (kg m-2 K-1) real(dp) :: tempMin,tempMax ! solution constraints for temperature (K) real(dp) :: nrgMeltFreeze ! energy required to melt-freeze the water to the current canopy temperature (J m-3) real(dp) :: scalarCanopyWat ! total canopy water (kg m-2) real(dp) :: scalarCanopyIceOld ! canopy ice content after melt-freeze to the initial temperature (kg m-2) - real(dp) :: scalarCanopyIceIter ! trial value for canopy ice content (kg m-2) - real(dp) :: scalarCanopyTempIter ! trial value for canopy temperature (K) - real(dp) :: scalarCanopyTempTrial ! trial value for canopy temperature, before update (K) - real(dp) :: resNrg,resNrgOld ! energy residual (J m-3) real(dp),parameter :: resNrgToler=0.1_dp ! tolerance for the energy residual (J m-3) - real(dp) :: delTemp ! iteration increment for temperature - real(dp) :: xLambda ! scaling factor for the iteration increment (-) - real(dp) :: adjTemp ! adjusted iteration increment (K) - real(dp) :: f1,f2,x1,x2,fTry,xTry,fDer,xInc - logical(lgt) :: fBis ! .true. if bisection - real(dp) :: term1, term2 + real(dp) :: f1,f2,x1,x2,fTry,xTry,fDer,xInc ! iteration variables + logical(lgt) :: fBis ! .true. if bisection ! ------------------------------------------------------------------------------------------------------------------------------- ! initialize error control err=0; message='tempAdjust/' From fe5d750ed212dc1911e057699bb1c9616498ec1e Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 15:19:21 -0700 Subject: [PATCH 12/26] Removed unused variables from snwCompact.f90 --- build/source/engine/snwCompact.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/build/source/engine/snwCompact.f90 b/build/source/engine/snwCompact.f90 index c93e8c92c..567a27716 100644 --- a/build/source/engine/snwCompact.f90 +++ b/build/source/engine/snwCompact.f90 @@ -79,7 +79,6 @@ subroutine snwDensify(& character(*),intent(out) :: message ! error message ! ----------------------------------------------------------------------------------------------------------------------------------------- ! define local variables - character(len=256) :: cmessage ! error message for downwind routine real(dp),parameter :: dt_toler=0.1_dp ! fraction of compaction allowed in a time step (-) integer(i4b) :: iSnow ! index of snow layers integer(i4b) :: nSnow ! number of snow layers From 0521748fe5e0346d11ef8d33022bc21b44877af7 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 15:58:22 -0700 Subject: [PATCH 13/26] Removed unused variables from layerMerge.f90 --- build/source/engine/layerMerge.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/source/engine/layerMerge.f90 b/build/source/engine/layerMerge.f90 index e486c85b6..b4aeb1845 100644 --- a/build/source/engine/layerMerge.f90 +++ b/build/source/engine/layerMerge.f90 @@ -432,7 +432,7 @@ end subroutine layer_combine ! (layer "iSnow" will be filled with a combined layer later) ! *********************************************************************************************************** subroutine rmLyAllVars(mvar_data,indx_data,iSnow,err,message) - USE data_struc,only:mvar_meta,indx_meta ! metadata + USE data_struc,only:mvar_meta ! metadata USE data_struc,only:var_ilength,var_dlength ! data vectors with variable length dimension USE var_lookup,only:iLookMVAR,iLookINDEX ! named variables for structure elements implicit none From dfc8cf5bd20fcf9fcbd3a3cd50b0108d2db784ed Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 16:42:25 -0700 Subject: [PATCH 14/26] Removed unused variables from layerDivide.f90 --- build/source/engine/layerDivide.f90 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build/source/engine/layerDivide.f90 b/build/source/engine/layerDivide.f90 index 3c47a3a3b..5e057bf0b 100644 --- a/build/source/engine/layerDivide.f90 +++ b/build/source/engine/layerDivide.f90 @@ -140,9 +140,7 @@ subroutine layerDivide(& ! define local variables character(LEN=256) :: cmessage ! error message of downwind routine integer(i4b) :: iLayer ! layer index - integer(i4b) :: jLayer ! layer index integer(i4b) :: kLayer ! layer index - integer(i4b) :: ivar ! variable index real(dp),dimension(4) :: zmax_lower ! lower value of maximum layer depth real(dp),dimension(4) :: zmax_upper ! upper value of maximum layer depth real(dp) :: zmaxCheck ! value of zmax for a given snow layer @@ -369,8 +367,8 @@ end subroutine layerDivide ! ************************************************************************************************ subroutine addModelLayer(mvar_data,indx_data,ix_divide,err,message) ! provide access to variables in the data structures - USE data_struc,only:mvar_meta,indx_meta ! metadata - USE data_struc,only:var_ilength,var_dlength ! data vectors with variable length dimension + USE data_struc,only:mvar_meta ! metadata + USE data_struc,only:var_ilength,var_dlength ! data vectors with variable length dimension USE var_lookup,only:iLookPARAM,iLookMVAR,iLookINDEX ! named variables for structure elements implicit none ! --------------------------------------------------------------------------------------------- From 48bf0ec991460a6f766d2646eb4fb72ae7bd94ed Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 16:44:29 -0700 Subject: [PATCH 15/26] Removed unused variables from vegPhenlgy.f90 --- build/source/engine/vegPhenlgy.f90 | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/build/source/engine/vegPhenlgy.f90 b/build/source/engine/vegPhenlgy.f90 index b12dab1c7..f27c12456 100644 --- a/build/source/engine/vegPhenlgy.f90 +++ b/build/source/engine/vegPhenlgy.f90 @@ -90,29 +90,7 @@ subroutine vegPhenlgy(& integer(i4b),intent(out) :: err ! error code character(*),intent(out) :: message ! error message ! ------------------------------------------------------------------------------------------------- - ! variables in the data structure - ! input: model decisions - integer(i4b) :: ix_bcUpprTdyn ! intent(in): [i4b] index of method used for the upper boundary condition for thermodynamics - integer(i4b) :: ix_bcUpprSoiH ! intent(in): [i4b] index of method used for the upper boundary condition for soil hydrology - ! input: local attributes - integer(i4b) :: vegTypeIndex ! intent(in): [i4b] vegetation type index - real(dp) :: latitude ! intent(in): [dp] latitude - ! input: vegetation phenology - real(dp) :: scalarSnowDepth ! intent(in): [dp] snow depth on the ground surface (m) - real(dp) :: scalarCanopyTemp ! intent(in): [dp] temperature of the vegetation canopy at the start of the sub-step (K) - real(dp) :: scalarRootZoneTemp ! intent(in): [dp] root zone temperature (K) - real(dp) :: heightCanopyTop ! intent(in): [dp] height of the top of the canopy (m) - real(dp) :: heightCanopyBottom ! intent(in): [dp] height of the bottom of the canopy (m) - ! input/output: vegetation phenology - real(dp) :: scalarLAI ! intent(inout): [dp] one-sided leaf area index (m2 m-2) - real(dp) :: scalarSAI ! intent(inout): [dp] one-sided stem area index (m2 m-2) - ! output: vegetation phenology - real(dp) :: scalarExposedLAI ! intent(out): [dp] exposed leaf area index after burial by snow (m2 m-2) - real(dp) :: scalarExposedSAI ! intent(out): [dp] exposed stem area index after burial by snow (m2 m-2) - real(dp) :: scalarGrowingSeasonIndex ! intent(out): [dp] growing season index (0=off, 1=on) - ! ------------------------------------------------------------------------------------------------- ! local - character(LEN=256) :: cmessage ! error message of downwind routine real(dp) :: notUsed_heightCanopyTop ! height of the top of the canopy layer (m) real(dp) :: heightAboveSnow ! height top of canopy is above the snow surface (m) ! initialize error control From 23beb0590c175177312670b5d4d9158e9d6aec4d Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 16:49:34 -0700 Subject: [PATCH 16/26] Removed unused variables and commented out code from diagn_evar.f90 --- build/source/engine/diagn_evar.f90 | 35 ------------------------------ 1 file changed, 35 deletions(-) diff --git a/build/source/engine/diagn_evar.f90 b/build/source/engine/diagn_evar.f90 index ae49cbe64..8c9f15791 100644 --- a/build/source/engine/diagn_evar.f90 +++ b/build/source/engine/diagn_evar.f90 @@ -92,33 +92,6 @@ subroutine diagn_evar(& ! output: error control integer(i4b),intent(out) :: err ! error code character(*),intent(out) :: message ! error message - ! -------------------------------------------------------------------------------------------------------------------------------------- - ! variables in the data structures - ! input: state variables - real(dp) :: scalarCanopyIce ! mass of ice on the vegetation canopy (kg m-2) - real(dp) :: scalarCanopyLiquid ! mass of liquid water on the vegetation canopy (kg m-2) - real(dp),dimension(nLayers) :: mLayerVolFracIce ! volumetric fraction of ice in each layer (-) - real(dp),dimension(nLayers) :: mLayerVolFracLiq ! volumetric fraction of liquid water in each layer (-) - ! input: coordinate variables - integer(i4b),dimension(nLayers) :: layerType ! type of the layer (snow or soil) - real(dp),dimension(nLayers) :: mLayerHeight ! height of the layer mid-point (top of soil = 0) - real(dp),dimension(0:nLayers) :: iLayerHeight ! height of the layer interface (top of soil = 0) - ! input: model parameters - real(dp) :: specificHeatVeg ! specific heat of vegetation (J kg-1 K-1) - real(dp) :: maxMassVegetation ! maximum mass of vegetation (full foliage) (kg m-2) - real(dp) :: iden_soil ! intrinsic density of soil (kg m-3) - real(dp) :: thCond_soil ! thermal conductivity of soil (W m-1 K-1) - real(dp) :: theta_sat ! soil porosity (-) - real(dp) :: frac_sand ! fraction of sand (-) - real(dp) :: frac_silt ! fraction of silt (-) - real(dp) :: frac_clay ! fraction of clay (-) - ! output: diagnostic variables - real(dp) :: scalarBulkVolHeatCapVeg ! bulk volumetric heat capacity of vegetation (J m-3 K-1) - real(dp),dimension(nLayers) :: mLayerVolHtCapBulk ! volumetric heat capacity in each layer (J m-3 K-1) - real(dp),dimension(nLayers) :: mLayerThermalC ! thermal conductivity at the mid-point of each layer (W m-1 K-1) - real(dp),dimension(0:nLayers) :: iLayerThermalC ! thermal conductivity at the interface of each layer (W m-1 K-1) - real(dp),dimension(nLayers) :: mLayerVolFracAir ! volumetric fraction of air in each layer (-) - ! -------------------------------------------------------------------------------------------------------------------------------- ! -------------------------------------------------------------------------------------------------------------------------------- ! local variables character(LEN=256) :: cmessage ! error message of downwind routine @@ -127,8 +100,6 @@ subroutine diagn_evar(& real(dp) :: TCp ! thermal conductivity above the layer interface (W m-1 K-1) real(dp) :: zdn ! height difference between interface and lower value (m) real(dp) :: zdp ! height difference between interface and upper value (m) - real(dp) :: lambda_wet ! thermal conductivity of the wet material - !real(dp) :: kerstenNum ! the Kersten number (-), defining weight applied to conductivity of the wet medium real(dp) :: bulkden_soil ! bulk density of soil (kg m-3) real(dp) :: lambda_drysoil ! thermal conductivity of dry soil (W m-1) real(dp) :: lambda_wetsoil ! thermal conductivity of wet soil (W m-1) @@ -244,12 +215,6 @@ subroutine diagn_evar(& ! iLayer, mLayerVolFracIce(iLayer), mLayerVolFracLiq(iLayer), mLayerThermalC(iLayer) endif - ! compute the thermal conductivity of the wet material (W m-1) - !lambda_wet = lambda_wetsoil**(1._dp - theta_sat) * lambda_water**theta_sat * lambda_ice**(theta_sat - mLayerVolFracLiq(iLayer)) - ! compute the Kersten number (-) - !kerstenNum = log10( (mLayerVolFracIce(iLayer) + mLayerVolFracLiq(iLayer))/theta_sat ) + 1._dp - ! ...and, compute the thermal conductivity - !mLayerThermalC(iLayer) = kerstenNum*lambda_wet + (1._dp - kerstenNum)*lambda_drysoil ! * snow case(ix_snow) call tcond_snow(mLayerVolFracIce(iLayer)*iden_ice,mLayerThermalC(iLayer),err,cmessage) From aa01fe4dd434aaf78c9e1f7d5179e6ccea6a1184 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 16:59:46 -0700 Subject: [PATCH 17/26] Removed unused variables from groundwatr.f90 This includes unused dummy arguments in some function calls. Hence the update in systemSolv.f90 (groundwatr call) --- build/source/engine/groundwatr.f90 | 45 ------------------------------ build/source/engine/systemSolv.f90 | 1 - 2 files changed, 46 deletions(-) diff --git a/build/source/engine/groundwatr.f90 b/build/source/engine/groundwatr.f90 index a7c020d79..eda923619 100644 --- a/build/source/engine/groundwatr.f90 +++ b/build/source/engine/groundwatr.f90 @@ -76,7 +76,6 @@ module groundwatr_module subroutine groundwatr(& ! input: model control - dt, & ! intent(in): length of the model time step (s) getSatDepth, & ! intent(in): logical flag to compute index of the lowest saturated layer ! input: state and diagnostic variables @@ -112,7 +111,6 @@ subroutine groundwatr(& ! * dummy variables ! --------------------------------------------------------------------------------------- ! input: model control - real(dp),intent(in) :: dt ! length of the model time step (s) logical(lgt),intent(in) :: getSatDepth ! logical flag to compute index of the lowest saturated layer ! input: state and diagnostic variables real(dp),intent(in) :: mLayerdTheta_dPsi(:) ! derivative in the soil water characteristic w.r.t. matric head in each layer (m-1) @@ -131,22 +129,9 @@ subroutine groundwatr(& integer(i4b),intent(out) :: err ! error code character(*),intent(out) :: message ! error message ! --------------------------------------------------------------------------------------- - ! * variables in the data structures - ! --------------------------------------------------------------------------------------- - ! input: baseflow parameters - real(dp) :: fieldCapacity ! intent(in): field capacity (-) - real(dp) :: theta_sat ! intent(in): soil porosity (-) - real(dp) :: theta_res ! intent(in): residual volumetric water content (-) - ! input: van Genuchten soil parameters - real(dp) :: vGn_alpha,vGn_n,vGn_m ! van Genuchten parameters - ! output: diagnostic variables - real(dp) :: scalarExfiltration ! intent(out): exfiltration from the soil profile (m s-1) - real(dp),dimension(nSoil) :: mLayerColumnOutflow ! intent(out): column outflow from each soil layer (m3 s-1) - ! --------------------------------------------------------------------------------------- ! * local variables ! --------------------------------------------------------------------------------------- ! general local variables - character(LEN=256) :: cmessage ! error message of downwind routine integer(i4b) :: iLayer ! index of soil layer real(dp),dimension(nSoil,nSoil) :: dBaseflow_dVolLiq ! derivative in the baseflow flux w.r.t. volumetric liquid water content (m s-1) ! local variables to compute the numerical Jacobian @@ -209,12 +194,10 @@ subroutine groundwatr(& ! use private subroutine to compute baseflow (for multiple calls for numerical Jacobian) call computeBaseflow(& ! input: control and state variables - dt, & ! intent(in): length of the model time step (s) .true., & ! intent(in): .true. if derivatives are desired ixSaturation, & ! intent(in): index of upper-most "saturated" layer mLayerVolFracLiq, & ! intent(in): volumetric fraction of liquid water in each soil layer (-) mLayerVolFracIce, & ! intent(in): volumetric fraction of ice in each soil layer (-) - mLayerMatricHeadLiq, & ! intent(in): liquid water matric potential (m) ! input/output: data structures attr_data, & ! intent(in): spatial attributes mpar_data, & ! intent(in): model parameters @@ -255,12 +238,10 @@ subroutine groundwatr(& ! compute baseflow flux call computeBaseflow(& ! input: control and state variables - dt, & ! intent(in): length of the model time step (s) .false., & ! intent(in): .true. if derivatives are desired ixSaturation, & ! intent(in): index of upper-most "saturated" layer mLayerVolFracLiqPerturbed, & ! intent(in): volumetric fraction of liquid water in each soil layer (-) mLayerVolFracIce, & ! intent(in): volumetric fraction of ice in each soil layer (-) - mLayerMatricHeadPerturbed, & ! intent(in): liquid water matric potential (m) ! input/output: data structures attr_data, & ! intent(in): spatial attributes mpar_data, & ! intent(in): model parameters @@ -297,12 +278,10 @@ end subroutine groundwatr ! *********************************************************************************************************************** subroutine computeBaseflow(& ! input: control and state variables - dt, & ! intent(in): length of the model time step (s) derivDesired, & ! intent(in): .true. if derivatives are desired ixSaturation, & ! intent(in): index of upper-most "saturated" layer mLayerVolFracLiq, & ! intent(in): volumetric fraction of liquid water in each soil layer (-) mLayerVolFracIce, & ! intent(in): volumetric fraction of ice in each soil layer (-) - mLayerMatricHeadLiq, & ! intent(in): liquid water matric potential (m) ! input/output: data structures attr_data, & ! intent(in): spatial attributes mpar_data, & ! intent(in): model parameters @@ -315,12 +294,10 @@ subroutine computeBaseflow(& ! * dummy variables ! --------------------------------------------------------------------------------------- ! input: control and state variables - real(dp),intent(in) :: dt ! length of the model time step (s) logical(lgt),intent(in) :: derivDesired ! .true. if derivatives are desired integer(i4b),intent(in) :: ixSaturation ! index of upper-most "saturated" layer real(dp),intent(in) :: mLayerVolFracLiq(:) ! volumetric fraction of liquid water (-) real(dp),intent(in) :: mLayerVolFracIce(:) ! volumetric fraction of ice (-) - real(dp),intent(in) :: mLayerMatricHeadLiq(:) ! liquid water matric potential (m) ! input/output: data structures type(var_d),intent(in) :: attr_data ! spatial attributes type(var_d),intent(in) :: mpar_data ! model parameters @@ -329,27 +306,6 @@ subroutine computeBaseflow(& real(dp),intent(out) :: mLayerBaseflow(:) ! baseflow from each soil layer (m s-1) real(dp),intent(out) :: dBaseflow_dVolLiq(:,:) ! derivative in baseflow w.r.t. matric head (s-1) ! --------------------------------------------------------------------------------------- - ! * variables in the data structures - ! --------------------------------------------------------------------------------------- - ! input: coordinate variables - real(dp) :: soilDepth ! intent(in): total soil depth (m) - real(dp),dimension(nSoil) :: mLayerDepth ! intent(in): depth of each soil layer (m) - ! input: diagnostic variables - real(dp) :: surfaceHydCond ! intent(in): saturated hydraulic conductivity at the surface (m s-1) - real(dp),dimension(nSoil) :: mLayerColumnInflow ! intent(in): inflow into each soil layer (m3/s) - ! input: local attributes - real(dp) :: HRUarea ! intent(in): HRU area (m2) - real(dp) :: tan_slope ! intent(in): tan water table slope, taken as tan local ground surface slope (-) - real(dp) :: contourLength ! intent(in): length of contour at downslope edge of HRU (m) - ! input: baseflow parameters - real(dp) :: zScale_TOPMODEL ! intent(in): TOPMODEL exponent (-) - real(dp) :: kAnisotropic ! intent(in): anisotropy factor for lateral hydraulic conductivity (-) - real(dp) :: fieldCapacity ! intent(in): field capacity (-) - real(dp) :: theta_sat ! intent(in): soil porosity (-) - ! output: diagnostic variables - real(dp) :: scalarExfiltration ! intent(out): exfiltration from the soil profile (m s-1) - real(dp),dimension(nSoil) :: mLayerColumnOutflow ! intent(out): column outflow from each soil layer (m3 s-1) - ! --------------------------------------------------------------------------------------- ! * local variables ! --------------------------------------------------------------------------------------- ! general local variables @@ -379,7 +335,6 @@ subroutine computeBaseflow(& ! local variables for testing (debugging) logical(lgt),parameter :: printFlag=.false. ! flag for printing (debugging) logical(lgt),parameter :: testDerivatives=.false. ! flag to test derivatives (debugging) - real(dp),dimension(nSoil) :: mLayerVolFracLiqCopy ! copy of volumetric liquid water content vector (-) real(dp) :: xDepth,xTran,xFlow ! temporary variables (depth, transmissivity, flow) real(qp) :: dPart0,dPart1,dPart2,dPart3 ! derivatives for part of a function real(qp) :: f0,f1 ! different function evaluations diff --git a/build/source/engine/systemSolv.f90 b/build/source/engine/systemSolv.f90 index 299b59664..297238809 100644 --- a/build/source/engine/systemSolv.f90 +++ b/build/source/engine/systemSolv.f90 @@ -2095,7 +2095,6 @@ subroutine computFlux(& else ! local_ixGroundwater==qbaseTopmodel call groundwatr(& ! input: model control - dt, & ! intent(in): length of the model time step (s) firstFluxCall, & ! intent(in): logical flag to compute index of the lowest saturated layer ! input: state and diagnostic variables mLayerdTheta_dPsi, & ! intent(in): derivative in the soil water characteristic w.r.t. matric head in each layer (m-1) From f37b40978010b36194cdfce868a236cbbeb4f69d Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 17:07:35 -0700 Subject: [PATCH 18/26] Removed unused variables from vegSWavRad.f90 This includes unused dummy argument ix_snowInterception in vegSWavRad_muster() --- build/source/engine/vegSWavRad.f90 | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/build/source/engine/vegSWavRad.f90 b/build/source/engine/vegSWavRad.f90 index 4287889f4..40503ca79 100644 --- a/build/source/engine/vegSWavRad.f90 +++ b/build/source/engine/vegSWavRad.f90 @@ -70,7 +70,7 @@ subroutine vegSWavRad(& USE data_struc,only:model_decisions ! model decision structure USE var_lookup,only:iLookDECISIONS ! named variables for elements of the decision structure ! model variables, parameters, etc. - USE data_struc,only:time_data,type_data,attr_data,forc_data,mpar_data,mvar_data,bvar_data,indx_data ! data structures + USE data_struc,only:type_data,mvar_data,indx_data ! data structures USE var_lookup,only:iLookTIME,iLookTYPE,iLookATTR,iLookFORCE,iLookPARAM,iLookMVAR,iLookBVAR,iLookINDEX ! named variables for structure elements implicit none ! dummy variables @@ -80,8 +80,6 @@ subroutine vegSWavRad(& character(*),intent(out) :: message ! error message ! local variables character(LEN=256) :: cmessage ! error message of downwind routine - real(dp) :: snowmassPlusNewsnow ! sum of snow mass and new snowfall (kg m-2 [mm]) - real(dp) :: scalarGroundSnowFraction ! snow cover fraction on the ground surface (-) ! initialize error control err=0; message='vegSWavRad/' @@ -99,7 +97,6 @@ subroutine vegSWavRad(& type_data%var(iLookTYPE%vegTypeIndex), & ! intent(in): vegetation type index type_data%var(iLookTYPE%soilTypeIndex), & ! intent(in): soil type index model_decisions(iLookDECISIONS%canopySrad)%iDecision, & ! intent(in): index defining method for canopy shortwave radiation - model_decisions(iLookDECISIONS%snowIncept)%iDecision, & ! intent(in): index defining method to determine maximum snow interception capacity ! input: forcing at the upper boundary mvar_data%var(iLookMVAR%scalarSnowfall)%dat(1), & ! intent(in): computed snowfall rate (kg m-2 s-1) mvar_data%var(iLookMVAR%scalarCosZenith)%dat(1), & ! intent(in): cosine of the solar zenith angle (0-1) @@ -152,7 +149,6 @@ subroutine vegSWavRad_muster(& vegTypeIndex, & ! intent(in): vegetation type index soilTypeIndex, & ! intent(in): soil type index ix_canopySrad, & ! intent(in): index defining method for canopy shortwave radiation - ix_snowInterception, & ! intent(in): index defining method to determine maximum snow interception capacity ! input: forcing at the upper boundary scalarSnowfall, & ! intent(in): computed snowfall rate (kg m-2 s-1) scalarCosZenith, & ! intent(in): cosine of the solar zenith angle (0-1) @@ -198,7 +194,6 @@ subroutine vegSWavRad_muster(& integer(i4b),intent(in) :: vegTypeIndex ! vegetation type index integer(i4b),intent(in) :: soilTypeIndex ! soil type index integer(i4b),intent(in) :: ix_canopySrad ! index defining method for canopy shortwave radiation - integer(i4b),intent(in) :: ix_snowInterception ! index defining method to determine maximum snow interception capacity ! input: forcing at the upper boundary real(dp),intent(in) :: scalarSnowfall ! computed snowfall rate (kg m-2 s-1) real(dp),intent(in) :: scalarCosZenith ! cosine of the solar zenith angle (0-1) @@ -241,7 +236,6 @@ subroutine vegSWavRad_muster(& character(LEN=256) :: cmessage ! error message of downwind routine real(dp) :: snowmassPlusNewsnow ! sum of snow mass and new snowfall (kg m-2 [mm]) real(dp) :: scalarGroundSnowFraction ! snow cover fraction on the ground surface (-) - real(dp) :: relativeCanopyWater ! fraction of storage capacity (-) real(dp),parameter :: scalarVegFraction=1._dp ! vegetation fraction (=1 forces no canopy gaps and open areas in radiation routine) real(dp) :: scalarTotalReflectedSolar ! total reflected solar radiation (W m-2) real(dp) :: scalarTotalAbsorbedSolar ! total absorbed solar radiation (W m-2) @@ -455,7 +449,6 @@ subroutine canopy_SW(& real(dp),dimension(1:nBands) :: spectralIncomingSolar ! total incoming solar radiation in each spectral band (W m-2) real(dp),dimension(1:nBands) :: spectralGroundAbsorbedDirect ! total direct radiation absorbed at the ground surface (W m-2) real(dp),dimension(1:nBands) :: spectralGroundAbsorbedDiffuse ! total diffuse radiation absorbed at the ground surface (W m-2) - real(dp) :: fractionSolarReflected ! fraction of solar radiation reflected (-) real(dp) :: Fdirect ! fraction of direct radiation (-) real(dp) :: tauInitial ! transmission in the absence of scattering and multiple reflections (-) real(dp) :: tauTotal ! transmission due to scattering and multiple reflections (-) From d2a41d7ab19e29d8742eda3cb371bce056131a0d Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Fri, 1 May 2015 17:27:47 -0700 Subject: [PATCH 19/26] Removed unused variables from vegNrgFlux.f90 This includes unused dummy arguments in some function calls. Hence the update in systemSolv.f90. --- build/source/engine/systemSolv.f90 | 1 - build/source/engine/vegNrgFlux.f90 | 194 +---------------------------- 2 files changed, 2 insertions(+), 193 deletions(-) diff --git a/build/source/engine/systemSolv.f90 b/build/source/engine/systemSolv.f90 index 297238809..3ee97dd30 100644 --- a/build/source/engine/systemSolv.f90 +++ b/build/source/engine/systemSolv.f90 @@ -1845,7 +1845,6 @@ subroutine computFlux(& call vegNrgFlux(& ! input: model control - iter, & ! intent(in): iteration index firstSubStep, & ! intent(in): flag to indicate if we are processing the first sub-step firstFluxCall, & ! intent(in): flag to indicate if we are processing the first flux call computeVegFlux, & ! intent(in): flag to indicate if we need to compute fluxes over vegetation diff --git a/build/source/engine/vegNrgFlux.f90 b/build/source/engine/vegNrgFlux.f90 index 42d4977c7..a2b13f320 100644 --- a/build/source/engine/vegNrgFlux.f90 +++ b/build/source/engine/vegNrgFlux.f90 @@ -110,7 +110,6 @@ module vegNrgFlux_module ! ******************************************************************************************************* subroutine vegNrgFlux(& ! input: model control - iter, & ! intent(in): iteration index firstSubStep, & ! intent(in): flag to indicate if we are processing the first sub-step firstFluxCall, & ! intent(in): flag to indicate if we are processing the first flux call computeVegFlux, & ! intent(in): flag to indicate if we need to compute fluxes over vegetation @@ -188,7 +187,6 @@ subroutine vegNrgFlux(& ! * dummy variables ! --------------------------------------------------------------------------------------- ! input: model control - integer(i4b),intent(in) :: iter ! iteration index logical(lgt),intent(in) :: firstSubStep ! flag to indicate if we are processing the first sub-step logical(lgt),intent(in) :: firstFluxCall ! flag to indicate if we are processing the first flux call logical(lgt),intent(in) :: computeVegFlux ! flag to indicate if computing fluxes over vegetation @@ -239,160 +237,10 @@ subroutine vegNrgFlux(& integer(i4b),intent(out) :: err ! error code character(*),intent(out) :: message ! error message ! --------------------------------------------------------------------------------------- - ! * variables in the data structures - ! --------------------------------------------------------------------------------------- - ! input: model decisions - integer(i4b) :: ix_bcUpprTdyn ! intent(in): choice of upper boundary condition for thermodynamics - integer(i4b) :: ix_fDerivMeth ! intent(in): choice of method to compute derivatives - integer(i4b) :: ix_veg_traits ! intent(in): choice of parameterization for vegetation roughness length and displacement height - integer(i4b) :: ix_canopyEmis ! intent(in): choice of parameterization for canopy emissivity - integer(i4b) :: ix_windPrfile ! intent(in): choice of canopy wind profile - integer(i4b) :: ix_astability ! intent(in): choice of stability function - integer(i4b) :: ix_soilStress ! intent(in): choice of function for the soil moisture control on stomatal resistance - integer(i4b) :: ix_groundwatr ! intent(in): choice of groundwater parameterization - integer(i4b) :: ix_stomResist ! intent(in): choice of function for stomatal resistance - integer(i4b) :: ix_spatial_gw ! intent(in): [i4b] choice of groundwater representation (local, basin) - ! input: physical attributes - integer(i4b) :: vegTypeIndex ! intent(in): vegetation type index - integer(i4b) :: soilTypeIndex ! intent(in): soil type index - ! input: vegetation parameters - real(dp) :: heightCanopyTop ! intent(in): height at the top of the vegetation canopy (m) - real(dp) :: heightCanopyBottom ! intent(in): height at the bottom of the vegetation canopy (m) - real(dp) :: scalarCanopyIceMax ! intent(in): maximum interception storage capacity for ice (kg m-2) - real(dp) :: scalarCanopyLiqMax ! intent(in): maximum interception storage capacity for liquid water (kg m-2) - ! input: vegetation phenology - real(dp) :: scalarLAI ! intent(in): one-sided leaf area index (m2 m-2) - real(dp) :: scalarSAI ! intent(in): one-sided stem area index (m2 m-2) - real(dp) :: scalarExposedLAI ! intent(in): exposed leaf area index after burial by snow (m2 m-2) - real(dp) :: scalarExposedSAI ! intent(in): exposed stem area index after burial by snow (m2 m-2) - real(dp) :: scalarGrowingSeasonIndex ! intent(in): growing season index (0=off, 1=on) - real(dp) :: scalarFoliageNitrogenFactor ! intent(in): foliage nitrogen concentration (1.0 = saturated) - ! input: aerodynamic resistance parameters - real(dp) :: z0Snow ! intent(in): roughness length of snow (m) - real(dp) :: z0Soil ! intent(in): roughness length of soil (m) - real(dp) :: z0CanopyParam ! intent(in): roughness length of the canopy (m) - real(dp) :: zpdFraction ! intent(in): zero plane displacement / canopy height (-) - real(dp) :: critRichNumber ! intent(in): critical value for the bulk Richardson number where turbulence ceases (-) - real(dp) :: Louis79_bparam ! intent(in): parameter in Louis (1979) stability function - real(dp) :: Louis79_cStar ! intent(in): parameter in Louis (1979) stability function - real(dp) :: Mahrt87_eScale ! intent(in): exponential scaling factor in the Mahrt (1987) stability function - real(dp) :: windReductionParam ! intent(in): canopy wind reduction parameter (-) - real(dp) :: leafExchangeCoeff ! intent(in): turbulent exchange coeff between canopy surface and canopy air ( m s-(1/2) ) - real(dp) :: leafDimension ! intent(in): characteristic leaf dimension (m) - ! input: soil stress parameters - real(dp) :: theta_sat ! intent(in): soil porosity (-) - real(dp) :: theta_res ! intent(in): residual volumetric liquid water content (-) - real(dp) :: plantWiltPsi ! intent(in): matric head at wilting point (m) - real(dp) :: soilStressParam ! intent(in): parameter in the exponential soil stress function (-) - real(dp) :: critSoilWilting ! intent(in): critical vol. liq. water content when plants are wilting (-) - real(dp) :: critSoilTranspire ! intent(in): critical vol. liq. water content when transpiration is limited (-) - real(dp) :: critAquiferTranspire ! intent(in): critical aquifer storage value when transpiration is limited (m) - real(dp) :: minStomatalResistance ! intent(in): mimimum stomatal resistance (s m-1) - ! input: forcing at the upper boundary - real(dp) :: mHeight ! intent(in): measurement height (m) - real(dp) :: airtemp ! intent(in): air temperature at some height above the surface (K) - real(dp) :: windspd ! intent(in): wind speed at some height above the surface (m s-1) - real(dp) :: airpres ! intent(in): air pressure at some height above the surface (Pa) - real(dp) :: LWRadAtm ! intent(in): downwelling longwave radiation at the upper boundary (W m-2) - real(dp) :: scalarVPair ! intent(in): vapor pressure at some height above the surface (Pa) - real(dp) :: scalarO2air ! intent(in): atmospheric o2 concentration (Pa) - real(dp) :: scalarCO2air ! intent(in): atmospheric co2 concentration (Pa) - real(dp) :: scalarTwetbulb ! intent(in): wetbulb temperature (K) - real(dp) :: scalarRainfall ! intent(in): computed rainfall rate (kg m-2 s-1) - real(dp) :: scalarSnowfall ! intent(in): computed snowfall rate (kg m-2 s-1) - real(dp) :: scalarThroughfallRain ! intent(in): rainfall through the vegetation canopy (kg m-2 s-1) - real(dp) :: scalarThroughfallSnow ! intent(in): snowfall through the vegetation canopy (kg m-2 s-1) - ! input: water storage - ! NOTE: soil stress only computed at the start of the substep (firstFluxCall=.true.) - real(dp) :: scalarSWE ! intent(in): snow water equivalent on the ground (kg m-2) - real(dp) :: scalarSnowDepth ! intent(in): snow depth on the ground surface (m) - real(dp),dimension(nSoil) :: mLayerVolFracLiq ! intent(in): volumetric fraction of liquid water in each soil layer (-) - real(dp),dimension(nSoil) :: mLayerMatricHead ! intent(in): matric head in each layer (m) - real(dp) :: localAquiferStorage ! intent(in): aquifer storage for the local column (m) - real(dp) :: basinAquiferStorage ! intent(in): aquifer storage for the single basin (m) - ! input: shortwave radiation fluxes - real(dp) :: scalarCanopySunlitLAI ! intent(in): sunlit leaf area (-) - real(dp) :: scalarCanopyShadedLAI ! intent(in): shaded leaf area (-) - real(dp) :: scalarCanopySunlitPAR ! intent(in): average absorbed par for sunlit leaves (w m-2) - real(dp) :: scalarCanopyShadedPAR ! intent(in): average absorbed par for shaded leaves (w m-2) - real(dp) :: scalarCanopyAbsorbedSolar ! intent(in): solar radiation absorbed by canopy (W m-2) - real(dp) :: scalarGroundAbsorbedSolar ! intent(in): solar radiation absorbed by ground (W m-2) - ! output: fraction of wetted canopy area and fraction of snow on the ground - real(dp) :: scalarCanopyWetFraction ! intent(out): fraction of canopy that is wet - real(dp) :: scalarGroundSnowFraction ! intent(out): fraction of ground covered with snow (-) - ! output: longwave radiation fluxes - real(dp) :: scalarCanopyEmissivity ! intent(out): effective emissivity of the canopy (-) - real(dp) :: scalarLWRadCanopy ! intent(out): longwave radiation emitted from the canopy (W m-2) - real(dp) :: scalarLWRadGround ! intent(out): longwave radiation emitted at the ground surface (W m-2) - real(dp) :: scalarLWRadUbound2Canopy ! intent(out): downward atmospheric longwave radiation absorbed by the canopy (W m-2) - real(dp) :: scalarLWRadUbound2Ground ! intent(out): downward atmospheric longwave radiation absorbed by the ground (W m-2) - real(dp) :: scalarLWRadUbound2Ubound ! intent(out): atmospheric radiation reflected by the ground and lost thru upper boundary (W m-2) - real(dp) :: scalarLWRadCanopy2Ubound ! intent(out): longwave radiation emitted from canopy lost thru upper boundary (W m-2) - real(dp) :: scalarLWRadCanopy2Ground ! intent(out): longwave radiation emitted from canopy absorbed by the ground (W m-2) - real(dp) :: scalarLWRadCanopy2Canopy ! intent(out): canopy longwave reflected from ground and absorbed by the canopy (W m-2) - real(dp) :: scalarLWRadGround2Ubound ! intent(out): longwave radiation emitted from ground lost thru upper boundary (W m-2) - real(dp) :: scalarLWRadGround2Canopy ! intent(out): longwave radiation emitted from ground and absorbed by the canopy (W m-2) - real(dp) :: scalarLWNetCanopy ! intent(out): net longwave radiation at the canopy (W m-2) - real(dp) :: scalarLWNetGround ! intent(out): net longwave radiation at the ground surface (W m-2) - real(dp) :: scalarLWNetUbound ! intent(out): net longwave radiation at the upper boundary (W m-2) - ! output: aerodynamic resistance - real(dp) :: scalarZ0Canopy ! intent(out): roughness length of the canopy (m) - real(dp) :: scalarWindReductionFactor ! intent(out): canopy wind reduction factor (-) - real(dp) :: scalarZeroPlaneDisplacement ! intent(out): zero plane displacement (m) - real(dp) :: scalarRiBulkCanopy ! intent(out): bulk Richardson number for the canopy (-) - real(dp) :: scalarRiBulkGround ! intent(out): bulk Richardson number for the ground surface (-) - real(dp) :: scalarEddyDiffusCanopyTop ! intent(out): eddy diffusivity for heat at the top of the canopy (m2 s-1) - real(dp) :: scalarFrictionVelocity ! intent(out): friction velocity (m s-1) - real(dp) :: scalarWindspdCanopyTop ! intent(out): windspeed at the top of the canopy (m s-1) - real(dp) :: scalarWindspdCanopyBottom ! intent(out): windspeed at the height of the bottom of the canopy (m s-1) - real(dp) :: scalarLeafResistance ! intent(out): mean leaf boundary layer resistance per unit leaf area (s m-1) - real(dp) :: scalarGroundResistance ! intent(out): below canopy aerodynamic resistance (s m-1) - real(dp) :: scalarCanopyResistance ! intent(out): above canopy aerodynamic resistance (s m-1) - ! input/output: soil resistance -- intent(in) and intent(inout) because only called at the first flux call - real(dp),dimension(nSoil) :: mLayerRootDensity ! intent(in): root density in each layer (-) - real(dp) :: scalarAquiferRootFrac ! intent(in): fraction of roots below the lowest soil layer (-) - real(dp) :: scalarTranspireLim ! intent(inout): weighted average of the transpiration limiting factor (-) - real(dp),dimension(nSoil) :: mLayerTranspireLim ! intent(inout): transpiration limiting factor in each layer (-) - real(dp) :: scalarTranspireLimAqfr ! intent(inout): transpiration limiting factor for the aquifer (-) - real(dp) :: scalarSoilRelHumidity ! intent(inout): relative humidity in the soil pores [0-1] - real(dp) :: scalarSoilResistance ! intent(inout): resistance from the soil (s m-1) - ! input/output: stomatal resistance -- intent(inout) because only called at the first flux call - real(dp) :: scalarStomResistSunlit ! intent(inout): stomatal resistance for sunlit leaves (s m-1) - real(dp) :: scalarStomResistShaded ! intent(inout): stomatal resistance for shaded leaves (s m-1) - real(dp) :: scalarPhotosynthesisSunlit ! intent(inout): sunlit photosynthesis (umolco2 m-2 s-1) - real(dp) :: scalarPhotosynthesisShaded ! intent(inout): shaded photosynthesis (umolco2 m-2 s-1) - ! output: turbulent heat fluxes - real(dp) :: scalarLatHeatSubVapCanopy ! intent(inout): latent heat of sublimation/vaporization for the vegetation canopy (J kg-1) - real(dp) :: scalarLatHeatSubVapGround ! intent(inout): latent heat of sublimation/vaporization for the ground surface (J kg-1) - real(dp) :: scalarSatVP_canopyTemp ! intent(out): saturation vapor pressure at the temperature of the vegetation canopy (Pa) - real(dp) :: scalarSatVP_groundTemp ! intent(out): saturation vapor pressure at the temperature of the ground surface (Pa) - real(dp) :: scalarSenHeatTotal ! intent(out): sensible heat flux from the canopy air space to the atmosphere (W m-2) - real(dp) :: scalarSenHeatCanopy ! intent(out): sensible heat flux from the canopy to the canopy air space (W m-2) - real(dp) :: scalarSenHeatGround ! intent(out): sensible heat flux from ground surface below vegetation, bare ground, or snow covered vegetation (W m-2) - real(dp) :: scalarLatHeatTotal ! intent(out): latent heat flux from the canopy air space to the atmosphere (W m-2) - real(dp) :: scalarLatHeatCanopyEvap ! intent(out): latent heat flux associated with evaporation from the canopy to the canopy air space (W m-2) - real(dp) :: scalarLatHeatCanopyTrans ! intent(out): latent heat flux associated with transpiration from the canopy to the canopy air space (W m-2) - real(dp) :: scalarLatHeatGround ! intent(out): latent heat flux from ground surface below vegetation, bare ground, or snow covered vegetation (W m-2) - ! output: advective heat flux - real(dp) :: scalarCanopyAdvectiveHeatFlux ! intent(out): heat advected to the canopy surface with rain + snow (W m-2) - real(dp) :: scalarGroundAdvectiveHeatFlux ! intent(out): heat advected to the ground surface with throughfall (W m-2) - ! output: mass fluxes - real(dp) :: scalarCanopySublimation ! intent(out): canopy sublimation/frost (kg m-2 s-1) - real(dp) :: scalarSnowSublimation ! intent(out): snow sublimation/frost -- below canopy or non-vegetated (kg m-2 s-1) - ! input/output: canopy air space variables - real(dp) :: scalarVP_CanopyAir ! intent(inout): vapor pressure of the canopy air space (Pa) - real(dp) :: scalarCanopyStabilityCorrection ! intent(inout): stability correction for the canopy (-) - real(dp) :: scalarGroundStabilityCorrection ! intent(inout): stability correction for the ground surface (-) - ! output: mass fluxes associated with evaporation/transpiration - real(dp) :: scalarCanopyTranspiration ! intent(out): canopy transpiration (kg m-2 s-1) - real(dp) :: scalarCanopyEvaporation ! intent(out): canopy evaporation/condensation (kg m-2 s-1) - real(dp) :: scalarGroundEvaporation ! intent(out): ground evaporation/condensation -- below canopy or non-vegetated (kg m-2 s-1) - ! --------------------------------------------------------------------------------------- ! * local variables ! --------------------------------------------------------------------------------------- ! local (general) character(LEN=256) :: cmessage ! error message of downwind routine - real(dp) :: snowmassPlusNewsnow ! sum of snow mass and new snowfall (kg m-2 [mm]) real(dp) :: VAI ! vegetation area index (m2 m-2) real(dp) :: exposedVAI ! exposed vegetation area index (m2 m-2) real(dp) :: totalCanopyWater ! total water on the vegetation canopy (kg m-2) @@ -409,7 +257,7 @@ subroutine vegNrgFlux(& real(dp) :: groundTemp ! value of ground temperature used in flux calculations (may be perturbed) real(dp) :: canopyTemp ! value of canopy temperature used in flux calculations (may be perturbed) real(dp) :: canairTemp ! value of canopy air temperature used in flux calculations (may be perturbed) - real(dp) :: try0,try1,try2 ! trial values to evaluate specific derivatives (testing only) + real(dp) :: try0,try1 ! trial values to evaluate specific derivatives (testing only) ! local (saturation vapor pressure of veg) real(dp) :: TV_celcius ! vegetaion temperature (C) real(dp) :: TG_celcius ! ground temperature (C) @@ -433,7 +281,6 @@ subroutine vegNrgFlux(& real(dp) :: dLWNetCanopy_dTGround ! derivative in net canopy radiation w.r.t. ground temperature (W m-2 K-1) real(dp) :: dLWNetGround_dTCanopy ! derivative in net ground radiation w.r.t. canopy temperature (W m-2 K-1) ! local (aerodynamic resistance) - real(dp) :: saveTemp_CanopyAir ! temperature of the canopy air space (K) real(dp) :: scalarCanopyStabilityCorrection_old ! stability correction for the canopy (-) real(dp) :: scalarGroundStabilityCorrection_old ! stability correction for the ground surface (-) ! local (turbulent heat transfer) @@ -884,7 +731,6 @@ subroutine vegNrgFlux(& ! Mahat et al. (Below-canopy turbulence in a snowmelt model, WRR, 2012) call aeroResist(& ! input: model control - iter, & ! intent(in): iteration index computeVegFlux, & ! intent(in): logical flag to compute vegetation fluxes (.false. if veg buried by snow) (ix_fDerivMeth == analytical), & ! intent(in): logical flag if would like to compute analytical derivaties ix_veg_traits, & ! intent(in): choice of parameterization for vegetation roughness length and displacement height @@ -896,7 +742,6 @@ subroutine vegNrgFlux(& windspd, & ! intent(in): wind speed at some height above the surface (m s-1) ! input: canopy and ground temperature canairTempTrial, & ! intent(in): temperature of the canopy air space (K) - canopyTempTrial, & ! intent(in): temperature of the vegetation canopy (K) groundTempTrial, & ! intent(in): temperature of the ground surface (K) ! input: diagnostic variables exposedVAI, & ! intent(in): exposed vegetation area index -- leaf plus stem (m2 m-2) @@ -907,16 +752,12 @@ subroutine vegNrgFlux(& zpdFraction, & ! intent(in): zero plane displacement / canopy height (-) critRichNumber, & ! intent(in): critical value for the bulk Richardson number where turbulence ceases (-) Louis79_bparam, & ! intent(in): parameter in Louis (1979) stability function - Louis79_cStar, & ! intent(in): parameter in Louis (1979) stability function Mahrt87_eScale, & ! intent(in): exponential scaling factor in the Mahrt (1987) stability function windReductionParam, & ! intent(in): canopy wind reduction parameter (-) leafExchangeCoeff, & ! intent(in): turbulent exchange coeff between canopy surface and canopy air ( m s-(1/2) ) leafDimension, & ! intent(in): characteristic leaf dimension (m) heightCanopyTop, & ! intent(in): height at the top of the vegetation canopy (m) heightCanopyBottom, & ! intent(in): height at the bottom of the vegetation canopy (m) - ! input: stability correction from the last iteration - scalarCanopyStabilityCorrection_old,& ! intent(in): stability correction for the canopy (-) - scalarGroundStabilityCorrection_old,& ! intent(in): stability correction for the ground surface (-) ! output: stability corrections scalarRiBulkCanopy, & ! intent(out): bulk Richardson number for the canopy (-) scalarRiBulkGround, & ! intent(out): bulk Richardson number for the ground surface (-) @@ -1201,7 +1042,6 @@ subroutine vegNrgFlux(& if(itry /= unperturbed)then call aeroResist(& ! input: model control - iter, & ! intent(in): iteration index computeVegFlux, & ! intent(in): logical flag to compute vegetation fluxes (.false. if veg buried by snow) .false., & ! intent(in): logical flag if would like to compute analytical derivaties ix_veg_traits, & ! intent(in): choice of parameterization for vegetation roughness length and displacement height @@ -1213,7 +1053,6 @@ subroutine vegNrgFlux(& windspd, & ! intent(in): wind speed at some height above the surface (m s-1) ! input: temperature (canopy, ground, canopy air space) canairTemp, & ! intent(in): temperature of the canopy air space (K) - canopyTemp, & ! intent(in): canopy temperature (K) groundTemp, & ! intent(in): ground temperature (K) ! input: diagnostic variables exposedVAI, & ! intent(in): exposed vegetation area index -- leaf plus stem (m2 m-2) @@ -1224,16 +1063,12 @@ subroutine vegNrgFlux(& zpdFraction, & ! intent(in): zero plane displacement / canopy height (-) critRichNumber, & ! intent(in): critical value for the bulk Richardson number where turbulence ceases (-) Louis79_bparam, & ! intent(in): parameter in Louis (1979) stability function - Louis79_cStar, & ! intent(in): parameter in Louis (1979) stability function Mahrt87_eScale, & ! intent(in): exponential scaling factor in the Mahrt (1987) stability function windReductionParam, & ! intent(in): canopy wind reduction parameter (-) leafExchangeCoeff, & ! intent(in): turbulent exchange coeff between canopy surface and canopy air ( m s-(1/2) ) leafDimension, & ! intent(in): characteristic leaf dimension (m) heightCanopyTop, & ! intent(in): height at the top of the vegetation canopy (m) heightCanopyBottom, & ! intent(in): height at the bottom of the vegetation canopy (m) - ! input: stability correction from the last iteration - scalarCanopyStabilityCorrection_old, & ! intent(in): stability correction for the canopy (-) - scalarGroundStabilityCorrection_old, & ! intent(in): stability correction for the ground surface (-) ! output: stability corrections notUsed_RiBulkCanopy, & ! intent(out): bulk Richardson number for the canopy (-) notUsed_RiBulkGround, & ! intent(out): bulk Richardson number for the ground surface (-) @@ -2052,7 +1887,6 @@ end subroutine longwaveBal ! ******************************************************************************************************* subroutine aeroResist(& ! input: model control - iter, & ! intent(in): iteration index computeVegFlux, & ! intent(in): logical flag to compute vegetation fluxes (.false. if veg buried by snow) derivDesired, & ! intent(in): flag to indicate if analytical derivatives are desired ixVegTraits, & ! intent(in): choice of parameterization for vegetation roughness length and displacement height @@ -2064,7 +1898,6 @@ subroutine aeroResist(& windspd, & ! intent(in): wind speed at some height above the surface (m s-1) ! input: temperature (canopy, ground, canopy air space) canairTemp, & ! intent(in): temperature of the canopy air space (K) - canopyTemp, & ! intent(in): canopy temperature (K) groundTemp, & ! intent(in): ground temperature (K) ! input: diagnostic variables exposedVAI, & ! intent(in): exposed vegetation area index -- leaf plus stem (m2 m-2) @@ -2075,16 +1908,12 @@ subroutine aeroResist(& zpdFraction, & ! intent(in): zero plane displacement / canopy height (-) critRichNumber, & ! intent(in): critical value for the bulk Richardson number where turbulence ceases (-) Louis79_bparam, & ! intent(in): parameter in Louis (1979) stability function - Louis79_cStar, & ! intent(in): parameter in Louis (1979) stability function Mahrt87_eScale, & ! intent(in): exponential scaling factor in the Mahrt (1987) stability function windReductionParam, & ! intent(in): canopy wind reduction parameter (-) leafExchangeCoeff, & ! intent(in): turbulent exchange coeff between canopy surface and canopy air ( m s-(1/2) ) leafDimension, & ! intent(in): characteristic leaf dimension (m) heightCanopyTop, & ! intent(in): height at the top of the vegetation canopy (m) heightCanopyBottom, & ! intent(in): height at the bottom of the vegetation canopy (m) - ! input: stability correction from the last iteration - canopyStabilityCorrection_old, & ! intent(in): stability correction for the canopy (-) - groundStabilityCorrection_old, & ! intent(in): stability correction for the ground surface (-) ! output: stability corrections RiBulkCanopy, & ! intent(out): bulk Richardson number for the canopy (-) RiBulkGround, & ! intent(out): bulk Richardson number for the ground surface (-) @@ -2116,7 +1945,6 @@ subroutine aeroResist(& ! Mahat et al. (Below-canopy turbulence in a snowmelt model, WRR, 2012) implicit none ! input: model control - integer(i4b),intent(in) :: iter ! iteration index logical(lgt),intent(in) :: computeVegFlux ! logical flag to compute vegetation fluxes (.false. if veg buried by snow) logical(lgt),intent(in) :: derivDesired ! logical flag to indicate if analytical derivatives are desired integer(i4b),intent(in) :: ixVegTraits ! choice of parameterization for vegetation roughness length and displacement height @@ -2128,7 +1956,6 @@ subroutine aeroResist(& real(dp),intent(in) :: windspd ! wind speed at some height above the surface (m s-1) ! input: temperature (canopy, ground, canopy air space) real(dp),intent(in) :: canairTemp ! temperature of the canopy air space (K) - real(dp),intent(in) :: canopyTemp ! canopy temperature (K) real(dp),intent(in) :: groundTemp ! ground temperature (K) ! input: diagnostic variables real(dp),intent(in) :: exposedVAI ! exposed vegetation area index -- leaf plus stem (m2 m-2) @@ -2139,16 +1966,12 @@ subroutine aeroResist(& real(dp),intent(in) :: zpdFraction ! zero plane displacement / canopy height (-) real(dp),intent(in) :: critRichNumber ! critical value for the bulk Richardson number where turbulence ceases (-) real(dp),intent(in) :: Louis79_bparam ! parameter in Louis (1979) stability function - real(dp),intent(in) :: Louis79_cStar ! parameter in Louis (1979) stability function real(dp),intent(in) :: Mahrt87_eScale ! exponential scaling factor in the Mahrt (1987) stability function real(dp),intent(in) :: windReductionParam ! canopy wind reduction parameter (-) real(dp),intent(in) :: leafExchangeCoeff ! turbulent exchange coeff between canopy surface and canopy air ( m s-(1/2) ) real(dp),intent(in) :: leafDimension ! characteristic leaf dimension (m) real(dp),intent(in) :: heightCanopyTop ! height at the top of the vegetation canopy (m) real(dp),intent(in) :: heightCanopyBottom ! height at the bottom of the vegetation canopy (m) - ! input: stability correction from the last iteration - real(dp),intent(in) :: canopyStabilityCorrection_old ! stability correction for the canopy (-) - real(dp),intent(in) :: groundStabilityCorrection_old ! stability correction for the ground surface (-) ! output: stability corrections real(dp),intent(out) :: RiBulkCanopy ! bulk Richardson number for the canopy (-) real(dp),intent(out) :: RiBulkGround ! bulk Richardson number for the ground surface (-) @@ -2203,10 +2026,6 @@ subroutine aeroResist(& real(dp) :: dED_dT ! derivative in eddy diffusivity at the top of the canopy w.r.t. canopy air temperature real(dp) :: dGR_dT ! derivative in neutral ground resistance w.r.t. canopy air temperature real(dp) :: tmp1,tmp2 ! temporary variables used in calculation of ground resistance - real(dp) :: dLeafResistance_dStateCanopy ! leaf resistance after perturbing canopy temperature (s m-1) - real(dp) :: dCanopyResistance_dStateCanopy ! canopy resistance after perturbing canopy temperature (s m-1) - real(dp) :: dGroundResistance_dStateCanopy ! ground resistance after perturbing canopy temperature (s m-1) - real(dp) :: dGroundResistance_dStateGround ! ground resistance after perturbing ground temperature (s m-1) real(dp) :: dCanopyStabilityCorrection_dRich ! derivative in stability correction w.r.t. Richardson number for the canopy (-) real(dp) :: dGroundStabilityCorrection_dRich ! derivative in stability correction w.r.t. Richardson number for the ground surface (-) real(dp) :: dCanopyStabilityCorrection_dAirTemp ! (not used) derivative in stability correction w.r.t. air temperature (K-1) @@ -2295,7 +2114,6 @@ subroutine aeroResist(& ! input: stability parameters critRichNumber, & ! input: critical value for the bulk Richardson number where turbulence ceases (-) Louis79_bparam, & ! input: parameter in Louis (1979) stability function - Louis79_cStar, & ! input: parameter in Louis (1979) stability function Mahrt87_eScale, & ! input: exponential scaling factor in the Mahrt (1987) stability function ! output RiBulkCanopy, & ! output: bulk Richardson number (-) @@ -2394,7 +2212,6 @@ subroutine aeroResist(& ! input: stability parameters critRichNumber, & ! input: critical value for the bulk Richardson number where turbulence ceases (-) Louis79_bparam, & ! input: parameter in Louis (1979) stability function - Louis79_cStar, & ! input: parameter in Louis (1979) stability function Mahrt87_eScale, & ! input: exponential scaling factor in the Mahrt (1987) stability function ! output RiBulkGround, & ! output: bulk Richardson number (-) @@ -2451,7 +2268,6 @@ subroutine aeroResist(& ! input: stability parameters critRichNumber, & ! input: critical value for the bulk Richardson number where turbulence ceases (-) Louis79_bparam, & ! input: parameter in Louis (1979) stability function - Louis79_cStar, & ! input: parameter in Louis (1979) stability function Mahrt87_eScale, & ! input: exponential scaling factor in the Mahrt (1987) stability function ! output RiBulkGround, & ! output: bulk Richardson number (-) @@ -2967,13 +2783,9 @@ subroutine turbFluxes(& character(*),intent(out) :: message ! error message ! ----------------------------------------------------------------------------------------------------------------------------------------- ! local variables -- general - real(dp) :: fpart0,fpart1,fpart2 ! different parts of a function + real(dp) :: fpart1,fpart2 ! different parts of a function real(dp) :: dPart0,dpart1,dpart2 ! derivatives for different parts of a function real(dp),parameter :: evapSmooth=1._dp ! smoothing parameter for latent heat (W m-2) - real(dp) :: damping ! damping factor used to maintain feasible solution (-) - real(dp) :: maxFlux ! maximum possible latent heat flux (W m-2) - real(dp) :: nrgDiff ! initial change in energy associated with latent heat (W m-2) - real(dp) :: corDiff ! corrected change in energy after imposing solution constraints (W m-2) ! local variables -- "constants" real(dp) :: volHeatCapacityAir ! volumetric heat capacity of air (J m-3) real(dp) :: latentHeatConstant ! latent heat constant (kg m-3 K-1) @@ -3353,7 +3165,6 @@ subroutine aStability(& ! input: stability parameters critRichNumber, & ! input: critical value for the bulk Richardson number where turbulence ceases (-) Louis79_bparam, & ! input: parameter in Louis (1979) stability function - Louis79_cStar, & ! input: parameter in Louis (1979) stability function Mahrt87_eScale, & ! input: exponential scaling factor in the Mahrt (1987) stability function ! output RiBulk, & ! output: bulk Richardson number (-) @@ -3374,7 +3185,6 @@ subroutine aStability(& ! input: stability parameters real(dp),intent(in) :: critRichNumber ! critical value for the bulk Richardson number where turbulence ceases (-) real(dp),intent(in) :: Louis79_bparam ! parameter in Louis (1979) stability function - real(dp),intent(in) :: Louis79_cStar ! parameter in Louis (1979) stability function real(dp),intent(in) :: Mahrt87_eScale ! exponential scaling factor in the Mahrt (1987) stability function ! output real(dp),intent(out) :: RiBulk ! bulk Richardson number (-) From c463aaa839136ba3c5246ca7057ec1e9dbb3b0fe Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Sun, 3 May 2015 16:34:59 -0700 Subject: [PATCH 20/26] Removed unused imports from ssdNrgFlux.f90 --- build/source/engine/ssdNrgFlux.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/source/engine/ssdNrgFlux.f90 b/build/source/engine/ssdNrgFlux.f90 index cc53fa900..2e62e3d41 100644 --- a/build/source/engine/ssdNrgFlux.f90 +++ b/build/source/engine/ssdNrgFlux.f90 @@ -89,7 +89,7 @@ subroutine ssdNrgFlux(& USE data_struc,only:model_decisions ! model decision structure USE var_lookup,only:iLookDECISIONS ! named variables for elements of the decision structure ! model variables, parameters, forcing data, etc. - USE data_struc,only:attr_data,type_data,mpar_data,forc_data,mvar_data,indx_data ! data structures + USE data_struc,only:mpar_data,mvar_data,indx_data ! data structures USE var_lookup,only:iLookATTR,iLookTYPE,iLookPARAM,iLookFORCE,iLookMVAR,iLookINDEX ! named variables for structure elements implicit none ! input: fluxes and derivatives at the upper boundary From f1121cdd2e6d615dd3f9041fe875f7afea32f0a2 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Wed, 13 May 2015 17:22:16 -0700 Subject: [PATCH 21/26] Removed unused module variable from vegLiqFlux.f90 --- build/source/engine/vegLiqFlux.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/source/engine/vegLiqFlux.f90 b/build/source/engine/vegLiqFlux.f90 index e7545a6ce..ed243e50e 100644 --- a/build/source/engine/vegLiqFlux.f90 +++ b/build/source/engine/vegLiqFlux.f90 @@ -40,7 +40,7 @@ subroutine vegLiqFlux(& scalarCanopyLiqDrainageDeriv, & ! intent(out): derivative in canopy drainage w.r.t. canopy liquid water (s-1) err,message) ! intent(out): error control ! model variables, parameters, forcing data, etc. - USE data_struc,only:attr_data,type_data,mpar_data,forc_data,mvar_data,indx_data ! data structures + USE data_struc,only:mpar_data,mvar_data ! data structures USE var_lookup,only:iLookATTR,iLookTYPE,iLookPARAM,iLookFORCE,iLookMVAR,iLookINDEX ! named variables for structure elements implicit none ! input From 63bd0a9911a44c3ec9ee9614c8c0e51dd0b96b4f Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Wed, 13 May 2015 17:30:20 -0700 Subject: [PATCH 22/26] Removed unused module variable from snowLiqFlx.f90 --- build/source/engine/snowLiqFlx.f90 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build/source/engine/snowLiqFlx.f90 b/build/source/engine/snowLiqFlx.f90 index 544919979..f9777498b 100644 --- a/build/source/engine/snowLiqFlx.f90 +++ b/build/source/engine/snowLiqFlx.f90 @@ -49,7 +49,7 @@ subroutine snowLiqFlx(& ! output: error control err,message) ! intent(out): error control ! model variables, parameters, forcing data, etc. - USE data_struc,only:attr_data,type_data,mpar_data,forc_data,mvar_data,indx_data ! data structures + USE data_struc,only:mpar_data,mvar_data ! data structures USE var_lookup,only:iLookATTR,iLookTYPE,iLookPARAM,iLookFORCE,iLookMVAR,iLookINDEX ! named variables for structure elements implicit none ! input: model control @@ -153,9 +153,8 @@ subroutine snowLiqFlx_muster(& real(dp),parameter :: residScal=10._dp ! scaling factor for residual liquid water content reduction factor (kg m-3) real(dp),parameter :: maxVolIceContent=0.7_dp ! maximum volumetric ice content to store water (-) real(dp) :: availCap ! available storage capacity [0,1] (-) - real(dp) :: relSaturn,relSaturn1 ! relative saturation [0,1] (-) + real(dp) :: relSaturn ! relative saturation [0,1] (-) real(dp),parameter :: dx = 1.e-8_dp ! finite difference increment - real(dp) :: testFlux ! test value of the flux (to compute numerical derivatives) ! --------------------------------------------------------------------------------------------------------------------------------------- ! initialize error control err=0; message='snowLiqFlx_muster/' From e308042069eea8342773d46b214c81920309f2c1 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Wed, 13 May 2015 17:38:15 -0700 Subject: [PATCH 23/26] Removed unused module variable from soilLiqFlx.f90 --- build/source/engine/soilLiqFlx.f90 | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/build/source/engine/soilLiqFlx.f90 b/build/source/engine/soilLiqFlx.f90 index ad72cc594..5465e699a 100644 --- a/build/source/engine/soilLiqFlx.f90 +++ b/build/source/engine/soilLiqFlx.f90 @@ -116,7 +116,7 @@ subroutine soilLiqFlx(& USE data_struc,only:model_decisions ! model decision structure USE var_lookup,only:iLookDECISIONS ! named variables for elements of the decision structure ! model variables, parameters, forcing data, etc. - USE data_struc,only:attr_data,type_data,mpar_data,forc_data,mvar_data,indx_data ! data structures + USE data_struc,only:mpar_data,mvar_data ! data structures USE var_lookup,only:iLookATTR,iLookTYPE,iLookPARAM,iLookFORCE,iLookMVAR,iLookINDEX ! named variables for structure elements implicit none ! input: model control @@ -481,7 +481,7 @@ subroutine soilLiqFlx_muster(& ! local variables: general character(LEN=256) :: cmessage ! error message of downwind routine logical(lgt) :: desireAnal ! flag to identify if analytical derivatives are desired - integer(i4b) :: iLayer,iSoil,jSoil ! index of soil layer + integer(i4b) :: iLayer,iSoil ! index of soil layer ! additional variables to compute numerical derivatives integer(i4b) :: nFlux ! number of flux calculations required (>1 = numerical derivatives with one-sided finite differences) integer(i4b) :: itry ! index of different flux calculations @@ -497,13 +497,8 @@ subroutine soilLiqFlx_muster(& real(dp) :: scalarHydCondMicro ! trial value of hydraulic conductivity of micropores (m s-1) real(dp) :: scalarHydCondMacro ! trial value of hydraulic conductivity of macropores (m s-1) real(dp) :: scalarFlux ! vertical flux (m s-1) - real(dp) :: scalarFlux_dState ! vertical flux with perturbation to the current state (m s-1) real(dp) :: scalarFlux_dStateAbove ! vertical flux with perturbation to the state above (m s-1) real(dp) :: scalarFlux_dStateBelow ! vertical flux with perturbation to the state below (m s-1) - real(dp) :: scalarFluxUpper ! flux at the top of the layer - real(dp) :: scalarFluxLower ! flux at the bottom of the layer - real(dp) :: scalarFluxUpper_dx ! flux at the top of the layer after perturbation - real(dp) :: scalarFluxLower_dx ! flux at the bottom of the layer after perturbation ! transpiration sink term real(dp),dimension(nSoil) :: mLayerTranspireFrac ! fraction of transpiration allocated to each soil layer (-) ! diagnostic variables @@ -1393,8 +1388,6 @@ subroutine surfaceFlx(& integer(i4b) :: iLayer ! index of soil layer ! (head boundary condition) real(dp) :: cFlux ! capillary flux (m s-1) - real(dp) :: vFracLiq ! volumetric fraction of liquid water - real(dp) :: surfaceInfiltration1 ! perturbed value of surface infiltration (used to compute the numerical derivative) real(dp) :: dNum ! numerical derivative ! (simplified Green-Ampt infiltration) real(dp) :: rootZoneLiq ! depth of liquid water in the root zone (m) From e2e56fe3b523c578c179cda6afd68015e2514a55 Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Wed, 13 May 2015 17:39:41 -0700 Subject: [PATCH 24/26] Removed unused module variable from modelwrite.f90 --- build/source/netcdf/modelwrite.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/build/source/netcdf/modelwrite.f90 b/build/source/netcdf/modelwrite.f90 index 52531cbe1..8859bdd01 100644 --- a/build/source/netcdf/modelwrite.f90 +++ b/build/source/netcdf/modelwrite.f90 @@ -239,7 +239,6 @@ subroutine writeModel(fileout,iHRU,istep,err,message) integer(i4b),pointer :: ifcTotoStartIndex ! start index of the ifcToto vector for a given timestep ! local variables integer(i4b) :: ncid ! NetCDF file ID - integer(i4b) :: iindex ! loop through model index variables integer(i4b) :: imodel ! loop through model variables integer(i4b) :: iVarId ! variable ID ! initialize error control From 207ed8343c1fd1ed12a8e5facf66c20f6c264bcf Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Wed, 13 May 2015 17:42:12 -0700 Subject: [PATCH 25/26] Revert "Removed unused module variable from modelwrite.f90" This reverts commit e2e56fe3b523c578c179cda6afd68015e2514a55. --- build/source/netcdf/modelwrite.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/build/source/netcdf/modelwrite.f90 b/build/source/netcdf/modelwrite.f90 index 8859bdd01..52531cbe1 100644 --- a/build/source/netcdf/modelwrite.f90 +++ b/build/source/netcdf/modelwrite.f90 @@ -239,6 +239,7 @@ subroutine writeModel(fileout,iHRU,istep,err,message) integer(i4b),pointer :: ifcTotoStartIndex ! start index of the ifcToto vector for a given timestep ! local variables integer(i4b) :: ncid ! NetCDF file ID + integer(i4b) :: iindex ! loop through model index variables integer(i4b) :: imodel ! loop through model variables integer(i4b) :: iVarId ! variable ID ! initialize error control From 7cf8c1afdfb28c62f4b84e5a6199857979a6b0fb Mon Sep 17 00:00:00 2001 From: Bart Nijssen Date: Wed, 13 May 2015 17:43:31 -0700 Subject: [PATCH 26/26] Removed unused module variable from modelwrite.f90 --- build/source/netcdf/modelwrite.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/build/source/netcdf/modelwrite.f90 b/build/source/netcdf/modelwrite.f90 index 52531cbe1..40b2d623d 100644 --- a/build/source/netcdf/modelwrite.f90 +++ b/build/source/netcdf/modelwrite.f90 @@ -325,7 +325,6 @@ subroutine writeBasin(fileout,istep,err,message) character(*),intent(out) :: message ! error message ! local variables integer(i4b) :: ncid ! NetCDF file ID - integer(i4b) :: iindex ! loop through model index variables integer(i4b) :: imodel ! loop through model variables integer(i4b) :: iVarId ! variable ID ! initialize error control