## Heat Convective

### Quick Start

Convective heat flow is too complex to model realistically, but we can get some idea of the effects in air and in water from two input values and by invoking two dimensionless numbers and some reasonable approximations.

### Credits

This app is part of the trio of Conductive (Insulation and Flow), Convective and Radiative heat transfer.

### Heat Convective

```
//One universal basic required here to get things going once loaded
window.onload = function () {
//restoreDefaultValues(); //Un-comment this if you want to start with defaults
Main();
};
//Main() is hard wired as THE place to start calculating when inputs change
//It does no calculations itself, it merely sets them up, sends off variables, gets results and, if necessary, plots them.
function Main() {
//Save settings every time you calculate, so they're always ready on a reload
saveSettings();
//Send all the inputs as a structured object
//If you need to convert to, say, SI units, do it here!
const inputs = {
L: sliders.SlideL.value / 1000, //mm to m
dT: sliders.SlidedT.value,
Fluid: document.getElementById("Fluid").value,
Mode: document.getElementById("Mode").value,
};
//Send inputs off to CalcIt where the names are instantly available
//Get all the resonses as an object, result
const result = CalcIt(inputs);
//Set all the text box outputs
document.getElementById('Q').value = result.Q;
document.getElementById('h').value = result.h;
document.getElementById('Ra').value = result.Ra;
document.getElementById('Pr').value = result.Pr;
if (result.plots) {
for (let i = 0; i < result.plots.length; i++) {
plotIt(result.plots[i], result.canvas[i]);
}
}
//You might have some other stuff to do here, but for most apps that's it for Main!
}
//Here's the app calculation
//The inputs are just the names provided - their order in the curly brackets is unimportant!
//By convention the input values are provided with the correct units within Main
function CalcIt({ L, dT, Fluid, Mode }) {
//viscosity, η, heat capacity Cp, thermal conductivity, k, density ρ, thermal expansion coefficient β, thermal diffusivity α and gravity g.
let h, eta, Cp, k, rho, beta, alpha
if (Fluid == "Water") {
eta = 0.001, Cp = 4180, k = 0.6, rho = 1000, beta = 3 * 2.1e-6, alpha = 0.146 / 1e6
} else {
eta = 1.8e-5, Cp = 700, k = 0.024, rho = 1.2, beta = 0.0037, alpha = 19 / 1e6
}
const g = 9.81
const Ra = rho * beta * dT * Math.pow(L, 3) * g / (eta * alpha)
const Pr = Cp * eta / k
if (Mode == "Vertical") {
h = k / L * (0.68 + 0.67 * Math.pow(Ra, 0.25) / Math.pow(1 + Math.pow(0.492 / Pr, 9 / 16), 4 / 9))
}
if (Mode.includes("Above")) {
h = k / L * 0.54 * Math.pow(Ra, 0.25)
}
if (Mode.includes("Below")) {
h = k / L * 0.27 * Math.pow(Ra, 0.25)
}
const Q = h * dT
//Now we return everything - text boxes, plot and the name of the canvas, which is 'canvas' for a single plot
return {
Q: Q.toFixed(0),
h: h.toPrecision(3),
Ra: Ra.toPrecision(3),
Pr: Pr.toPrecision(3),
};
}
```

### Rayleigh and Prandtl numbers

Modelling heat loss via convection is notoriously hard. Some much-used approximations, based on two dimensionless numbers gives us an idea of what to expect - at least in air and in water. We first need a set of constants for our fluid: Viscosity, η, heat capacity Cp, thermal conductivity, k, density ρ, thermal expansion coefficient β, thermal diffusivity α and gravity g. Everything is defined over a characteristic length L, and depends on the temperature difference between hot surface and cold fluid, ΔT.

The Rayleigh number, Ra, and Prandtl number, Pr, are defined as:

`Ra=(ρβΔTL^3g)/(ηα) and Pr=Cpη/k`

We want to calculate the heat transfer coefficient h because the heat flow per unit area, Q is given by the following simple equation, also known as Newton's law of cooling:

`Q=hΔT`

We calculate h for 3 different modes: V=Vertical, HA=Horizontal-Above and HB=Horizontal-Below:

`h_V=k/L(0.68+(0.67Ra^0.25)/(1+(0.492/Pr)^0.56)^0.44)`

`h_(HA)=k/L0.54Ra^0.25`

`h_(HB)=k/L0.27Ra^0.25`

Now you have h and Q for your choice of air or water and at your chosen ΔT. What about L? It's a sort of length between hot and cold fluid which is hard to define. Maybe you can use the length of your object, which you need (along with the width) to calculate the flux for your actual area rather than the 1m² from the calculation.