runmodel: Runs the microclimate model over time

View source: R/code.R

runmodelR Documentation

Runs the microclimate model over time

Description

runmodel is used to run the full model over time

Usage

runmodel(
  climdata,
  vegp,
  soilp,
  lat,
  long,
  edgedist = 100,
  reqhgt = NA,
  sdepth = 2,
  zu = 2,
  theta = 0.3,
  merid = 0,
  dst = 0,
  n = 0.6,
  steps = 200,
  plotout = TRUE,
  plotsteps = 100,
  tsoil = NA,
  metopen = TRUE,
  windhgt = 2,
  zlafact = 1,
  surfwet = 1,
  previn = NA,
  snow = NA
)

Arguments

climdata

a data.frame of climate variables (see e.g. weather)

vegp

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

soilp

a list of soil parameters as returned by soilinit()

lat

Latitude (decimal degrees)

long

Longitude (decimal degrees, negative west of Greenwich meridion)

edgedist

distance to open ground (m)

reqhgt

optional height for which temperature is required (see details)

sdepth

depth of deepest soil node (m)

zu

height above ground of reference climate measurements (m)

theta

a single numeric value, vector of values or matrix of volumetric water content (m^3 / m^3) of soil layer(s) (see details)

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())

steps

number of iterations over which to run spinup()

plotout

optional logical indicating whether to a plot a profile of temperatures upon completion.

plotsteps

number of iterations run before resuls plotted if plotout set to TRUE

tsoil

optional stable temperature of the deepest soil layer (see details)

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 free-water surface

previn

optional initial conditions as returned by runonestep(). If NA spinup() is evoked.

snow

optional vector indicating whether snow is present in each hour (1 = yes, 0 = no). if NA snow is assumed not present.

Details

If reqhgt is set to a numeric value, and below the height of the canopy, the canopy node nearest to that height is set at the value specified. The returned values tout, tleaf, relhum, L and Swin and Lwin are then the values at that height. If reqhgt is above canopy, nodes are calculated automatically, and tout and relhum are the temperature and relative humidity at height reqhgt, SWin and LWin the values above canopy, tleaf the mean leaf temperature and L the summed latent heat exchange for the entire canopy. If reqhgt is negative, the soil node nearest to that height is set at the value specified, tout is soil temperature at that node, tleaf, relhum, Swin and Lwin are the mean values for the whole canopy. If reqhgt is not set, tout, tleaf, relhum, SWin and LWin are mean values for the whole canopy. The parameter tsoil is the temperature of soil below sdepth, which is assumed constant. If tsoil is not provided, it is assigned a value equivelent to mean of climdata$temp. If reqhgt is set to allclim a list of data.frames is returned, giving temperatures, humidities and wind speeds at each node. If If reqhgt is set to all data.frames of fluxes and conductivities are also returned.

If theta is a single numeric value, constant soil moisture in each soil layer and in each time step is assumed. If theta is a vector of values of length number of soil layers, time-invariant soilmoisture is assumed, but soil moisture is assumed to vary with depth. If theta is a vector of values of length equivelent to the number of time steps over which the model is to be run, then time-variant soilmoisture is assumed, but soil moisture is assumed not to vary with depth. If theta is a matrix, the number of rows should be equivelent to the number of soil layers, and the number of columns should be equivelent to the number of time increments over which the model is to be run.

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

if reqhgt not all or allclim a data.frame with the following elements:

obs_time POSIXlt object of times associated wiht eahc output

reftemp air temperature (deg C) at reference height - i.e. climdata$temp

tout air or soil temperature (deg C) (see details)

tleaf Leaf temperature (deg C) (see details)

relhum Relative humidity (Percentage) (see details)

SWin Incoming shortwave radiation (W / m^2) (see details)

LWin Incoming longwave radiation (W / m^2) (see details)

H Total sensible heat flux to/from canopy (W / m^2). Positive values indicate sensible heat release from canopy to air.

L Sensible heat flux (W / m^2) from each canopy node or for the entire canopy (see details)

G Total heat flux to/from ground (W / m^2). Positive values indicate flux from canopy to ground. Negative values indicate flux from ground to canopy.

if reqhgt = allclim a list of the following data.frames:

Airtemp air temperatures (deg C) at each node for each time step. Also air temperature at canopy top and psi_m parameter, permitting interpolation of temperatures above canopy.

Leaftemp leaf temperatures (deg C) at each node for time step

Soiltemp temperatures (deg C) of each soil layer in time step

Windspeed wind speed (m/s) at each node for each time step

Relhum relative humidity (percentage) at each node for each time step

if reqhgt = all, additionally the following data.frames:

Conductivity leaf boundary layer, turbulent, and leaf vapour conductivities for each time step (mol / m^2 / s)

Fluxes For each timestep, incoming long and shortwave radiation and latent heat fluxes for each node. Also sensible and ground heat fluxes.

Examples

tme<-as.POSIXlt(weather$obs_time, format = "%Y-%m-%d %H:%M", tz = "UTC")
vegp <- microctools::habitatvars(4, lat = 50, long = -5, tme, m = 20)
soilp<- soilinit("Loam")
dataout <- runmodel(weather, vegp, soilp, lat = 50, long = -5)
par(mfrow=c(2,1))
plot(tout~as.POSIXct(obs_time), data = dataout, type = "l", col = "red",
     xlab = "Month", ylab = "Temperature", ylim = c(-8.5, 27.5))
par(new=TRUE)
plot(reftemp~as.POSIXct(obs_time), data = dataout, type = "l", col = rgb(0,0,0,0.5),
     xlab = "", ylab = "Temperature", ylim = c(-8.5, 27.5), main = "Air temperature")
plot(tleaf~as.POSIXct(obs_time), data = dataout, type = "l", col = "darkgreen",
     xlab = "Month", ylab = "Temperature", ylim = c(-8.5, 27.5))
par(new=TRUE)
plot(reftemp~as.POSIXct(obs_time), data = dataout, type = "l", col = rgb(0,0,0,0.5),
    xlab = "", ylab = "", ylim = c(-8.5, 27.5), main = "Leaf temperature")

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