Foam K Calculator

Quick Start

A simple test rig and a bit of care lets you measure the thermal conductivity of small samples of foam or just about anything else

Credits

This app was developed for the Science of (PU) Foam with Dr Grażyna Mitchener.

Foam K Calculator

T1
hmm
A cm²
m g
ΔCp J/kgK
τ min
Biot
K mW/mK
//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
    document.getElementById('Load').addEventListener('click', clearOldName, false);
    document.getElementById('Load').addEventListener('change', handleFileSelect, false);
    Main();
};
let theData=[[0,18.9],[1,19.4],[2,19.8],[3,20.1],[4,20.3],[5,20.6],[6,20.8],[7,21.1],[8,21.3],[9,21.4],[10,21.7],[11,21.9],[12,22.1],[13,22.3],[14,22.4],[15,22.7],[16,22.8],[17,23],[18,23.1],[19,23.2],[20,23.4],[21,23.5],[22,23.6],[23,23.7],[24,23.8],[25,23.9],[26,24.1],[27,24.2],[28,24.2],[29,24.4],[30,24.4],[31,24.6],[32,24.6],[33,24.6],[34,24.7],[35,24.8],[36,24.9],[37,24.9],[38,25],[39,25.1],[40,25.1],[41,25.1],[42,25.2],[43,25.3],[44,25.3],[45,25.4],[46,25.4],[47,25.5],[48,25.5],[49,25.5],[50,25.6],[51,25.6],[52,25.6],[53,25.6],[54,25.7],[55,25.7],[56,25.7],[57,25.7],[58,25.7],[59,25.7],[60,25.7]]
//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 = {
        //T0: sliders.SlideT0.value,
        T1: sliders.SlideT1.value,
        h: sliders.Slideh.value/1000, //to m
        A: sliders.SlideA.value/10000, //to m2
        m: sliders.Slidem.value/1000, //to kg
        Cp: sliders.SlideCp.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('tau').value = result.tau; 
    document.getElementById('B').value = result.B; 
    document.getElementById('K').value = result.K; 

    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({ T1, h, A, m, Cp}) {
    let Texp=[], Tcalc=[]
    let K=0,tau=0,B=0
    let x=[],y=[],i=0
    for (i=0;i 1000 && newfP < lastfP && Math.abs((newfP - lastfP) / lastfP) < 1e-10) break
        lastfP = newfP
    }
    return P0
};            

We want insulation to stop heat flowing from a hot exterior to a cold interior (e.g a fridge) or from a warm interior (e.g. a room) to the colder exterior. Let's call the temperature we want to preserve TG for Good and the external temperature TB for Bad. The difference between them is ΔT.

The amount of heat (in Joules, J) that flows per second (J/s = W, Watts) per m² is the flux Q which depends on the thickness of the insulation, L, the ΔT at any given time and the thermal conductivity K which is in units of W/mK:

`Q=K(ΔT)/L`

The app calculates Q0 from your inputs at the moment the temperature difference is set up. To see the implications of the parameters we can watch what happens over time if we assume that all the heat that flows goes into changing TG. To do that we need to know the mass (per unit area) of the material so you supply its thickness h and choose a material with its indicated density (kg/m³) and specific heat capacity C (J/kgK), i.e. the amount of heat needed to raise 1kg of material by 1°K.

As ΔT gets smaller, the rate of temperature change decreases, so you get the classic exponential approach to equilibrium. The timescale of the calculation automatically adjusts so that you see this approach to equilibrium value in 1, 10, 100 or 1000s.