Package 'soilwatR'

Title: Simulation of Soil Water Flow Based on Darcy's Law
Description: Provides a simple model to simulate soil water content and water flux changes at multiple soil depths. Calculations mainly follow Allen et al. (1998, ISBN:92-5-104219-5) and Teh (2017, ISBN:9789673447626).
Authors: Minguo Liu [aut, cre]
Maintainer: Minguo Liu <[email protected]>
License: GPL (>= 3)
Version: 0.1.1
Built: 2026-10-24 18:25:45 UTC
Source: https://github.com/cran/soilwatR

Help Index


Calculating actual vapour pressure derived from RHmean

Description

In the absence of RH max and RHmin, it can be used to estimate actual vapour pressure.

Usage

cal_ActualVapourPressure_from_RHmean(RHmean, Tmax, Tmin)

Arguments

RHmean

mean relative humidity(%).

Tmax

daily maximum temperature (degrees Celsius).

Tmin

daily minimum temperature (degrees Celsius).

Value

A vector of actual vapour pressure

References

FAO Irrigation and drainage paper 56 (P39)


Calculating atmospheric pressure

Description

The atmospheric pressure, P, is the pressure exerted by the weight of the earth's atmosphere.

Usage

cal_atmosphericPressure(elevation)

Arguments

elevation

elevation above sea level (m)

Details

Assuming 20°C for a standard atmosphere. Evaporation at high altitudes is promoted due to low atmospheric pressure as expressed in thepsychrometric constant. The effect is, however, small and in the calculation procedures, the average value for a location is sufficient.

Value

A vector of atmospheric pressure (Kpa)

References

FAO Irrigation and drainage paper 56 (P31)


Calculating reference evapotranspiration from Penman-Monteith for daily

Description

Based on lat, z, J, Tmax, Tmin, n, RHmax, RHmin, windSpeed parameters, reference evapotranspiration was calculated by Penman-Monteith.

Usage

cal_ET0(Latitude, Altitude, J, Tmax, Tmin, Rs, RHmean, Wind)

Arguments

Latitude

latitude (radian), positive for the northern hemisphere and negative for the southern hemisphere.

Altitude

station elevation above sea level [m].

J

is the number of the day in the year between 1 (1 January) and 365 or 366 (31 December).

Tmax

daily maximum air temperature (degrees Celsius).

Tmin

daily minimum air temperature (degrees Celsius).

Rs

Solar radiation [MJ m-2 d-1].

RHmean

daily mean relative humidity %.

Wind

wind speed at 2 m height [m s-1].

Value

A vector of reference evapotranspiration (mm/day)


calculating reference evapotranspiration from Penman-Monteith method

Description

The FAO Penman-Monteith method is maintained as the sole standard method for the computation of ETo from meteorological data.

Usage

cal_ET0_from_PM(delta, Rn, G, gamma, Tem, u2, es, ea)

Arguments

delta

slope vapour pressure curve (kPa &deg;C). From cal_slopeOfSaturationVapourPressureCurve()

Rn

net Radiation at the crop surface [MJ m-2 day-1]. From cal_netRadiation()

G

soil heat flux density [MJ m-2 day-1].

gamma

psychrometric constant (kPa &deg;C).

Tem

air temperature at 2 m height [&deg;C].

u2

wind speed at 2 m height [m s-1].

es

saturation vapour pressure [kPa].

ea

actual vapour pressure [kPa].

Value

A vector of reference evapotranspiration [mm day-1].

Note

Ten-day or monthly time step :

Notwithstanding the non-linearity in the Penman-Monteith equation and some weather parameter methods, mean ten-day or monthly weather data can be used to compute the mean ten-day or monthly values for the reference evapotranspiration. The value of the reference evapotranspiration calculated with mean monthly weather data is indeed very similar to the average of the daily ETo values calculated with daily average weather data for that month.

When the soil is warming (spring) or cooling (autumn), the soil heat flux (G) for monthly periods may become significant relative to the mean monthly Rn. In these cases G cannot be ignored and its value should be determined from the mean monthly air temperatures of the previous and next month.

Daily time step:

Calculation of ETo with the Penman-Monteith equation on 24-hour time scales will generally provide accurate results.

As the magnitude of daily soil heat flux (G) beneath the reference grass surface is relatively small, it may be ignored for 24-hour time steps.

References

FAO Irrigation and drainage paper 56 (P65)


Calculating extraterrestrial radiation for daily periods

Description

The extraterrestrial radiation, Ra, for each day of the year and for different latitudes can be estimated from the solar constant, the solar declination and the time of the year.

Usage

cal_extraterrestrialRadiation_for_daily(J, lat)

Arguments

J

is the number of the day in the year between 1 (1 January) and 365 or 366 (31 December).

lat

latitude (radian), positive for the northern hemisphere and negative for the southern hemisphere.

Value

A vector of extraterrestrial radiation for daily(MJ m-2 day-1)

References

FAO Irrigation and drainage paper 56 (P45-47)


calculating field capacity

Description

calculating field capacity

Usage

cal_FC(Sand_frac, Clay_frac, OM)

Arguments

Sand_frac

Sand fraction

Clay_frac

Clay fraction

OM

Organic matter content percentage

Value

A vector of field capacity


Calculating inverse relative distance Earth-sun

Description

Calculating inverse relative distance Earth-sun

Usage

cal_inverseRelativeDistance_Earth_sun(J)

Arguments

J

is the number of the day in the year between 1 (1 January) and 365 or 366 (31 December).

Value

A vector of inverse relative distance Earth-sun (radian)

References

FAO Irrigation and drainage paper 56 (P46)


Crop coefficient for the end of the late season stage

Description

Typical values for the crop coefficient at the end of the late season growth stage, Kc end, are listed in Table 12 for various agricultural crops.

Usage

cal_Kcend_for_singleKc(RHmine, u2e, Ktable, he)

Arguments

RHmine

mean value for daily minimum relative humidity during the mid-season growth stage , for 20 <= RHmine<= 80

u2e

mean value for daily wind speed at 2 m height over grass during the mid- season growth stage (m/s), for 1 <= u2e <= 6

Ktable

value for Kc mid taken from Table 12

he

mean plant height during the mid-season stage (m) for 0.1 m < h < 10 m

Value

A vector for the K value of the late season stage

Note

only applied when the tabulated values for Kc end exceed 0.45. The equation reduces the Kc end with increasing RHmin. This reduction in Kc end is characteristic of crops that are harvested 'green' or before becoming completely dead and dry (Kc end >= 0.45).

No adjustment is made when Kc end (Table) < 0.45 (Kc end = Kc end (Tab)). When crops are allowed to senesce and dry in the field (as evidenced by Kc end < 0.45), u2 and RHmin have less effect on Kc end and no adjustment is necessary.

References

FAO Irrigation and drainage paper 56 (P125-126)


Calculating Kcini value

Description

Calculating Kcini value

Usage

cal_Kcini_for_SingleKc(Pmean, ET0, tw, type, fw)

Arguments

Pmean

is the average depth od infiltrated water per wetting events(mm)

ET0

mean ET0 during initial period(mm/day)

tw

is the mean interval between wetting events(days)

type

soil type:"coarse soil textures" and "medium and fine soil textures"

fw

the fraction of surfaces wetted by irrigation or rain (0-1)

Value

A vector for the K value of initial stage

References

FAO Irrigation and drainage paper 56 (P263-269)


Crop coefficient for the mid-season stage

Description

Typical values for the crop coefficient at the end of the late season growth stage, Kc end, are listed in Table 12 for various agricultural crops.For specific adjustment in climates where RHmin differs from 45 % or where u2 is larger or smaller than 2.0 m/s.

Usage

cal_Kcmid_for_singleKc(RHmine, u2e, Ktable, he)

Arguments

RHmine

mean value for daily minimum relative humidity during the mid-season growth stage , for 20 <= RHmine <= 80

u2e

mean value for daily wind speed at 2 m height over grass during the mid- season growth stage (mls), for 1 <= u2e <= 6

Ktable

value for Kc mid taken from Table 12

he

mean plant height during the mid-season stage [m] for 0.1 m < h < 10 m

Value

A vector for the K value of the mid-season stage

References

FAO Irrigation and drainage paper 56 (P122-123)


Calculating mean saturation vapour pressure

Description

Due to the non-linearity of the above equation, the mean saturation vapour pressure for a day, week, decade or month should be computed as the mean between the saturation vapour pressure at the mean daily maximum and minimum air temperatures for that period.

Usage

cal_meanSaturationVapourPressure(Tmax, Tmin)

Arguments

Tmax

the daily maximum air temperature(degrees Celsius).

Tmin

the daily minimum air temperature(degrees Celsius).

Details

Using mean air temperature instead of daily minimum and maximum temperatures results in lower estimates for the mean saturation vapour pressure. The corresponding vapour pressure deficit (a parameter expressing the evaporating power of the atmosphere) will also be smaller and the result will be some underestimation of the reference crop evapotranspiration. Therefore,the mean sauration vapour pressure should be calculated as the mean between the saturation vapour pressure at both the daily maximum and minimum air temperature.

Value

A vector of mean saturation vapour pressure (es)

References

FAO Irrigation and drainage paper 56 (P36)


Calculating net longwave radiation Rnl

Description

Calculating net longwave radiation Rnl

Usage

cal_netLongwaveRadiation(TKmax, TKmin, ea, Rs, Rso)

Arguments

TKmax

maximum absolute temperature during the 24-hour period [K].

TKmin

minimum absolute temperature during the 24-hour period [K].

ea

actual vapour pressure [kPa].

Rs

measured or calculated solar radiation [MJ m-2 day-1]. From cal_solarRadiation().

Rso

calculated clear-sky radiation [MJ m-2 day-1]. From cal_skySolarRadiation_withas_bs() or cal_skySolarRadiation_withas_elevation().

Value

A vector of net outgoing longwave radiation [MJ m-2 day-1]

Note

The rate of longwave energy emission is proportional to the absolute temperature of the surface raised to the fourth power. This relation is expressed quantitatively by the Stefan-Boltzmann law. The net energy flux leaving the earth's surface is, however, less than that emitted and given by the Stefan-Boltzmann law due to the absorption and downward radiation from the sky. Water vapour, clouds, carbon dioxide and dust are absorbers and emitters of longwave radiation. Their concentrations should be known when assessing the net outgoing flux. As humidity and cloudiness play an important role, the Stefan-Boltzmann law is corrected by these two factors when estimating the net outgoing flux of longwave radiation. It is thereby assumed that the concentrations of the other absorbers are constant. An average of the maximum air temperature to the fourth power and the minimum air temperature to the fourth power is commonly used in the Stefan-Boltzmann equation for 24-hour time steps. The term (0.34-0.14*sqrt(ea)) expresses the correction for air humidity, and will be smaller if the humidity increases. The effect of cloudiness is expressed by (1.35 Rs/Rso - 0.35). The term becomes smaller if the cloudiness increases and hence Rs decreases. The smaller the correction terms, the smaller the net outgoing flux of longwave radiation. Note that the Rs/Rso term in Equation 39 must be limited so that Rs/Rso <= 1.0. Where measurements of incoming and outgoing short and longwave radiation during bright sunny and overcast hours are available, calibration of the coefficients in Equation 39 can be carried out.

References

FAO Irrigation and drainage paper 56 (P51-52)


Calculating net radiation Rn

Description

The net radiation (Rn) is the difference between the incoming net shortwave radiation (Rns) and the outgoing net longwave radiation (Rnl).

Usage

cal_netRadiation(Rns, Rnl)

Arguments

Rns

incoming net shortwave radiation. From cal_netSolarRadiation().

Rnl

outgoing net longwave radiation. From cal_netLongwaveRadiation().

Value

A vector of net radiation


calculating the net rain

Description

calculating the net rain

Usage

cal_netRain(lai, rain)

Arguments

lai

leaf area index m2 m-2

rain

rain mm

Value

A vector of net rain (mm)


Calculating net solar (shortware radiation) Rns

Description

The net shortwave radiation resulting from the balance between incoming and reflected solar radiation.

Usage

cal_netSolarRadiation(alpha, Rs)

Arguments

alpha

albedo or canopy reflection coefficient, which is 0.23 for the hypothetical grass reference crop [dimensionless].

Rs

the incoming solar radiation [MJ m-2 day-1]. From cal_solarRadiation()

Value

A vector of net solar or shortwave radiation [MJ m-2 day-1].

References

FAO Irrigation and drainage paper 56 (P51)


Calculation of potential evaporation and potential transpiration

Description

This function calculates the potential evapotranspiration according to the single crop coefficient method, and then converts the potential evapotranspiration into potential evaporation and potential transpiration based on LAI

Usage

cal_PET(data, Kc_mid, Kc_end, fw, soil_type)

Arguments

data

A data frame.

Kc_mid

value for Kc mid

Kc_end

value for Kc end

fw

the fraction of surfaces wetted by irrigation or rain (0-1)

soil_type

soil type:"coarse soil textures" and "medium and fine soil textures"

Value

A data frame including the potential evaporation and potential transpiration

Note

The stages of data should include all four stages. If a crop has multiple growth cycles, each cycle should include all four stages.


Calculating psychrometric constant

Description

Calculating psychrometric constant

Usage

cal_psychrometriCconstant(atmospheric_pressure)

Arguments

atmospheric_pressure

atmospheric pressure (kPa).

Value

A vector of psychrometric constant (kPa/degree Celsius)

References

FAO Irrigation and drainage paper 56 (P32)


calculating reduction rate for Potential transpiration

Description

calculating reduction rate for Potential transpiration

Usage

cal_Red_PETc(C3, vwc_root, pwp_root, sat_root)

Arguments

C3

Judge whether it is a C3 plant. If not, it is C4

vwc_root

Current volume moisture content of root zone

pwp_root

Volume moisture content of wilting point in root zone

sat_root

Saturated volume moisture content of root zone

Value

A vector for the reduction rate of transpiration


calculating reduction rate for Potential evaporation

Description

calculating reduction rate for Potential evaporation

Usage

cal_Red_PETs(vwc1, sat1)

Arguments

vwc1

Volumetric moisture content of topsoil fraction

sat1

Saturated volume moisture content of topsoil fraction

Value

A vector for the reduction rate of evaporation


calculating Soil saturated water content

Description

calculating Soil saturated water content

Usage

cal_Sat(Sand_frac, Clay_frac, OM, THETA_33)

Arguments

Sand_frac

Sand fraction

Clay_frac

Clay fraction

OM

Organic matter content percentage

THETA_33

wilting point from cal_FC function

Value

A vector of Soil saturated water content


Calculating saturation vapour pressure

Description

saturation vapour pressure at the air temperature T.

Usage

cal_saturationVapourPressure(Tem)

Arguments

Tem

air temperature (degrees Celsius).

Value

A vector of saturation vapour pressure at the air temperature T (kPa).

References

FAO Irrigation and drainage paper 56 (P36)


Calculating clear sky solar radiation with elevation

Description

The calculation of the clear-sky radiation, Rso, when n = N, is required for computing net longwave radiation.

Usage

cal_skySolarRadiation_withas_elevation(z, Ra)

Arguments

z

station elevation above sea level [m].

Ra

extraterrestrial radiation [MJ m-2 day-1]. From cal_extraterrestrialRadiation_for_daily()

Value

A vector of clear-sky solar radiation [MJ m-2 day-1].

References

FAO Irrigation and drainage paper 56 (P51)


Calculating slope of saturation vapour pressure curve

Description

Calculating slope of saturation vapour pressure curve

Usage

cal_slopeOfSaturationVapourPressureCurve(Tem)

Arguments

Tem

is air temperature (degrees Celsius).

Details

In the FAO Penman-Monteith equation, where it occurs in the numerator and denominator, the slope of the vapour pressure curve is calculated using mean air temperature.

Value

A vector for slope of saturation vapour pressure curve at air temperature T

References

FAO Irrigation and drainage paper 56 (P3)


Calculating solar declination with FAO56 method

Description

Calculating solar declination with FAO56 method

Usage

cal_solarDeclination_in_FAO(J)

Arguments

J

is the number of the day in the year between 1 (1 January) and 365 or 366 (31 December)

Value

A vector of solar declination (radian)

References

FAO Irrigation and drainage paper 56 (P46)


Calculating sunset hour angle

Description

Calculating sunset hour angle

Usage

cal_sunsetHourAngle(lat, solar_declination)

Arguments

lat

latitude (radian), positive for the northern hemisphere and negative for the southern hemisphere.

solar_declination

solar declination(radina).

Value

A vector of sunset Hour Angle(radian)

References

FAO Irrigation and drainage paper 56 (P46)


calculating wilting point

Description

calculating wilting point

Usage

cal_WP(Sand_frac, Clay_frac, OM)

Arguments

Sand_frac

Sand fraction

Clay_frac

Clay fraction

OM

Organic matter content percentage

Value

A vector of wilting point


Converting angert to radian

Description

Converting the unit of angle in longitude and latitude into the unit of radian.

Usage

convert_angert_to_radian(anger)

Arguments

anger

Longitude or latitude in angle.

Value

A vector of longitude or latitude in radian


Convert degrees Celsius to Fahrenheit

Description

Convert degrees Celsius to Fahrenheit

Usage

convert_degreesCelsius_to_Fahrenheit(degrees_Celsius)

Arguments

degrees_Celsius

temperature in degrees Celsius(°C).

Value

A vector of temperature in Fahrenheit(°F)

References

FAO56


linear interpolation for vector

Description

Linear interpolation is performed by using the values on both sides of the missing values.

Usage

linear_interpolation(DataVector)

Arguments

DataVector

data vector.Note that the starting value of vector needs to be no missing value.

Value

A vector


Graphically display the output results of the model

Description

Graphically display the output results of the model

Usage

plot_result(Result)

Arguments

Result

The output result of the soilwatr function

Value

A combined plot if ggpubr is installed; otherwise a list of ggplot objects.


A example dataset of alfalfa under flood irrigation

Description

teh data including Input data, soilProfileSet data and obs data. Input data is a form of data frame includes daily upper boundary layer data of two irrigation treatments. The soilProfileSet is a matrix data that stores the soil profile setting information. Obs is the measured change of soil water content at different soil depths.

Usage

SIalfalfa

Format

A list with 3 data.


Simulation of soil water flow in different soil layers

Description

Simulation of soil water flow in different soil layers

Usage

soilwatr(data, param, soilProfileSet, verbose = FALSE)

Arguments

data

A data frame. The model input data, including Day, rain_mm, lai, T_mm, E_mm.

param

A list. Input parameters of the model.

soilProfileSet

A matrix. Definition of soil profile and its physical characteristics.

verbose

Logical; if TRUE, print progress for each simulated day.

Value

A matrix of simulated results.

Examples

data(SIalfalfa)
param <- list(
  initialRootingDepth = 1.2,
  RootGrowthRate = 0.0035,
  has_watertable = FALSE,
  subintervals = 20,
  maxsteps = 5
)
SIalfalfa_T1 <- SIalfalfa$Input[SIalfalfa$Input$Tre2 == "T1", ]
soilProfileSet_T1 <- SIalfalfa$soilProfileSet
soilProfileSet_T1["THETA_v_curr", ] <- c(0.12, 0.13, 0.28, 0.31, NA)
SI_T1_result <- soilwatr(
  data = SIalfalfa_T1,
  param = param,
  soilProfileSet = soilProfileSet_T1
)
head(SI_T1_result)