//Useful Websites // http://math.stackexchange.com/questions/406082/numerical-method-to-solve-a-trigonometric-cotangent-function-transient-heat // http://web.cecs.pdx.edu/~gerry/epub/pdf/transientConductionSphere.pdf // http://web.cecs.pdx.edu/~gerry/epub/ //Global Variables for Turkey density = 996; // kg/m3 Assuming Density of Water 1000 kg/m3 cp = 2810 // J/kg K for Turkey heatConvection = 5; // W/m2 K Some Reasonable estimate for natural Convection. Change as needed. 5-25 thermalConduct = 0.412 // W/m K function celsiusToFarenheit(celsius) { farenheit = (celsius*(9/5)) + 32; return(farenheit) } function poundsToKilograms(pounds) { kilograms = (pounds * 0.453592); return(kilograms) } function findClosest(value,array) { closestDiff = null; closestPosition = null; for (var i=0;i errorTolerance && antiFreeze<=500) { //The greater the antiFreeze, the more wasted cycles around a singularity lambdaN = (min+max)/2 result=lambdaFormula(lambdaN, Biot) if (Math.abs(result) <= errorTolerance && result<=errorTolerance) { return (lambdaN); //At Root } else if ((lambdaFormula(min, Biot)*lambdaFormula(lambdaN, Biot))>=0) { min=lambdaN; } else if ((lambdaFormula(max, Biot)*lambdaFormula(lambdaN, Biot))>=0) { max=lambdaN; } antiFreeze++ } } } function lambdaFormula(lambdaN, Biot) { result = 1-lambdaN*(1/Math.tan(lambdaN))-Biot; return(result) } function stove(setTemp) { // Set Temp will need to be sent each time iteration this.actualTemp=0; //C proportional = 0.01; // This value is arbitrary to how fast you want the temperatures to converge. (Or oscillate, which could be realistic as well) var errorTolerance = 0.01; var error = 0; if (setTemp>storedTemp) { error = Math.abs(setTemp-storedTemp); actualTemp = actualTemp + error*proportional; } else if (setTemperrorTolerance) { return (true) //Need to run the Heat Calculations again } } function transientSphereSeries (rPosition,rTotal,tempInitial,tempInfini,t) { sum=0; alpha = thermalConduct/(density*cp) console.log("Alpha is " + alpha) Fourier = (alpha*t)/Math.pow(rTotal,2) console.log("Fourier is " + Fourier) biotNum = heatConvection * rTotal/thermalConduct console.log("The Biot Value is " + biotNum) min = 0; max = 1000; lambdaTerms=findAllRootsAlternative (min,max,max*Math.PI*10,biotNum) for (var i = 0; i