#' ReVuePro: HeatT
#'
#' A function to calculate total dry heat transfer (convective and radiative) from a surface with known surface area.
#' @details Note that conductive heat transfer is not yet included in total heat transfer calculations, and wind assumed to be absent.
#' @param Ts A vector or single value pertaining to the surface temperature of the object in question (that from which heat is being transfered), in degrees Celsius.
#' @param Ta A vector or single value pertaining to the ambient temperature experienced by the object in question (agian, that from which heat is being transfered), in degrees Celsius.
#' @param atm The atmospheric pressure at the time that surface temperature measurements were drawn in kiloPascals. Default is 101.325.
#' @param dim The length of the object from which surface temperature measurements were drawn, in the orientation of airflow, in metres. Default is the diameter of a circle with the surface area defined by SA.
#' @param SA The surface area of the object from which surface temperature measurments were drawn, in metres squared.
#' @param Emis The emissivity of the object from which surface temperature measurments were drawn. Default is 0.95.
#' @param par A logical parameter that defines whether heat transfer calculation are to be conducted by parallel processing. Default is false.
#' @keywords VuePro, Thermal
#' @import doParallel bigleaf dplyr Thermimage
#' @examples
#' my_data = read.csv("C:/ThermDat/Surface_Temp.csv")
#' horizontal_dim = 0.15
#' SA_circle = pi*(0.15/2)^2
#' HeatT(Ts = c(my_data$SurfaceT), Ta = 21, atm = 100.1, dim = horizontal_dim, SA = SA_circle, Emis = 0.98, par = "T")
#' @export
HeatT = function(Ts,Ta,atm = 101.325, dim = 2*sqrt(SA/pi), SA, Emis = 0.95, par = "FALSE"){
par = as.logical(par)
if (is.numeric(Ts) == FALSE){
return ("Ts must be a numeric vector or value.")
}
if (is.numeric(Ta) == FALSE){
return ("Ta must be a numeric vector or value.")
}
if (is.numeric(dim) == FALSE){
return ("dim must be a numeric value equal to the horizontal length of the object, in m.")
}
if (is.numeric(SA) == FALSE){
return ("SA must be numeric value equal to the surface area of the object in m2.")
}
require('bigleaf')
require('dplyr')
require('Thermimage')
if (par == TRUE){
require('doParallel')
} else if (par != "T" | par != "F"){
return ("par must be T or F.")
}
if (length(Ta) != length(Ts)){
if (length(Ta) != 1){
return("Ta must be of length 1, or equal to the length of Ts")
} else if (length(Ta) == 1){
Ta = c(rep(Ta, length(Ts)))
}
}
TD = data.frame(Ta = Ta, Ts = Ts, ID = seq(from = 1, to = length(Ts), by = 1))
NAs_TR = TD[c(which(is.na(Ts))),]
CTD = na.omit(TD)
Kt = c()
Vis = c()
Alpha = c()
Gr = c()
Nu = c()
Hc = c()
if (par == FALSE){
for (i in 1:length(CTD$Ta)) {
Kt[i] = airtconductivity(CTD$Ta[i])
Vis[i] = kinematic.viscosity(CTD$Ta[i], atm)
Alpha[i] = 1 / (CTD$Ta[i] + 273.15)
}
for (i in 1:length(CTD$Ts)) {
Gr[i] = ((Alpha[i]) * (9.81) * (dim)^3 *
(CTD$Ts[i] - CTD$Ta[i])) / (Vis[i])^2
}
for (i in 1:length(CTD$Ts)) {
Nu[i] = sign(Gr[i]) * 0.50 * (abs(Gr[i]))^0.25
}
for (i in 1:length(CTD$Ts)) {
Hc[i] = Nu[i] * (Kt[i] / dim)
}
Qconv = c()
Qrad = c()
for (i in 1:length(CTD$Ts)) {
Qconv[i] = SA * (Hc[i]) * (CTD$Ts[i] - CTD$Ta[i])
Qrad[i] = SA * (5.67 * 10^-8) * Emis^2*
((CTD$Ts[i] + 273.15)^4 - (CTD$Ta[i] + 273.15)^4)
}
Qtot = c()
for (i in 1:length(CTD$Ts)) {
Qtot[i] = Qconv[i] + Qrad[i]
}
CTD$Qtot = Qtot
NAs_TR$Qtot = NA
to_return = rbind(CTD, NAs_TR)
to_return = dplyr::arrange(to_return, ID)
return(to_return$Qtot)
} else if (par == TRUE){
foreach(i=1:length(CTD$Ta)) %dopar% {
Kt[i] = airtconductivity(CTD$Ta[i])
Vis[i] = kinematic.viscosity(CTD$Ta[i], atm)
Alpha[i] = 1 / (CTD$Ta[i] + 273.15)
}
foreach(i=1:length(CTD$Ts)) %dopar% {
Gr[i] = ((Alpha[i]) * (9.81) * (dim)^3 *
(CTD$Ts[i] - CTD$Ta[i])) / (Vis[i])^2
}
foreach(i=1:length(CTD$Ts)) %dopar% {
Nu[i] = sign(Gr[i]) * 0.50 * (abs(Gr[i]))^0.25
}
foreach(i=1:length(CTD$Ts)) %dopar% {
Hc[i] = Nu[i] * (Kt[i] / dim)
}
Qconv = c()
Qrad = c()
foreach(i=1:length(CTD$Ts)) %dopar% {
Qconv[i] = SA * (Hc[i]) * (CTD$Ts[i] - CTD$Ta[i])
Qrad[i] = SA * (5.67 * 10^-8) * Emis^2*
((CTD$Ts[i] + 273.15)^4 - (CTD$Ta[i] + 273.15)^4)
}
Qtot = c()
foreach(i=1:length(CTD$Ts)) %dopar% {
Qtot[i] = Qconv[i] + Qrad[i]
}
CTD$Qtot = Qtot
NAs_TR$Qtot = NA
to_return = rbind(CTD, NAs_TR)
to_return = dplyr::arrange(to_return, ID)
return(to_return$Qtot)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.