diff --git a/build/source/dshare/data_types.f90 b/build/source/dshare/data_types.f90 index 4329a15a1ac27f9e0c9366ca5267116efc95912a..0ba21dacf126b7e35843db702bc52fc39e9d7f05 100755 --- a/build/source/dshare/data_types.f90 +++ b/build/source/dshare/data_types.f90 @@ -460,6 +460,121 @@ MODULE data_types type(hru_z_vLookup),allocatable :: gru(:) ! gru(:)%hru(:)%z(:)%var(:)%lookup(:) endtype gru_hru_z_vLookup - +! define derived types used to simplify passing subroutine arguments + ! ** vegNrgFlux + type, public :: in_type_vegNrgFlux ! derived type for intent(in) arguments in vegNrgFlux call + logical(lgt) :: firstSubStep ! intent(in): flag to indicate if we are processing the first sub-step + logical(lgt) :: firstFluxCall ! intent(in): flag to indicate if we are processing the first flux call + logical(lgt) :: computeVegFlux ! intent(in): flag to indicate if we need to compute fluxes over vegetation + logical(lgt) :: checkLWBalance ! intent(in): flag to check longwave balance + real(rkind) :: upperBoundTemp ! intent(in): temperature of the upper boundary (K) --> NOTE: use air temperature + real(rkind) :: scalarCanairTempTrial ! intent(in): trial value of the canopy air space temperature (K) + real(rkind) :: scalarCanopyTempTrial ! intent(in): trial value of canopy temperature (K) + real(rkind) :: mLayerTempTrial_1 ! intent(in): trial value of ground temperature (K) + real(rkind) :: scalarCanopyIceTrial ! intent(in): trial value of mass of ice on the vegetation canopy (kg m-2) + real(rkind) :: scalarCanopyLiqTrial ! intent(in): trial value of mass of liquid water on the vegetation canopy (kg m-2) + real(rkind) :: dCanLiq_dTcanopy ! intent(in): derivative in canopy liquid storage w.r.t. canopy temperature (kg m-2 K-1) + end type in_type_vegNrgFlux + + type, public :: out_type_vegNrgFlux ! derived type for intent(out) arguments in vegNrgFlux call + real(rkind) :: scalarCanopyTranspiration ! intent(out): canopy transpiration (kg m-2 s-1) + real(rkind) :: scalarCanopyEvaporation ! intent(out): canopy evaporation/condensation (kg m-2 s-1) + real(rkind) :: scalarGroundEvaporation ! intent(out): ground evaporation/condensation -- below canopy or non-vegetated (kg m-2 s-1) + real(rkind) :: scalarCanairNetNrgFlux ! intent(out): net energy flux for the canopy air space (W m-2) + real(rkind) :: scalarCanopyNetNrgFlux ! intent(out): net energy flux for the vegetation canopy (W m-2) + real(rkind) :: scalarGroundNetNrgFlux ! intent(out): net energy flux for the ground surface (W m-2) + real(rkind) :: dCanairNetFlux_dCanairTemp ! intent(out): derivative in net canopy air space flux w.r.t. canopy air temperature (W m-2 K-1) + real(rkind) :: dCanairNetFlux_dCanopyTemp ! intent(out): derivative in net canopy air space flux w.r.t. canopy temperature (W m-2 K-1) + real(rkind) :: dCanairNetFlux_dGroundTemp ! intent(out): derivative in net canopy air space flux w.r.t. ground temperature (W m-2 K-1) + real(rkind) :: dCanopyNetFlux_dCanairTemp ! intent(out): derivative in net canopy flux w.r.t. canopy air temperature (W m-2 K-1) + real(rkind) :: dCanopyNetFlux_dCanopyTemp ! intent(out): derivative in net canopy flux w.r.t. canopy temperature (W m-2 K-1) + real(rkind) :: dCanopyNetFlux_dGroundTemp ! intent(out): derivative in net canopy flux w.r.t. ground temperature (W m-2 K-1) + real(rkind) :: dGroundNetFlux_dCanairTemp ! intent(out): derivative in net ground flux w.r.t. canopy air temperature (W m-2 K-1) + real(rkind) :: dGroundNetFlux_dCanopyTemp ! intent(out): derivative in net ground flux w.r.t. canopy temperature (W m-2 K-1) + real(rkind) :: dGroundNetFlux_dGroundTemp ! intent(out): derivative in net ground flux w.r.t. ground temperature (W m-2 K-1) + real(rkind) :: dCanopyEvaporation_dCanWat ! intent(out): derivative in canopy evaporation w.r.t. canopy total water content (s-1) + real(rkind) :: dCanopyEvaporation_dTCanair ! intent(out): derivative in canopy evaporation w.r.t. canopy air temperature (kg m-2 s-1 K-1) + real(rkind) :: dCanopyEvaporation_dTCanopy ! intent(out): derivative in canopy evaporation w.r.t. canopy temperature (kg m-2 s-1 K-1) + real(rkind) :: dCanopyEvaporation_dTGround ! intent(out): derivative in canopy evaporation w.r.t. ground temperature (kg m-2 s-1 K-1) + real(rkind) :: dGroundEvaporation_dCanWat ! intent(out): derivative in ground evaporation w.r.t. canopy total water content (s-1) + real(rkind) :: dGroundEvaporation_dTCanair ! intent(out): derivative in ground evaporation w.r.t. canopy air temperature (kg m-2 s-1 K-1) + real(rkind) :: dGroundEvaporation_dTCanopy ! intent(out): derivative in ground evaporation w.r.t. canopy temperature (kg m-2 s-1 K-1) + real(rkind) :: dGroundEvaporation_dTGround ! intent(out): derivative in ground evaporation w.r.t. ground temperature (kg m-2 s-1 K-1) + real(rkind) :: dCanopyTrans_dCanWat ! intent(out): derivative in canopy transpiration w.r.t. canopy total water content (s-1) + real(rkind) :: dCanopyTrans_dTCanair ! intent(out): derivative in canopy transpiration w.r.t. canopy air temperature (kg m-2 s-1 K-1) + real(rkind) :: dCanopyTrans_dTCanopy ! intent(out): derivative in canopy transpiration w.r.t. canopy temperature (kg m-2 s-1 K-1) + real(rkind) :: dCanopyTrans_dTGround ! intent(out): derivative in canopy transpiration w.r.t. ground temperature (kg m-2 s-1 K-1) + real(rkind) :: dCanopyNetFlux_dCanWat ! intent(out): derivative in net canopy fluxes w.r.t. canopy total water content (J kg-1 s-1) + real(rkind) :: dGroundNetFlux_dCanWat ! intent(out): derivative in net ground fluxes w.r.t. canopy total water content (J kg-1 s-1) + integer(i4b) :: err ! intent(out): error code + character(:),allocatable :: cmessage ! intent(out): error message + end type out_type_vegNrgFlux + ! ** end vegNrgFlux + + ! ** ssdNrgFlux + type, public :: in_type_ssdNrgFlux ! derived type for intent(in) arguments in ssdNrgFlux call + logical(lgt) :: scalarSolution ! intent(in): flag to denote if implementing the scalar solution + real(rkind) :: scalarGroundNetNrgFlux ! intent(in): net energy flux for the ground surface (W m-2) + real(rkind), allocatable :: iLayerLiqFluxSnow(:) ! intent(in): liquid flux at the interface of each snow layer (m s-1) + real(rkind), allocatable :: iLayerLiqFluxSoil(:) ! intent(in): liquid flux at the interface of each soil layer (m s-1) + real(rkind), allocatable :: mLayerTempTrial(:) ! intent(in): temperature in each layer at the current iteration (m) + real(rkind), allocatable :: dThermalC_dWatAbove(:) ! intent(in): derivative in the thermal conductivity w.r.t. water state in the layer above + real(rkind), allocatable :: dThermalC_dWatBelow(:) ! intent(in): derivative in the thermal conductivity w.r.t. water state in the layer above + real(rkind), allocatable :: dThermalC_dTempAbove(:) ! intent(in): derivative in the thermal conductivity w.r.t. energy state in the layer above + real(rkind), allocatable :: dThermalC_dTempBelow(:) ! intent(in): derivative in the thermal conductivity w.r.t. energy state in the layer above + end type in_type_ssdNrgFlux + + type, public :: io_type_ssdNrgFlux ! derived type for intent(inout) arguments in ssdNrgFlux call + real(rkind) :: dGroundNetFlux_dGroundTemp ! intent(inout): derivative in net ground flux w.r.t. ground temperature (W m-2 K-1) + end type io_type_ssdNrgFlux + + type, public :: out_type_ssdNrgFlux ! derived type for intent(inout) arguments in ssdNrgFlux call + real(rkind), allocatable :: iLayerNrgFlux(:) ! intent(out): energy flux at the layer interfaces (W m-2) + real(rkind), allocatable :: dNrgFlux_dTempAbove(:) ! intent(out): derivatives in the flux w.r.t. temperature in the layer above (J m-2 s-1 K-1) + real(rkind), allocatable :: dNrgFlux_dTempBelow(:) ! intent(out): derivatives in the flux w.r.t. temperature in the layer below (J m-2 s-1 K-1) + real(rkind), allocatable :: dNrgFlux_dWatAbove(:) ! intent(out): derivatives in the flux w.r.t. water state in the layer above (J m-2 s-1 K-1) + real(rkind), allocatable :: dNrgFlux_dWatBelow(:) ! intent(out): derivatives in the flux w.r.t. water state in the layer below (J m-2 s-1 K-1) + integer(i4b) :: err ! intent(out): error code + character(:),allocatable :: cmessage ! intent(out): error message + end type out_type_ssdNrgFlux + ! ** end ssdNrgFlux + + ! ** vegLiqFlux + type, public :: in_type_vegLiqFlux ! derived type for intent(in) arguments in vegLiqFlux call + logical(lgt) :: computeVegFlux ! intent(in): flag to denote if computing energy flux over vegetation + real(rkind) :: scalarCanopyLiqTrial ! intent(in): trial mass of liquid water on the vegetation canopy at the current iteration (kg m-2) + real(rkind) :: scalarRainfall ! intent(in): rainfall rate (kg m-2 s-1) + end type in_type_vegLiqFlux + + type, public :: out_type_vegLiqFlux ! derived type for intent(out) arguments in vegLiqFlux call + real(rkind) :: scalarThroughfallRain ! intent(out): rain that reaches the ground without ever touching the canopy (kg m-2 s-1) + real(rkind) :: scalarCanopyLiqDrainage ! intent(out): drainage of liquid water from the vegetation canopy (kg m-2 s-1) + real(rkind) :: scalarThroughfallRainDeriv ! intent(out): derivative in throughfall w.r.t. canopy liquid water (s-1) + real(rkind) :: scalarCanopyLiqDrainageDeriv ! intent(out): derivative in canopy drainage w.r.t. canopy liquid water (s-1) + integer(i4b) :: err ! intent(out): error code + character(:),allocatable :: cmessage ! intent(out): error message + end type out_type_vegLiqFlux + ! ** end vegLiqFlux + + ! ** snowLiqFlx + type, public :: in_type_snowLiqFlx ! derived type for intent(in) arguments in snowLiqFlx call + integer(i4b) :: nSnow ! intent(in): number of snow layers + logical(lgt) :: firstFluxCall ! intent(in): the first flux call (compute variables that are constant over the iterations) + logical(lgt) :: scalarSolution ! intent(in): flag to indicate the scalar solution + real(rkind) :: scalarThroughfallRain ! intent(in): rain that reaches the snow surface without ever touching vegetation (kg m-2 s-1) + real(rkind) :: scalarCanopyLiqDrainage ! intent(in): liquid drainage from the vegetation canopy (kg m-2 s-1) + real(rkind), allocatable :: mLayerVolFracLiqTrial(:) ! intent(in): trial value of volumetric fraction of liquid water at the current iteration (-) + end type in_type_snowLiqFlx + + type, public :: io_type_snowLiqFlx ! derived type for intent(inout) arguments in snowLiqFlx call + real(rkind), allocatable :: iLayerLiqFluxSnow(:) ! intent(inout): vertical liquid water flux at layer interfaces (m s-1) + real(rkind), allocatable :: iLayerLiqFluxSnowDeriv(:) ! intent(inout): derivative in vertical liquid water flux at layer interfaces (m s-1) + end type io_type_snowLiqFlx + + type, public :: out_type_snowLiqFlx ! derived type for intent(out) arguments in snowLiqFlx call + integer(i4b) :: err ! intent(out): error code + character(:),allocatable :: cmessage ! intent(out): error message + end type out_type_snowLiqFlx + ! ** end snowLiqFlx END MODULE data_types