About this vignette

This document describes how to run a water and energy balance model that uses a more detailed approach for hydraulics and stomatal regulation described in De Cáceres et al. (2021) and Ruffault et al. (2022). We recommend reading vignette Basic water balance before this one for a more accessible introduction to soil water balance modelling. This vignette is meant to teach users to run the simulation model within R. All the details of the model design and formulation can be found at the medfatebook.

Preparing model inputs

Model inputs are explained in greater detail in vignettes Understanding model inputs and Preparing model inputs. Here we only review the different steps required to run function spwb().

Soil, vegetation, meteorology and species data

Soil information needs to be entered as a data frame with soil layers in rows and physical attributes in columns. Soil physical attributes can be initialized to default values, for a given number of layers, using function defaultSoilParams():

The soil input for water balance simulation is actually a list of class soil that is created using a function with the same name:

examplesoil <- soil(spar)

As explained in the package overview, models included in medfate were primarily designed to be ran on forest inventory plots. Here we use the example object provided with the package:

data(exampleforest)
exampleforest
## $treeData
##            Species   N   DBH Height Z50  Z95
## 1 Pinus halepensis 168 37.55    800 100  600
## 2     Quercus ilex 384 14.60    660 300 1000
## 
## $shrubData
##             Species Cover Height Z50  Z95
## 1 Quercus coccifera  3.75     80 200 1000
## 
## $herbCover
## [1] 10
## 
## $herbHeight
## [1] 20
## 
## $seedBank
## [1] Species Percent
## <0 rows> (or 0-length row.names)
## 
## attr(,"class")
## [1] "forest" "list"

Importantly, a data frame with daily weather for the period to be simulated is required. Here we use the default data frame included with the package:

data(examplemeteo)
head(examplemeteo)
##        dates MinTemperature MaxTemperature Precipitation MinRelativeHumidity
## 1 2001-01-01     -0.5934215       6.287950      4.869109            65.15411
## 2 2001-01-02     -2.3662458       4.569737      2.498292            57.43761
## 3 2001-01-03     -3.8541036       2.661951      0.000000            58.77432
## 4 2001-01-04     -1.8744860       3.097705      5.796973            66.84256
## 5 2001-01-05      0.3288287       7.551532      1.884401            62.97656
## 6 2001-01-06      0.5461322       7.186784     13.359801            74.25754
##   MaxRelativeHumidity Radiation WindSpeed
## 1           100.00000  12.89251  2.000000
## 2            94.71780  13.03079  7.662544
## 3            94.66823  16.90722  2.000000
## 4            95.80950  11.07275  2.000000
## 5           100.00000  13.45205  7.581347
## 6           100.00000  12.84841  6.570501

Finally, simulations in medfate require a data frame with species parameter values, which we load using defaults for Catalonia (NE Spain):

data("SpParamsMED")

Simulation control

Apart from data inputs, the behaviour of simulation models is controlled using a set of global parameters. The default parameterization is obtained using function defaultControl():

control <- defaultControl("Sperry")

To use the advanced water balance model we must change the values of transpirationMode to switch from "Granier" to either "Sperry" or "Cochard".

Water balance input object

A last object is needed before calling simulation functions, called spwbInput. It consists in the compilation of aboveground, belowground parameters and the specification of additional parameter values for each plant cohort. This is done by calling function forest2spwbInput():

x <- forest2spwbInput(exampleforest, examplesoil, SpParamsMED, control)

The spwbInput object for advanced water and energy balance is similar to that of simple water balance simulations, but contains more elements. Information about the cohort species is found in element cohorts, i.e. the cohort code, the species index and species name:

x$cohorts
##         SP              Name
## T1_148 148  Pinus halepensis
## T2_168 168      Quercus ilex
## S1_165 165 Quercus coccifera

Element canopy contains state variables within the canopy:

x$canopy
##    zlow zmid  zup Tair Cair VPair
## 1     0   50  100   NA   NA    NA
## 2   100  150  200   NA   NA    NA
## 3   200  250  300   NA   NA    NA
## 4   300  350  400   NA   NA    NA
## 5   400  450  500   NA   NA    NA
## 6   500  550  600   NA   NA    NA
## 7   600  650  700   NA   NA    NA
## 8   700  750  800   NA   NA    NA
## 9   800  850  900   NA   NA    NA
## 10  900  950 1000   NA   NA    NA
## 11 1000 1050 1100   NA   NA    NA
## 12 1100 1150 1200   NA   NA    NA
## 13 1200 1250 1300   NA   NA    NA
## 14 1300 1350 1400   NA   NA    NA
## 15 1400 1450 1500   NA   NA    NA
## 16 1500 1550 1600   NA   NA    NA
## 17 1600 1650 1700   NA   NA    NA
## 18 1700 1750 1800   NA   NA    NA
## 19 1800 1850 1900   NA   NA    NA
## 20 1900 1950 2000   NA   NA    NA
## 21 2000 2050 2100   NA   NA    NA
## 22 2100 2150 2200   NA   NA    NA
## 23 2200 2250 2300   NA   NA    NA
## 24 2300 2350 2400   NA   NA    NA
## 25 2400 2450 2500   NA   NA    NA
## 26 2500 2550 2600   NA   NA    NA
## 27 2600 2650 2700   NA   NA    NA
## 28 2700 2750 2800   NA   NA    NA

Canopy temperature, water vapour pressure and \(CO_2\) concentration are state variables needed for canopy energy balance. If the canopy energy balance assumes a single canopy layer, the same values will be assumed through the canopy. Variation of within-canopy state variables is modelled if a multi-canopy energy balance is used (see control parameter multiLayerBalance).

As you may already known, element above contains the aboveground structure data that we already know:

x$above
##          H        CR   LAI_live LAI_expanded LAI_dead
## T1_148 800 0.6605196 0.84874773   0.84874773        0
## T2_168 660 0.6055642 0.70557382   0.70557382        0
## S1_165  80 0.8032817 0.03062604   0.03062604        0

Belowground parameters can be seen in below:

x$below
##        Z50  Z95
## T1_148 100  600
## T2_168 300 1000
## S1_165 200 1000

and in belowLayers:

x$belowLayers
## $V
##                1         2          3           4
## T1_148 0.8604899 0.1194556 0.01511005 0.004944476
## T2_168 0.5008953 0.4505941 0.04064831 0.007862284
## S1_165 0.6799879 0.2737911 0.03567632 0.010544678
## 
## $L
##               1        2        3        4
## T1_148 2289.062 1566.552 2250.052 4226.166
## T2_168 1817.571 2100.346 2410.127 4285.194
## S1_165 1085.030 1380.808 2170.587 4146.637
## 
## $VGrhizo_kmax
##                 1         2        3        4
## T1_148  176772045  24539986  3104085  1015753
## T2_168   82682357  74379184  6709782  1297820
## S1_165 1116059122 449371399 58555276 17306902
## 
## $VCroot_kmax
##               1         2          3           4
## T1_148 2.382795 0.4833484 0.04256689 0.007416044
## T2_168 1.568929 1.2213562 0.09601747 0.010445417
## S1_165 2.407779 0.7618041 0.06314806 0.009770000
## 
## $Wpool
##        1 2 3 4
## T1_148 1 1 1 1
## T2_168 1 1 1 1
## S1_165 1 1 1 1
## 
## $RhizoPsi
##             1      2      3      4
## T1_148 -0.033 -0.033 -0.033 -0.033
## T2_168 -0.033 -0.033 -0.033 -0.033
## S1_165 -0.033 -0.033 -0.033 -0.033

The spwbInputobject also includes cohort parameter values for several kinds of traits. For example, plant anatomy parameters are described in paramsAnatomy:

x$paramsAnatomy
##        Hmed    Al2As      SLA LeafWidth LeafDensity WoodDensity FineRootDensity
## T1_148  850 1317.523 5.140523 0.1384772   0.2982842   0.6077016       0.2982842
## T2_168  500 3908.823 6.340000 1.7674359   0.4893392   0.9008264       0.4893392
## S1_165   80 4189.325 4.980084 1.3761085   0.3709679   0.4389106       0.3709679
##        conduit2sapwood      SRL RLD     r635
## T1_148       0.9236406 3172.572  10 1.964226
## T2_168       0.6238125 4398.812  10 1.805872
## S1_165       0.6238125 4398.812  10 2.289452

Parameters related to plant transpiration and photosynthesis can be seen in paramsTranspiration:

x$paramsTranspiration
##             Gswmin    Gswmax  Vmax298  Jmax298 Kmax_stemxylem Kmax_rootxylem
## T1_148 0.003086667 0.2850000 72.19617 124.1687           0.15           0.60
## T2_168 0.004473333 0.2007222 68.51600 118.7863           0.40           1.60
## S1_165 0.010455247 0.2830167 62.78100 118.4486           0.29           1.16
##        VCleaf_kmax VCleafapo_kmax VCleaf_c  VCleaf_d kleaf_symp VCstem_kmax
## T1_148    4.000000        8.00000 5.030852 -4.797531    8.00000    1.339563
## T2_168    4.000000        8.00000 2.731881 -4.278250    8.00000    1.620936
## S1_165    9.579077       19.15815 3.095442 -7.857378   19.15815    4.599269
##        VCstem_c  VCstem_d VCroot_kmax VCroot_c  VCroot_d VGrhizo_kmax
## T1_148 5.030852 -4.797531    2.916127 5.030852 -4.797531    205431869
## T2_168 2.731881 -4.278250    2.896748 2.731881 -4.278250    165069144
## S1_165 3.095442 -7.857378    3.242501 3.095442 -7.857378   1641292700
##        Plant_kmax   FR_leaf   FR_stem   FR_root
## T1_148  0.7465846 0.1866462 0.5573346 0.2560193
## T2_168  0.8249857 0.2062464 0.5089563 0.2847972
## S1_165  1.5867376 0.1656462 0.3449978 0.4893561

Parameters related to pressure-volume curves and water storage capacity of leaf and stem organs are in paramsWaterStorage:

x$paramsWaterStorage
##           maxFMC   LeafPI0   LeafEPS LeafAF     Vleaf   StemPI0   StemEPS
## T1_148 126.03063 -1.591429  8.918571 0.3525 0.5258525 -2.008039 13.256355
## T2_168  93.15304 -1.483333 19.260000 0.1700 0.2199087 -3.227438 46.420610
## S1_165  96.53441 -2.370000 17.230000 0.2400 0.4108968 -1.305868  6.297155
##           StemAF Vsapwood
## T1_148 0.9236406 6.174277
## T2_168 0.6238125 1.278142
## S1_165 0.6238125 1.064511

Finally, remember that one can play with plant-specific parameters for soil water balance (instead of using species-level values) by modifying manually the parameter values in this object.

Static analysis of sub-models

Before using the advanced water and energy balance model, is important to understand the parameters that influence the different sub-models. Package medfate provides low-level functions corresponding to sub-models (light extinction, hydraulics, transpiration, photosynthesis…). In addition, there are several high-level plotting functions that allow examining several aspects of these processes.

Vulnerability curves

Given a spwbInput object, we can use function hydraulics_vulnerabilityCurvePlot() to inspect vulnerability curves (i.e. how hydraulic conductance of a given segment changes with the water potential) for each plant cohort and each of the different segments of the soil-plant hydraulic network: rhizosphere, roots, stems and leaves:

hydraulics_vulnerabilityCurvePlot(x, examplesoil, type="rhizo")

The maximum values and shape of vulnerability curves for leaves and stems are regulated by parameters in paramsTranspiration. Roots have vulnerability curve parameters in the same data frame, but maximum conductance values need to be specified for each soil layer and are given in belowLayers$VCroot_kmax. Note that the last call to hydraulics_vulnerabilityCurvePlot() includes a soil object. This is because the van Genuchten parameters that define the shape of the vulnerability curve for the rhizosphere are stored in this object. Maximum conductance values in the rhizosphere are given in belowLayers$VGrhizo_kmax.

Supply functions

The vulnerability curves conforming the hydraulic network are used in the model to build the supply function, which relates water flow (i.e. transpiration) with the drop of water potential along the whole hydraulic pathway. The supply function contains not only these two variables, but also the water potential of intermediate nodes in the the hydraulic network. Function hydraulics_supplyFunctionPlot() can be used to inspect any of this variables:

Calls to hydraulics_supplyFunctionPlot() always need both a spwbInput object and a soil object. The soil moisture state (i.e. its water potential) is the starting point for the calculation of the supply function, so different curves will be obtained for different values of soil moisture.

Stomatal regulation and photosynthesis

The soil water balance model determines stomatal conductance and transpiration separately for sunlit and shade leaves. Stomatal conductance is determined after building a photosynthesis function corresponding to the supply function and finding the value of stomatal conductance that maximizes carbon revenue while avoiding hydraulic damage (a profit-maximization approach). Given a meteorological and soil inputs and a chosen day and timestep, function transp_stomatalRegulationPlot() allows displaying the supply and photosynthesis curves for sunlit and shade leaves, along with an indication of the values corresponding to the chosen stomatal aperture:

d <- 100
transp_stomatalRegulationPlot(x, examplemeteo, day = d, timestep=12,
                              latitude = 41.82592, elevation = 100, type="E")
## Package 'meteoland' [ver. 2.2.1]

transp_stomatalRegulationPlot(x, examplemeteo, day = d, timestep=12,
                              latitude = 41.82592, elevation = 100, type="An")

transp_stomatalRegulationPlot(x, examplemeteo, day = d, timestep=12,
                              latitude = 41.82592, elevation = 100, type="Gsw")

transp_stomatalRegulationPlot(x, examplemeteo, day = d, timestep=12,
                              latitude = 41.82592, elevation = 100, type="T")

transp_stomatalRegulationPlot(x, examplemeteo, day = d, timestep=12,
                              latitude = 41.82592, elevation = 100, type="VPD")

Pressure volume curves

moisture_pressureVolumeCurvePlot(x, segment="leaf", fraction="symplastic")

moisture_pressureVolumeCurvePlot(x, segment="leaf", fraction="apoplastic")

moisture_pressureVolumeCurvePlot(x, segment="stem", fraction="symplastic")

moisture_pressureVolumeCurvePlot(x, segment="stem", fraction="apoplastic")

Water balance for a single day

Running the model

Soil water balance simulations will normally span periods of several months or years, but since the model operates at a daily and subdaily temporal scales, it is possible to perform soil water balance for one day only. This is done using function spwb_day(). In the following code we select the same day as before from the meteorological input data and perform soil water balance for that day only:

date <- examplemeteo$dates[d]
meteovec <- unlist(examplemeteo[d,])
sd1<-spwb_day(x, date, meteovec, 
             latitude = 41.82592, elevation = 100, slope= 0, aspect = 0)

The output of spwb_day() is a list with several elements:

names(sd1)
##  [1] "cohorts"          "topography"       "weather"          "WaterBalance"    
##  [5] "EnergyBalance"    "Soil"             "Stand"            "Plants"          
##  [9] "RhizoPsi"         "SunlitLeaves"     "ShadeLeaves"      "ExtractionInst"  
## [13] "PlantsInst"       "SunlitLeavesInst" "ShadeLeavesInst"  "LightExtinction" 
## [17] "LWRExtinction"    "CanopyTurbulence"

Water balance output

Element WaterBalance contains the soil water balance flows of the day (precipitation, infiltration, transpiration, …)

sd1$WaterBalance
##                     PET                    Rain                    Snow 
##             3.902334206             0.000000000             0.000000000 
##                 NetRain                Snowmelt                   Runon 
##             0.000000000             0.000000000             0.000000000 
##            Infiltration                  Runoff            DeepDrainage 
##             0.000000000             0.000000000             0.008442749 
##         SoilEvaporation       HerbTranspiration         PlantExtraction 
##             0.500000000             0.048725420             0.879355298 
##           Transpiration HydraulicRedistribution 
##             0.879355298             0.000000000

And Soil contains water evaporated from each soil layer, water transpired from each soil layer and the final soil water potential:

sd1$Soil
##   HerbTranspiration HydraulicInput HydraulicOutput PlantExtraction         psi
## 1       0.008571001              0     0.624931278     0.624931278 -0.03595813
## 2       0.012000080              0     0.232685935     0.232685935 -0.03328231
## 3       0.013576976              0     0.019134296     0.019134296 -0.03298146
## 4       0.014577363              0     0.002603789     0.002603789 -0.03300144

Soil and canopy energy balance

Element EnergyBalance contains subdaily variation in atmosphere, canopy and soil temperatures, as well as canopy and soil energy balance components.

names(sd1$EnergyBalance)
## [1] "Temperature"         "CanopyEnergyBalance" "SoilEnergyBalance"  
## [4] "TemperatureLayers"   "VaporPressureLayers"

Package medfate provides a plot function for objects of class spwb_day that can be used to inspect the results of the simulation. We use this function to display subdaily dynamics in plant, soil and canopy variables. For example, we can use it to display temperature variations (only the temperature of the topmost soil layer is drawn):

plot(sd1, type = "Temperature")

plot(sd1, type = "CanopyEnergyBalance")

plot(sd1, type = "SoilEnergyBalance")

Plant output

Element Plants contains output values by plant cohort. Several output variables can be inspected in this element.

sd1$Plants
##               LAI    LAIlive     FPAR Extraction Transpiration
## T1_148 0.84874773 0.84874773 92.18285 0.51972663    0.51972663
## T2_168 0.70557382 0.70557382 72.36365 0.33237115    0.33237115
## S1_165 0.03062604 0.03062604 44.32407 0.02725753    0.02725753
##        GrossPhotosynthesis NetPhotosynthesis    RootPsi   StemPsi     LeafPLC
## T1_148          2.12426850        2.01339458 -0.5335429 -1.624335 0.002722852
## T2_168          1.81702456        1.71356630 -0.4379319 -1.169929 0.014501424
## S1_165          0.07014613        0.06637218 -0.7888535 -1.322764 0.001529193
##            StemPLC LeafPsiMin  LeafPsiMax      dEdP         DDS   StemRWC
## T1_148 0.002195517  -1.992041 -0.03994095 0.5028769 0.002731251 0.9946726
## T2_168 0.016295506  -1.475232 -0.04017868 0.5491158 0.014521628 0.9863067
## S1_165 0.002013280  -1.579954 -0.04186438 1.0700642 0.001531708 0.9756540
##          LeafRWC      LFMC  WaterBalance
## T1_148 0.9496856 122.47272 -1.729302e-17
## T2_168 0.9743809  91.26229 -8.592302e-18
## S1_165 0.9778179  94.27543  4.031877e-19

While Plants contains one value per cohort and variable that summarizes the whole simulated day, information by disaggregated by time step can be accessed in PlantsInst. Moreover, we can use function plot.spwb_day() to draw plots of sub-daily variation per species of plant transpiration per ground area (L·m\(^{-2}\)), transpiration per leaf area (also in L·m\(^{-2}\)), plant net photosynthesis (in g C·m\(^{-2}\)), and plant water potential (in MPa):

plot(sd1, type = "PlantTranspiration", bySpecies = T)

plot(sd1, type = "TranspirationPerLeaf", bySpecies = T)

plot(sd1, type = "NetPhotosynthesis", bySpecies = T)

plot(sd1, type = "LeafPsiAverage", bySpecies = T)

Output for sunlit and shade leaves

The model distinguishes between sunlit and shade leaves for stomatal regulation. Static properties of sunlit and shade leaves, for each cohort, can be accessed via:

sd1$SunlitLeaves
##        LeafPsiMin  LeafPsiMax      GSWMin    GSWMax  TempMin  TempMax
## T1_148  -2.242720 -0.03994095 0.002242884 0.2741563 1.273603 11.69716
## T2_168  -1.980099 -0.04197336 0.003269165 0.1199765 1.271446 17.29191
## S1_165  -2.289301 -0.04699638 0.007561891 0.1997103 1.266836 16.55885
sd1$ShadeLeaves
##        LeafPsiMin  LeafPsiMax      GSWMin    GSWMax   TempMin   TempMax
## T1_148  -1.791699 -0.03994095 0.002250626 0.2803527 0.9555411 10.158239
## T2_168  -1.123196 -0.04017868 0.003263121 0.1807394 0.5311464 10.181732
## S1_165  -1.251721 -0.04186438 0.007632274 0.2310791 0.5914201  9.625732

Instantaneous values are also stored for sunlit and shade leaves. We can also use the plot function for objects of class spwb_day to draw instantaneous variations in temperature for sunlit and shade leaves:

plot(sd1, type = "LeafTemperature", bySpecies=TRUE)

Note that sunlit leaves of some species reach temperatures higher than the canopy. We can also plot variations in instantaneous gross and net photosynthesis rates:

plot(sd1, type = "LeafGrossPhotosynthesis", bySpecies=TRUE)

plot(sd1, type = "LeafNetPhotosynthesis", bySpecies=TRUE)

Or variations in stomatal conductance:

plot(sd1, type = "LeafStomatalConductance", bySpecies=TRUE)

Or variations in vapour pressure deficit:

plot(sd1, type = "LeafVPD", bySpecies=TRUE)

Or variations in leaf water potential:

plot(sd1, type = "LeafPsi", bySpecies=TRUE)

plot(sd1, type = "LeafCi", bySpecies=TRUE)

plot(sd1, type = "LeafIntrinsicWUE", bySpecies=TRUE)

Water balance for multiple days

Running the model

Users will often use function spwb() to run the soil water balance model for several days. This function requires the spwbInput object, the soil object and the meteorological data frame. However, running spwb_day() modified the input objects. In particular, the soil moisture at the end of the simulation was:

x$soil$W
## [1] 0.9818782 0.9982019 1.0001186 0.9999908

And the temperature of soil layers:

x$soil$Temp
## [1] 8.016705 3.132713 2.380127 2.434077

We can also see the current state of canopy variables:

x$canopy
##    zlow zmid  zup     Tair Cair     VPair
## 1     0   50  100 5.644686  386 0.5170718
## 2   100  150  200 5.644686  386 0.5170718
## 3   200  250  300 5.644686  386 0.5170718
## 4   300  350  400 5.644686  386 0.5170718
## 5   400  450  500 5.644686  386 0.5170718
## 6   500  550  600 5.644686  386 0.5170718
## 7   600  650  700 5.644686  386 0.5170718
## 8   700  750  800 5.644686  386 0.5170718
## 9   800  850  900 5.644686  386 0.5170718
## 10  900  950 1000 5.644686  386 0.5170718
## 11 1000 1050 1100 5.644686  386 0.5170718
## 12 1100 1150 1200 5.644686  386 0.5170718
## 13 1200 1250 1300 5.644686  386 0.5170718
## 14 1300 1350 1400 5.644686  386 0.5170718
## 15 1400 1450 1500 5.644686  386 0.5170718
## 16 1500 1550 1600 5.644686  386 0.5170718
## 17 1600 1650 1700 5.644686  386 0.5170718
## 18 1700 1750 1800 5.644686  386 0.5170718
## 19 1800 1850 1900 5.644686  386 0.5170718
## 20 1900 1950 2000 5.644686  386 0.5170718
## 21 2000 2050 2100 5.644686  386 0.5170718
## 22 2100 2150 2200 5.644686  386 0.5170718
## 23 2200 2250 2300 5.644686  386 0.5170718
## 24 2300 2350 2400 5.644686  386 0.5170718
## 25 2400 2450 2500 5.644686  386 0.5170718
## 26 2500 2550 2600 5.644686  386 0.5170718
## 27 2600 2650 2700 5.644686  386 0.5170718
## 28 2700 2750 2800 5.644686  386 0.5170718

We simply use function resetInputs() to reset state variables to their default values, so that the new simulation is not affected by the end state of the previous simulation:

resetInputs(x)
x$soil$W
## [1] 1 1 1 1
x$soil$Temp
## [1] NA NA NA NA
x$canopy
##    zlow zmid  zup Tair Cair VPair
## 1     0   50  100   NA   NA    NA
## 2   100  150  200   NA   NA    NA
## 3   200  250  300   NA   NA    NA
## 4   300  350  400   NA   NA    NA
## 5   400  450  500   NA   NA    NA
## 6   500  550  600   NA   NA    NA
## 7   600  650  700   NA   NA    NA
## 8   700  750  800   NA   NA    NA
## 9   800  850  900   NA   NA    NA
## 10  900  950 1000   NA   NA    NA
## 11 1000 1050 1100   NA   NA    NA
## 12 1100 1150 1200   NA   NA    NA
## 13 1200 1250 1300   NA   NA    NA
## 14 1300 1350 1400   NA   NA    NA
## 15 1400 1450 1500   NA   NA    NA
## 16 1500 1550 1600   NA   NA    NA
## 17 1600 1650 1700   NA   NA    NA
## 18 1700 1750 1800   NA   NA    NA
## 19 1800 1850 1900   NA   NA    NA
## 20 1900 1950 2000   NA   NA    NA
## 21 2000 2050 2100   NA   NA    NA
## 22 2100 2150 2200   NA   NA    NA
## 23 2200 2250 2300   NA   NA    NA
## 24 2300 2350 2400   NA   NA    NA
## 25 2400 2450 2500   NA   NA    NA
## 26 2500 2550 2600   NA   NA    NA
## 27 2600 2650 2700   NA   NA    NA
## 28 2700 2750 2800   NA   NA    NA

Now we are ready to call function spwb():

S <- spwb(x, examplemeteo, latitude = 41.82592, elevation = 100)
## Initial plant water content (mm): 6.78662
## Initial soil water content (mm): 290.875
## Initial snowpack content (mm): 0
## Performing daily simulations
## 
##  [Year 2001]:....................................
## 
## Final plant water content (mm): 6.41269
## Final soil water content (mm): 246.858
## Final snowpack content (mm): 0
## Change in plant water content (mm): -0.37393
## Plant water balance result (mm): -9.37334e-16
## Change in soil water content (mm): -44.0172
## Soil water balance result (mm): -44.0435
## Change in snowpack water content (mm): 0
## Snowpack water balance result (mm): -7.10543e-15
## Water balance components:
##   Precipitation (mm) 513
##   Rain (mm) 462 Snow (mm) 51
##   Interception (mm) 92 Net rainfall (mm) 370
##   Infiltration (mm) 346 Runoff (mm) 24 Deep drainage (mm) 56
##   Soil evaporation (mm) 8  Herbaceous transpiration (mm) 13 Woody plant transpiration (mm) 363
##   Plant extraction from soil (mm) 363  Plant water balance (mm) -0 Hydraulic redistribution (mm) 14

Function spwb() returns an object of class spwb. If we inspect its elements, we realize that the output is arranged differently than in spwb_day():

##  [1] "latitude"      "topography"    "weather"       "spwbInput"    
##  [5] "spwbOutput"    "WaterBalance"  "EnergyBalance" "Temperature"  
##  [9] "Soil"          "Stand"         "Plants"        "SunlitLeaves" 
## [13] "ShadeLeaves"

In particular, element spwbInput contains a copy of the input parameters that were used to run the model:

names(S$spwbInput)
##  [1] "control"             "soil"                "canopy"             
##  [4] "herbLAI"             "herbLAImax"          "cohorts"            
##  [7] "above"               "below"               "belowLayers"        
## [10] "paramsPhenology"     "paramsAnatomy"       "paramsInterception" 
## [13] "paramsTranspiration" "paramsWaterStorage"  "internalPhenology"  
## [16] "internalWater"       "internalFCCS"

As before, WaterBalance contains water balance components, but in this case in form of a data frame with days in rows:

head(S$WaterBalance)
##                  PET Precipitation      Rain Snow    NetRain Snowmelt
## 2001-01-01 0.8828475      4.869109  4.869109    0  3.4241795        0
## 2001-01-02 1.6375337      2.498292  2.498292    0  1.0717469        0
## 2001-01-03 1.3017026      0.000000  0.000000    0  0.0000000        0
## 2001-01-04 0.5690790      5.796973  5.796973    0  4.3625616        0
## 2001-01-05 1.6760567      1.884401  1.884401    0  0.7539027        0
## 2001-01-06 1.2077028     13.359801 13.359801    0 11.7240275        0
##            Infiltration Runoff DeepDrainage Evapotranspiration Interception
## 2001-01-01    3.4241795      0  0.008464267           2.255715     1.444929
## 2001-01-02    1.0717469      0  0.008501580           1.947740     1.426545
## 2001-01-03    0.0000000      0  0.008535573           0.551716     0.000000
## 2001-01-04    4.3625616      0  0.008577728           1.896419     1.434411
## 2001-01-05    0.7539027      0  0.008619290           1.590887     1.130499
## 2001-01-06   11.7240275      0  0.008660502           2.028699     1.635773
##            SoilEvaporation HerbTranspiration PlantExtraction Transpiration
## 2001-01-01      0.44789475       0.011023432       0.3518677     0.3518677
## 2001-01-02      0.07362662       0.020448029       0.4271203     0.4271203
## 2001-01-03      0.06419196       0.016254627       0.4712694     0.4712694
## 2001-01-04      0.08811282       0.007106063       0.3667885     0.3667885
## 2001-01-05      0.03090352       0.020930645       0.4085543     0.4085543
## 2001-01-06      0.03064445       0.015081842       0.3471994     0.3471994
##            HydraulicRedistribution
## 2001-01-01            0.000000e+00
## 2001-01-02            9.966818e-06
## 2001-01-03            1.024336e-07
## 2001-01-04            6.221948e-06
## 2001-01-05            1.692829e-03
## 2001-01-06            1.902109e-03

Elements Plants is itself a list with several elements that contain daily output results by plant cohorts, for example leaf minimum (midday) water potentials are:

head(S$Plants$LeafPsiMin)
##               T1_148     T2_168     S1_165
## 2001-01-01 -1.356475 -0.9361828 -0.6881288
## 2001-01-02 -1.565760 -0.9954821 -0.8409771
## 2001-01-03 -1.528220 -1.1073103 -0.8965962
## 2001-01-04 -1.269772 -0.8492362 -0.5930441
## 2001-01-05 -1.642458 -1.0753026 -0.9518200
## 2001-01-06 -1.542817 -0.9753797 -0.8080354

Plotting and summarizing results

Package medfate also provides a plot function for objects of class spwb. It can be used to show the meteorological input. Additionally, it can also be used to draw soil and plant variables. In the code below we draw water fluxes, soil water potentials, plant transpiration and plant (mid-day) water potential:

plot(S, type="Evapotranspiration")

plot(S, type="SoilPsi", bySpecies = TRUE)

plot(S, type="PlantTranspiration", bySpecies = TRUE)

plot(S, type="LeafPsiMin", bySpecies = TRUE)

Alternatively, one can interactively create plots using function shinyplot, e.g.:

While the simulation model uses daily steps, users may be interested in outputs at larger time scales. The package provides a summary for objects of class spwb. This function can be used to summarize the model’s output at different temporal steps (i.e. weekly, annual, …). For example, to obtain the average soil moisture and water potentials by months one can use:

summary(S, freq="months",FUN=mean, output="Soil")
##                  W.1       W.2       W.3      W.4     ML.1      ML.2     ML.3
## 2001-01-01 1.1734876 1.1145136 1.0290997 1.008304 80.00113 130.01132 77.95294
## 2001-02-01 0.9807509 1.1918303 1.1620297 1.062746 66.86153 139.03055 88.02222
## 2001-03-01 1.0474359 1.1894876 1.2796245 1.284929 71.40770 138.75726 96.92987
## 2001-04-01 0.8496587 1.0706844 1.2277734 1.357160 57.92447 124.89851 93.00222
## 2001-05-01 0.8364800 0.9966322 1.1616575 1.313385 57.02603 116.26010 87.99402
## 2001-06-01 0.5133378 0.8030990 1.0961887 1.264994 34.99619  93.68388 83.03485
## 2001-07-01 0.7656414 0.6823754 1.0390494 1.215078 52.19670  79.60112 78.70662
## 2001-08-01 0.6925900 0.6693732 1.0031511 1.175504 47.21650  78.08437 75.98738
## 2001-09-01 0.6613701 0.6591303 0.9738572 1.142503 45.08812  76.88950 73.76840
## 2001-10-01 0.6764769 0.6491615 0.9499872 1.118483 46.11801  75.72662 71.96028
## 2001-11-01 0.8738718 0.6831155 0.9343324 1.100280 59.57517  79.68745 70.77445
## 2001-12-01 0.9705633 0.7379771 0.9247269 1.088244 66.16701  86.08722 70.04685
##                ML.4    MLTot      WTD        SWE PlantExt.1 PlantExt.2
## 2001-01-01 30.55108 318.5165 3527.671 1.65619239  0.3107699 0.10584971
## 2001-02-01 32.20065 326.1149 2892.994 0.27608905  0.4257649 0.18302904
## 2001-03-01 38.93267 346.0275 1442.375 0.01762496  0.5274848 0.21372334
## 2001-04-01 41.12122 316.9464 1533.997 0.58072652  0.5738724 0.26555735
## 2001-05-01 39.79487 301.0750 2009.791 0.00000000  0.7849142 0.37369599
## 2001-06-01 38.32865 250.0436 2443.470 0.00000000  0.4314077 1.02453452
## 2001-07-01 36.81622 247.3207 2831.893 0.00000000  1.0912392 0.44196116
## 2001-08-01 35.61715 236.9054 3112.869 0.00000000  1.2415305 0.44584250
## 2001-09-01 34.61723 230.3633 3289.235 0.00000000  0.7475436 0.29678978
## 2001-10-01 33.88946 227.6944 3408.751 0.00000000  0.6654072 0.23899722
## 2001-11-01 33.33790 243.3750 3453.192 2.60802857  0.4350331 0.08506037
## 2001-12-01 32.97322 255.2743 3547.373 0.00000000  0.4344285 0.07183331
##            PlantExt.3  PlantExt.4 HydraulicInput.1 HydraulicInput.2
## 2001-01-01 0.00790211 0.001323566     0.0000000000     0.0009078394
## 2001-02-01 0.01482812 0.001974889     0.0040863678     0.0000000000
## 2001-03-01 0.01817062 0.002651147     0.0025557012     0.0000000000
## 2001-04-01 0.02330108 0.003303651     0.0114274356     0.0000000000
## 2001-05-01 0.03309791 0.004654345     0.0161047209     0.0000000000
## 2001-06-01 0.09540695 0.013279718     0.2361219106     0.0000000000
## 2001-07-01 0.05721903 0.007986390     0.0364320601     0.0237801570
## 2001-08-01 0.05944333 0.008343092     0.0064505831     0.0095601568
## 2001-09-01 0.04482460 0.006351775     0.0130937990     0.0067742414
## 2001-10-01 0.04149792 0.005944168     0.0146298999     0.0176237997
## 2001-11-01 0.02014496 0.003044898     0.0005410576     0.0300372853
## 2001-12-01 0.01308325 0.002071392     0.0000000000     0.0343363641
##            HydraulicInput.3 HydraulicInput.4       psi.1       psi.2
## 2001-01-01     4.462574e-04     6.133280e-05 -0.01443443 -0.01922915
## 2001-02-01     1.807143e-06     9.403664e-06 -0.04186638 -0.01269843
## 2001-03-01     0.000000e+00     0.000000e+00 -0.02805572 -0.01280121
## 2001-04-01     0.000000e+00     0.000000e+00 -0.07239036 -0.02432175
## 2001-05-01     0.000000e+00     0.000000e+00 -0.09439304 -0.03454779
## 2001-06-01     0.000000e+00     0.000000e+00 -0.67400660 -0.10306132
## 2001-07-01     0.000000e+00     0.000000e+00 -0.16732646 -0.17428597
## 2001-08-01     0.000000e+00     0.000000e+00 -0.17818094 -0.18848524
## 2001-09-01     0.000000e+00     0.000000e+00 -0.21330640 -0.20113357
## 2001-10-01     0.000000e+00     0.000000e+00 -0.20698836 -0.21447867
## 2001-11-01     0.000000e+00     0.000000e+00 -0.10516637 -0.17395267
## 2001-12-01     0.000000e+00     0.000000e+00 -0.04150006 -0.12408594
##                   psi.3        psi.4
## 2001-01-01 -0.028551693 -0.031631695
## 2001-02-01 -0.014608972 -0.024255173
## 2001-03-01 -0.006816287 -0.006510372
## 2001-04-01 -0.010277381 -0.002736149
## 2001-05-01 -0.014998735 -0.005079222
## 2001-06-01 -0.021122407 -0.007843224
## 2001-07-01 -0.027579521 -0.010974675
## 2001-08-01 -0.032714627 -0.013829556
## 2001-09-01 -0.037528227 -0.016495166
## 2001-10-01 -0.041994892 -0.018646041
## 2001-11-01 -0.045158813 -0.020401926
## 2001-12-01 -0.047304584 -0.021645893

Parameter output is used to indicate the element of the spwb object for which we desire summaries. Similarly, it is possible to calculate the average stress of plant cohorts by months:

summary(S, freq="months",FUN=mean, output="PlantStress")
##                 T1_148      T2_168       S1_165
## 2001-01-01 0.001350138 0.009387634 0.0006800756
## 2001-02-01 0.004128992 0.021550111 0.0018234107
## 2001-03-01 0.005790954 0.028230231 0.0027351640
## 2001-04-01 0.007805622 0.035553090 0.0041181754
## 2001-05-01 0.010935626 0.043618759 0.0060356291
## 2001-06-01 0.036222284 0.089241676 0.0199718719
## 2001-07-01 0.043980093 0.104076386 0.0237846496
## 2001-08-01 0.044724909 0.105758381 0.0247523152
## 2001-09-01 0.039466634 0.094940612 0.0223564421
## 2001-10-01 0.038070203 0.090829313 0.0216198297
## 2001-11-01 0.035482727 0.082963657 0.0203128920
## 2001-12-01 0.035431447 0.082517986 0.0204097623

The summary function can be also used to aggregate the output by species. In this case, the values of plant cohorts belonging to the same species will be averaged using LAI values as weights. For example, we may average the daily drought stress across cohorts of the same species (here there is only one cohort by species, so this does not modify the output):

head(summary(S, freq="day", output="PlantStress", bySpecies = TRUE))
##            Pinus halepensis Quercus coccifera Quercus ilex
## 2001-01-01     0.0002331295      0.0001072831  0.002895831
## 2001-01-02     0.0008041126      0.0002485790  0.006536424
## 2001-01-03     0.0011929996      0.0003735271  0.008731344
## 2001-01-04     0.0008679062      0.0002814782  0.008365780
## 2001-01-05     0.0012413979      0.0004017631  0.009116606
## 2001-01-06     0.0011967864      0.0003658900  0.008517169

Or we can combine the aggregation by species with a temporal aggregation (here monthly averages):

summary(S, freq="month", FUN = mean, output="PlantStress", bySpecies = TRUE)
##            Pinus halepensis Quercus coccifera Quercus ilex
## 2001-01-01      0.001350138      0.0006800756  0.009387634
## 2001-02-01      0.004128992      0.0018234107  0.021550111
## 2001-03-01      0.005790954      0.0027351640  0.028230231
## 2001-04-01      0.007805622      0.0041181754  0.035553090
## 2001-05-01      0.010935626      0.0060356291  0.043618759
## 2001-06-01      0.036222284      0.0199718719  0.089241676
## 2001-07-01      0.043980093      0.0237846496  0.104076386
## 2001-08-01      0.044724909      0.0247523152  0.105758381
## 2001-09-01      0.039466634      0.0223564421  0.094940612
## 2001-10-01      0.038070203      0.0216198297  0.090829313
## 2001-11-01      0.035482727      0.0203128920  0.082963657
## 2001-12-01      0.035431447      0.0204097623  0.082517986

References

  • De Cáceres M, Mencuccini M, Martin-StPaul N, Limousin JM, Coll L, Poyatos R, Cabon A, Granda V, Forner A, Valladares F, Martínez-Vilalta J (2021) Unravelling the effect of species mixing on water use and drought stress in holm oak forests: a modelling approach. Agricultural and Forest Meteorology 296 (https://doi.org/10.1016/j.agrformet.2020.108233).

  • Ruffault J, Pimont F, Cochard H, Dupuy JL, Martin-StPaul N (2022) SurEau-Ecos v2.0: a trait-based plant hydraulics model for simulations of plant water status and drought-induced mortality at the ecosystem level. Geoscientific Model Development 15, 5593-5626 (https://doi.org/10.5194/gmd-15-5593-2022).