swrc_conversion: Conversion between bulk soil water content and soil water...

View source: R/sw_Pedotransfer_Functions.R

swrc_conversionR Documentation

Conversion between bulk soil water content and soil water potential

Description

Conversion between bulk soil water content and soil water potential

Usage

swrc_conversion(
  direction = c("swp_to_vwc", "vwc_to_swp"),
  x,
  fcoarse,
  layer_width,
  swrc,
  sand = NULL,
  clay = NULL,
  bdensity = NULL,
  outer_if_equalsize = FALSE,
  verbose = FALSE
)

swrc_swp_to_vwc(
  swp_MPa,
  fcoarse,
  layer_width,
  swrc = list(swrc_name = NULL, ptf_name = NULL, swrcp = NULL),
  sand = NULL,
  clay = NULL,
  bdensity = NULL,
  outer_if_equalsize = FALSE,
  verbose = FALSE
)

swrc_vwc_to_swp(
  vwcBulk,
  fcoarse,
  layer_width,
  swrc = list(swrc_name = NULL, ptf_name = NULL, swrcp = NULL),
  sand = NULL,
  clay = NULL,
  bdensity = NULL,
  outer_if_equalsize = FALSE,
  verbose = FALSE
)

Arguments

direction

A character string. Indicates the direction of soil water conversion.

x

A numeric value, vector, or matrix. The soil water values to be converted, either soil water potential (units ⁠[MPa]⁠) of the soil matric component or bulk volumetric water content (units ⁠[cm/cm]⁠).

fcoarse

A numeric value or vector. Coarse fragments, e.g., gravel, (> 2 mm; units of ⁠[m3/m3]⁠) relative to the whole soil of each soil layer. fcoarse is required, for instance, to translate between values relative to the matric soil component (< 2 mm fraction) and relative to the whole soil (matric soil plus coarse fragments).

layer_width

A numeric value or vector. Depth interval, width, of each soil layer (units of cm). layer_width is required to translate between soil water content of a soil layer and volumetric water content.

swrc

A named list. Contains all necessary elements of a SWRC, i.e., name (short for swrc_name) and swrcp, or all necessary elements to estimate parameters of a SWRC given soil parameters, i.e., swrc_name and ptf_name.

sand

A numeric value or vector. Sand content of the matric soil component (< 2 mm fraction; units of ⁠[g/g]⁠) of each soil layer.

clay

A numeric value or vector. Clay content of the matric soil component (< 2 mm fraction; units of ⁠[g/g]⁠) of each soil layer.

bdensity

A numeric value or vector. Density of the whole soil (matric soil plus coarse fragments; units ⁠[g/cm3]⁠).

outer_if_equalsize

A logical value. Relevant only if x of length l and soils of length d are equal. If TRUE, then the returned object has a size of ⁠l x d⁠ = ⁠l x l⁠ where the d sets of soil values are repeated for each value of x. If FALSE (default), then the returned object has a size of l = d where the the SWRC conversion is applied to the first element of x and soils, the second elements, and so on.

verbose

A logical value. If TRUE, then display SOILWAT2 internal warnings and other messages.

swp_MPa

A numeric object. The soil water potential values (units ⁠[MPa]⁠) of the soil matric component to be converted to bulk volumetric water content (i.e., relative to the whole soil; units ⁠[cm/cm]⁠).

vwcBulk

A numeric object. The volumetric water content values (relative to the whole soil; units ⁠[cm/cm]⁠) to be converted to soil water potential (units ⁠[MPa]⁠) of the soil matric component.

Value

The dimensions of the output are a function of x and the number of soil values (e.g., rows or length of swrc[["swrcp"]]). The returned object has:

  • length l if both x and soils are of length l.

  • length l if x has length l and there is one soil.

  • length d if x is one value and soils are of length d.

  • size ⁠l x d⁠ if x has length l and soils are of length d (if l and d are not equal or outer_if_equalsize is TRUE; cf. the first case); the d sets of soil values are repeated for each value of x.

  • size ⁠l x d⁠ if x has size ⁠l x d⁠ and there is one soil. the soil is repeated for each value of x.

  • size ⁠l x d⁠ if x has size ⁠l x d⁠ and soils are of length d the d sets of soil values are repeated for each row of x.

Functions

  • swrc_swp_to_vwc(): Convenience wrapper to convert from SWP to bulk VWC with selected SWRC

  • swrc_vwc_to_swp(): Convenience wrapper to convert from bulk VWC to matric SWP with selected SWRC

Details

swrc_names() lists implemented SWRCs; ptf_names() lists implemented PTFs; and check_ptf_availability() checks availability of PTFs.

For backward compatibility, fcoarse and layer_width may be missing. If they are missing, then the soils are assumed to contain ⁠0%⁠ coarse fragments and be represented by ⁠1 cm⁠ wide soil layers.

Arguments sand, clay, and bdensity are only required if SWRC parameter values need to be estimated on the fly, i.e., if swrc does not contain the element swrcp (with suitable SWRC parameter values). This is handled by ptf_estimate() and additionally requires the element ptf_name for argument swrc.

If swrc contains element swrcp with one set of SWRC parameters, i.e., one row, then the parameter set is repeated for each value of x.

If vwc inputs represent the matric component (instead of expected bulk values), then set fcoarse to 0. This works, however, only if swrcp are provided or fcoarse is not utilized by the requested PTF.

References

Cosby, B. J., G. M. Hornberger, R. B. Clapp, & T. R. Ginn. 1984. A statistical exploration of the relationships of soil moisture characteristics to the physical properties of soils. Water Resources Research, 20:682-690, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1029/WR020i006p00682")}

See Also

ptf_estimate(), check_swrcp(), check_ptf_availability()

Examples

fsand <- c(0.5, 0.3)
fclay <- c(0.2, 0.1)
fcrs1 <- c(0, 0)
fcrs2 <- c(0.4, 0.1)

swrc1 <- list(
  name = "Campbell1974",
  swrcp = ptf_estimate(
    sand = fsand,
    clay = fclay,
    fcoarse = fcrs1,
    swrc_name = "Campbell1974",
    ptf_name = "Cosby1984"
  )
)
swrc_swp_to_vwc(-1.5, fcoarse = fcrs1, swrc = swrc1)
swrc_swp_to_vwc(c(-1.5, NA), fcoarse = fcrs1, swrc = swrc1)
swrc_swp_to_vwc(-1.5, fcoarse = fcrs1, sand = fsand, clay = fclay)
swrc_vwc_to_swp(c(0.10, 0.15, 0.20), fcoarse = fcrs1, swrc = swrc1)
swrc_vwc_to_swp(c(0.10, NA, 0.20), fcoarse = fcrs1, swrc = swrc1)

swrc2 <- list(
  name = "Campbell1974",
  swrcp = ptf_estimate(
    sand = fsand,
    clay = fclay,
    fcoarse = fcrs2,
    swrc_name = "Campbell1974",
    ptf_name = "Cosby1984"
  )
)
swrc_swp_to_vwc(-1.5, fcoarse = fcrs2, swrc = swrc2)
(1 - fcrs2) * swrc_swp_to_vwc(-1.5, swrc = swrc2)
swrc_swp_to_vwc(-1.5, fcoarse = fcrs2, sand = fsand, clay = fclay)
swrc_vwc_to_swp(c(0.10, 0.15, 0.20), fcoarse = fcrs2, swrc = swrc2)


# Available water holding capacity "AWC"
soils <- swSoils_Layers(rSOILWAT2::sw_exampleData)
p <- ptf_estimate(
  sand = soils[, "sand_frac"],
  clay = soils[, "clay_frac"],
  fcoarse = soils[, "gravel_content"]
)
tmp <- swrc_swp_to_vwc(
  c(-1.5, -0.033),
  fcoarse = soils[, "gravel_content"],
  swrc = list(name = "Campbell1974", swrcp = p)
)
awc <- diff(c(0, soils[, "depth_cm"])) * as.vector(diff(tmp))


# Shape of SWRCs
theta <- seq(0.05, 0.55, by = 0.001)
soils <- data.frame(
  sand_frac = c(sand = 0.92, silty_loam = 0.17, silty_clay = 0.06),
  clay_frac = c(0.03, 0.13, 0.58),
  bd = c(1.614, 1.464, 1.437)
)
phi <- list(
  Campbell1974 = swrc_vwc_to_swp(
    theta,
    sand = soils[, "sand_frac"],
    clay = soils[, "clay_frac"],
    swrc = list(swrc_name = "Campbell1974", ptf_name = "Cosby1984")
  )
)

if (check_ptf_availability("Rosetta3")) {
  phi[["vanGenuchten1980"]] <- swrc_vwc_to_swp(
    theta,
    sand = soils[, "sand_frac"],
    clay = soils[, "clay_frac"],
    bdensity = soils[, "bd"],
    swrc = list(swrc_name = "vanGenuchten1980", ptf_name = "Rosetta3")
  )
}

# Use PTF "neuroFX2021" to estimate parameters of SWRC `FXW`
## Not run: 
# Set neuroFX2021 file path, see details in `ptf_neuroFX2021_for_FXW()`
options(RSW2_FILENEUROFX2021 = "path/to/sscbd.RData")

## End(Not run)

if (check_ptf_availability("neuroFX2021")) {
  phi[["FXW"]] <- swrc_vwc_to_swp(
    theta,
    sand = soils[, "sand_frac"],
    clay = soils[, "clay_frac"],
    bdensity = soils[, "bd"],
    swrc = list(swrc_name = "FXW", ptf_name = "neuroFX2021")
  )
}

if (interactive() && requireNamespace("graphics")) {
  par_prev <- graphics::par(mfcol = c(length(phi), 1))

  for (k in seq_along(phi)) {
    graphics::matplot(
      theta, -phi[[k]],
      type = "l",
      log = "y",
      xlim = c(0, max(theta)),
      xlab = "theta [m/m]",
      ylim = c(1e-4, 1e6),
      ylab = "-phi [MPa]",
      main = paste0("Soil Water Retention Curve (", names(phi)[k], ")")
    )
    graphics::abline(h = -c(-1.5, -0.033), col = "gray", lty = 3)
    graphics::legend("topright", rownames(soils), col = 1:3, lty = 1:3)
  }

  graphics::par(par_prev)
}



Burke-Lauenroth-Lab/Rsoilwat documentation built on Dec. 9, 2023, 12:41 a.m.