Browse Source

Transient Formula looks to be in good working order. That is, the roots appear correct compared to matlab generated results from a published paper.

The thermal conductivity and other turkey identifiers may need adjustment, but the model works ok as long as the times we input are not too low. Better for longer DeltaTs
formula
Scott Mobley 11 years ago
parent
commit
091ac61034
  1. 13
      js/CookingFormula.js

13
js/CookingFormula.js

@ -5,7 +5,7 @@
//Global Variables for Turkey //Global Variables for Turkey
density = 996; // kg/m3 Assuming Density of Water 1000 kg/m3 density = 996; // kg/m3 Assuming Density of Water 1000 kg/m3
cp = 2810 // J/kg K for Turkey cp = 2810 // J/kg K for Turkey
heatConvection = 12; // W/m2 K Some Reasonable estimate for natural Convection. Change as needed. 5-25 heatConvection = 5; // W/m2 K Some Reasonable estimate for natural Convection. Change as needed. 5-25
thermalConduct = 0.412 // W/m K thermalConduct = 0.412 // W/m K
function celsiusToFarenheit(celsius) { function celsiusToFarenheit(celsius) {
@ -179,12 +179,12 @@ for (var i = 0; i < length; ++i )
} }
function bisectionMethod(min,max,Biot) { function bisectionMethod(min,max,Biot) {
errorTolerance = (1/Math.pow(10,9)) errorTolerance = (1/Math.pow(10,10))
result = Infinity // some large value to ensure the calculation goes through. result = Infinity // some large value to ensure the calculation goes through.
negativeTest =lambdaFormula(min, Biot)*lambdaFormula(max, Biot) negativeTest =lambdaFormula(min, Biot)*lambdaFormula(max, Biot)
if (negativeTest <=0 ) { if (negativeTest <=0 ) {
var antiFreeze=0; var antiFreeze=0;
while (Math.abs(result) > errorTolerance && antiFreeze<=10000) { while (Math.abs(result) > errorTolerance && antiFreeze<=100000) {
lambdaN = (min+max)/2 lambdaN = (min+max)/2
result=lambdaFormula(lambdaN, Biot) result=lambdaFormula(lambdaN, Biot)
if (Math.abs(result) <= errorTolerance && result<=errorTolerance) { if (Math.abs(result) <= errorTolerance && result<=errorTolerance) {
@ -217,7 +217,10 @@ console.log("Fourier is " + Fourier)
biotNum = heatConvection * rTotal/thermalConduct biotNum = heatConvection * rTotal/thermalConduct
console.log("The Biot Value is " + biotNum) console.log("The Biot Value is " + biotNum)
lambdaTerms = findAllRoots(biotNum) min = 0;
max = 250;
lambdaTerms=findAllRootsAlternative (min,max,max*1000,biotNum)
for (var i = 0; i<lambdaTerms.length; i++) { for (var i = 0; i<lambdaTerms.length; i++) {
lambdaN = lambdaTerms[i] lambdaN = lambdaTerms[i]
@ -227,7 +230,7 @@ lambdaTerms = findAllRoots(biotNum)
sum = frontCoefficientPortion*exponentialPortion*sinPortion + sum sum = frontCoefficientPortion*exponentialPortion*sinPortion + sum
} }
tempAtTimeAndRadius=(sum*(tempInitial-tempInfini))+tempInfini tempAtTimeAndRadius=(sum*(tempInitial-tempInfini))+tempInfini
return(tempAtTimeAndRadius)
console.log("The Temperature at radius " + rPosition + " m and time " + t + " seconds is " + tempAtTimeAndRadius + " C or " + celsiusToFarenheit(tempAtTimeAndRadius) + " F"); console.log("The Temperature at radius " + rPosition + " m and time " + t + " seconds is " + tempAtTimeAndRadius + " C or " + celsiusToFarenheit(tempAtTimeAndRadius) + " F");
return(tempAtTimeAndRadius)
} }

Loading…
Cancel
Save