runonestep: Run canopy model for a single time step

View source: R/code.R

runonestepR Documentation

Run canopy model for a single time step

Description

run the above or below-canopy model for a single timestep

Usage

runonestep(
  climvars,
  previn,
  vegp,
  soilp,
  timestep,
  tme,
  lat,
  long,
  edgedist = 1000,
  sdepth = 2,
  reqhgt = NA,
  zu = 2,
  theta = 0.3,
  thetap = 0.3,
  merid = 0,
  dst = 0,
  n = 0.6,
  metopen = TRUE,
  windhgt = 2,
  zlafact = 1,
  surfwet = 1
)

Arguments

climvars

a of climate variables needed to run the run the model for one timestep (see dataset climvars())

previn

a list of model outputs form the previous timestep as returned initially by paraminit()

vegp

a list of vegetation parameters as returned by microctools::habitatvars()

soilp

a list of soil parameters as returned by soilinit()

timestep

length of model timestep (s)

tme

POSIXlt object of the date and time of the current time step

lat

latitude of location (decimal degrees)

long

lonitude of location (decimal degrees)

edgedist

distance to open ground (m)

sdepth

depth of deepest soil node (m)

reqhgt

optional height for which temperature is required (see details)

zu

height above ground of reference climate measurements (m)

theta

volumetric water content of upper most soil layer in current time step (m^3 / m^3)

thetap

volumetric water content of upper most soil layer in previous time step (m^3 / m^3)

merid

an optional numeric value representing the longitude (decimal degrees) of the local time zone meridian (0 for GMT).

dst

an optional numeric value representing the time difference from the timezone meridian (hours, e.g. +1 for BST if merid = 0).

n

forward / backward weighting for Thomas algorithm (see Thomas())

metopen

optional logical indicating whether the wind measurement used as an input to the model is from a nearby weather station located in open ground (TRUE) or above the canopy for which temperatures are modelled (FALSE - see details)

windhgt

height above ground of wind measurement. If metopen is FALSE, must be above canopy.

zlafact

numeric value indicating how close to leaves air temperatures are needed for (1 - average leaf-air distance, 0.5 = half average leaf-air distance etc.). Must be greater than 1.

surfwet

fraction of vegetation surface acting like a free-water surface

Details

model outputs are returned for each canopy node, with the number of canopy nodes (m) determined by previn. Canopy nodes are spaced at equal heights throughout the canopy as in the example. If reqhgt is set, and below the height of the canopy, the node nearest to that height is set at the value specified. The returned value tabove is then the temperature at te top of the canopy. If reqhgt is above canopy, nodes are calculated automatically, but tabove is the temperature at height reqhgt. If temperatures below ground are needed, the depth can be set using soilinit(). The wind profile of the canopy depends on the nature of the canopy itself, and often available wind measurements are for a nearby weather station located in open ground where it is possible that the height of the wind measurement is below the height of the canopy being studied. When metopen is TRUE, the wind profile of reference grass surface is used to derive estimates for two metres above the canopy of interest. When metopen is FALSE, windhgt must be above canopy and the profile above the canopy being studied is used.

Value

a list of of model outputs for the current timestep with the same format as previn

Examples

# Create initail parameters
tme <- as.POSIXlt(0, origin = "2020-05-04 12:00", tz = "GMT")
previn <- paraminit(20, 10, 10, 15, 2, 80, 11, 500)
vegp <- microctools::habitatvars(4, 50, -5, tme, m = 20)
z<-c((1:20)-0.5)/20*vegp$hgt
soilp<- soilinit("Loam")
climvars <- list(tair=16,relhum=90,pk=101.3,u=2.1,tsoil=11,skyem=0.9,Rsw=500,dp=NA)
# Run model 100 times for current time step
for (i in 1:100) {
  plot(z ~ previn$tc, type = "l", xlab = "Temperature", ylab = "Height", main = i)
  previn <- runonestep(climvars, previn, vegp, soilp, 60, tme, 50, -5)
}

ilyamaclean/microclimc documentation built on July 28, 2023, 1:40 a.m.