Yesterday’s post showed how some of the constants and parameters are initialized or calculated. Today we’ll describe a few more.
This exercise defines a cross-section of a steel billet that is 8 inches by 8 inches and divided into five nodes high and five nodes wide. I found it convenient to assume the surface nodes were only half the height or width of the middle nodes, and to assume the center of surface nodes is on the outer edge or corner of the node, or in the middle of the node for central nodes. This means that the centers are always equidistant both across and up. The surface nodes also receive conducted heat and radiated heat at the same location. Nodes on the corners have one quarter the cross-sectional area of the fully central nodes, and nodes on the surface but not on the corner have one half the area of the fully central nodes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
var timeStep = 40.0; //seconds var nodeWidth = 2.0; //inches var nodeHeight = 2.0; //inches var pieceCount = 50; var arrayTpieces = new Array; var arrayT = new Array; for (var i=0; i< pieceCount; i++) { arrayTpieces[i] = new Array; for (var j=0; j<nodesWide; j++) { arrayTpieces[i][j] = new Array; arrayT[j] = new Array; for (var k=0; k<nodesHigh; k++) { arrayTpieces[i][j][k] = 70.0; arrayT[j][k] = 0.0; } } } var arrayTfce = new Array; for (var i=0; i< pieceCount; i++) { arrayTfce[i] = 1800.0; } var arrayRho = new Array; var arrayCp = new Array; var arrayKup = new Array; var arrayKright = new Array; var arrayDup = new Array; var arrayDright = new Array; var arrayArea = new Array; var arraySurfLength = new Array; var arrayVF = new Array; var arrayRad = new Array; var tempLength = 0.0; for (var i=0; i<nodesWide; i++) { arrayRho[i] = new Array; arrayCp[i] = new Array; arrayKup[i] = new Array; arrayKright[i] = new Array; arrayDup[i] = new Array; arrayDright[i] = new Array; arrayArea[i] = new Array; arraySurfLength[i] = new Array; arrayVF[i] = new Array; arrayRad[i] = new Array; for (j=0; j<nodesHigh; j++) { arrayRho[i][j] = 0.0; arrayCp[i][j] = 0.0; arrayKup[i][j] = 0.0; arrayKright[i][j] = 0.0; if (j < nodesHigh-1) { arrayDup[i][j] = nodeHeight; } else { arrayDup[i][j] = 0.0; } if (i < nodesWide-1) { arrayDright[i][j] = nodeWidth; } else { arrayDright[i][j] = 0.0; } arrayArea[i][j] = nodeHeight * nodeWidth; if ((i == 0) || (i == nodesWide-1)) { arrayArea[i][j] *= 0.5; } if ((j == 0) || (j == nodesHigh-1)) { arrayArea[i][j] *= 0.5; } arraySurfLength[i][j] = 0.0; arrayVF[i][j] = 0.0; if (j == nodesHigh-1) { if ((i == 0) || (i == nodesWide-1)) { arraySurfLength[i][j] += nodeWidth * 0.5; } else { arraySurfLength[i][j] += nodeWidth; } arrayVF[i][j] = 1.0 * arraySurfLength[i][j]; } tempLength = 0.0; if ((i == 0) || (i == nodesWide-1)) { if ((j == 0) || (j == nodesHigh-1)) { arraySurfLength[i][j] += nodeHeight * 0.5; tempLength = nodeHeight * 0.5; } else { arraySurfLength[i][j] += nodeHeight; tempLength = nodeHeight; } if (j == 0) {arrayVF[i][j] += 0.26 * tempLength;} else if (j == 1) {arrayVF[i][j] += 0.41 * tempLength;} else if (j == 2) {arrayVF[i][j] += 0.55 * tempLength;} else if (j == 3) {arrayVF[i][j] += 0.67 * tempLength;} else if (j == 4) {arrayVF[i][j] += 0.78 * tempLength;} else if (j == 5) {arrayVF[i][j] += 0.87 * tempLength;} else if (j == 6) {arrayVF[i][j] += 0.95 * tempLength;} } if (arraySurfLength[i][j] > 0.0) { arrayVF[i][j] /= arraySurfLength[i][j]; } arrayRad[i][j] = 0.0; } } function calcParams(index) { //index says which piece var i; var j; var wide; var high; var a; var d; var k1; var k2; wide = nodesWide; high = nodesHigh; for (i = 0; i < wide; i++) { for (j = 0; j < high; j++) { //nodal energy arrayRho[i][j] = coeffRho * arrayArea[i][j] / timeStep; var t = arrayTpieces[index][i][j]; arrayCp[i][j] = findCpofT(t); //conduction up //if (arrayDup[i][j] > 0.0) { if (j < high-1) { a = nodeWidth; if ((i == 0) || (i == wide-1)) { a *= 0.5; } d = arrayDup[i][j]; //nodeHeight k1 = findKofT(arrayTarrayTpieces[index][i][j]); k2 = findKofT(arrayTarrayTpieces[index][i][j+1]); arrayKup[i][j] = (k1 + k2) * 0.5 * a / d; } else { arrayKup[i][j] = 0.0; } //conduction to right //if (arrayDright[i][j] > 0.0) { if (i < wide-1) { a = nodeHeight; if ((j == 0) || (j == high-1)) { a *= 0.5; } d = arrayDright[i][j]; //nodeWidth k1 = findKofT(arrayTarrayTpieces[index][i][j]); k2 = findKofT(arrayTarrayTpieces[index][i+1][j]); arrayKright[i][j] = (k1 + k2) * 0.5 * a / d; } else { arrayKright[i][j] = 0.0; } //radiation var z = coeffRad * arrayVF[i][j] * arraySurfLength[i][j]; arrayRad[i][j] = z; var z = k1 + k2; } } } //calcParams |