get_profile | R Documentation |
Function for computing wind speed, air temperature and humidity profiles at a range of heights beyond what comes out of the microclimate model, using the same functions that the microclimate model uses in the micro.f subroutine. It is useful for situations where the organism grows through time and thus the local height needs to change, or when simulating a multi-part organism where the parts are at different heights (e.g., leg vs. head of a human)
get_profile(ZH = 0.004, D0 = 0.012)
Refhyt |
= 1.2, Reference height (m), reference height at which air temperature, wind speed and relative humidity input data are measured (must match the micro_* function you are using, e.g. 1.2 for micro_global, 2 for micro_era5) |
RUF |
= 0.004, Roughness height (m), e.g. smooth desert is 0.0003, closely mowed grass may be 0.001, bare tilled soil 0.002-0.006, current allowed range: 0.00001 (snow) - 0.02 m. (match to the value used in the original microclimate simulation) |
ZH |
= 0, heat transfer roughness height (m) for Campbell and Norman air temperature/wind speed profile (invoked if greater than 0, 0.02 * canopy height in m if unknown |
D0 |
= 0, zero plane displacement correction factor (m) for Campbell and Norman air temperature/wind speed profile (0.6 * canopy height in m if unknown) |
TAREF |
= 27.8, air temperature (deg C) at reference height |
VREF |
= 2.75, wind speed (m/s) at reference height |
RH |
= 49.0415, relative humidity (pct) at reference height |
D0cm |
= 48.6, soil surface temperature (deg C) |
maxsurf |
= 95, maximum allowed soil surface temperature - this is the default value in all micro_* functions |
ZEN |
= 21.5, zenith angle (degrees) of sun - used in determining if free convection conditions or not |
a |
= 0.15, wind shear exponent for extending above reference height (open water 0.1, Smooth, level, grass-covered 0.15 (or more commonly 1/7), row crops 0.2, low bushes with a few trees 0.2, heavy trees or several buildings or mountainous terrain 0.25, (source http://www.engineeringtoolbox.com/wind-shear-d_1215.html) |
heights |
= c(0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.75, 1), vector of heights (m) for which the profile is desired (make them between zero and the reference height, don't include the reference height, and make the minimum greater than the roughness height |
heights Heights (m) at which results are reported, with 0 and Refhyt added on
VELs Wind speeds (m/s) with increasing height
TAs Air temperatures (deg C) with increasing height
RHs Relative humidity (pct) with increasing height
QCONV Convective heat loss (W/m2) from surface
USTAR Friction velocity (m/s)
library(NicheMapR)
RUF <- 0.004 # choose a roughness height
micro <- micro_global(RUF = RUF) # run with defaults other than roughness height (Madison, Wisconsin)
dates <- micro$dates # extract mock dates (units of months)
metout <- as.data.frame(micro$metout) # above ground min shade conditions
soil <- as.data.frame(micro$soil) # below ground min shade conditions
newheights <- c(0.1, 0.4) # m, new height needed (can be a single value or a vector of heights)
profile.out <- lapply(1:length(metout$TALOC),
function(x){get_profile(Refhyt = 1.2, # needs to be what micro_global uses as Refhyt
RUF = RUF,
heights = newheights,
TAREF = metout$TAREF[x],
VREF = metout$VREF[x],
RH = metout$RH[x],
D0cm = soil$D0cm[x],
ZEN = metout$ZEN[x])}) # run get_profile across all times at new height
profile.out1 <- do.call("rbind", lapply(profile.out, data.frame)) # turn results into data frame
newheight.out <- subset(profile.out1, heights == newheights[2])
plot(dates, metout$TALOC, ylab = 'air temperature, deg C', type = 'l')
points(dates, profile.out1$TAs[profile.out1$heights == newheights[1]], type = 'l', lty = 2)
points(dates, profile.out1$TAs[profile.out1$heights == newheights[2]], type = 'l', lty = 3)
plot(dates, metout$VLOC, ylab = 'wind speed, m/s', type = 'l', ylim = c(0, 3))
points(dates, profile.out1$VELs[profile.out1$heights == newheights[1]], type = 'l', lty = 2)
points(dates, profile.out1$VELs[profile.out1$heights == newheights[2]], type = 'l', lty = 3)
plot(dates, metout$RHLOC, ylab = 'relative humidity, pct', type = 'l', ylim = c(0, 100))
points(dates, profile.out1$RHs[profile.out1$heights == newheights[1]], type = 'l', lty = 2)
points(dates, profile.out1$RHs[profile.out1$heights == newheights[2]], type = 'l', lty = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.