-
-
Save gleguizamon/9bab4870fc30dace8111986fa6bed030 to your computer and use it in GitHub Desktop.
Nozzle Calc Fork - Creditos a quien corresponda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Nozzle calculator</title> | |
</head> | |
<body style="background-color: #CCFFFF; font-family: 'Segoe UI';"> | |
<div align="center"> | |
<h1 style="margin: 0; font-weight: bold;">Nozzle Calculator</h1> | |
<h4 style="margin: 0 0 15px 0; font-weight: 500;">Written by John Bolene.</h4> | |
<p style="margin: 0;">This page allows you to calculate the nozzle size.</p> | |
<p style="margin: 0;">Note that it is a best estimate</p> | |
<br /> | |
<form onsubmit="nozzlesize(); return false;"> | |
<table> | |
<tr> | |
<td>Enter core diameter: </td> | |
<td> | |
<input type="text" name="corediam" /> | |
</td> | |
<td> | |
<select name="inmm" size="2"> | |
<option value="in">inches </option> | |
<option value="mm">millimeters </option> | |
</select> | |
</td> | |
<td>Enter expected K value: </td> | |
<td> | |
<input type="text" name="isp" /> | |
</td> | |
</tr> | |
<tr> | |
<td>Enter grain diameter: </td> | |
<td> | |
<input type="text" name="graindiam" /> | |
</td> | |
<td> | |
<select name="inmm1" size="2"> | |
<option value="in">inches </option> | |
<option value="mm">millimeters </option> | |
</select> | |
</td> | |
<td>Enter number of grains</td> | |
<td> | |
<select name="numgrains" size="9"> | |
<option value="1">1 </option> | |
<option value="2">2 </option> | |
<option value="3">3 </option> | |
<option value="4">4 </option> | |
<option value="5">5 </option> | |
<option value="6">6 </option> | |
<option value="7">7 </option> | |
<option value="8">8 </option> | |
<option value="9">9 </option> | |
</select> | |
</td> | |
</tr> | |
<tr> | |
<td>Enter grain length: </td> | |
<td> | |
<input type="text" name="grainlen" /> | |
</td> | |
<td> | |
<select name="inmm2" size="2"> | |
<option value="in">inches </option> | |
<option value="mm">millimeters </option> | |
</select> | |
</td> | |
</tr> | |
</table> | |
<p> | |
<input type="button" value="Calculate!" onclick="nozzlesize()" /> | |
</p> | |
<hr> | |
<p> | |
Nozzle Size: | |
<input readonly type="text" name="result" size="7" /> | |
inches | |
<input readonly type="text" name="result1" size="7" /> | |
millimeters | |
</p> | |
<p> | |
<textarea readonly rows="6" cols="60" name="report"></textarea> | |
</p> | |
<p> | |
Hit the "Clear" button to clear the form and re-enter your data | |
<br /> | |
<input type="reset" value="Clear" /> | |
<br /> | |
</p> | |
<hr /> | |
</form> | |
</div> | |
<script> | |
// Conversion factors | |
var pi = 3.1415926; | |
var mm2in = 0.03937; | |
function nozzlesize() { | |
var unitN = parent.document.forms[0].inmm.selectedIndex; | |
if (unitN == 0) var corediaunit = 1; | |
if (unitN == 1) var corediaunit = mm2in; | |
var unitD = parent.document.forms[0].inmm1.selectedIndex; | |
if (unitD == 0) var graindiaunit = 1; | |
if (unitD == 1) var graindiaunit = mm2in; | |
var unitC = parent.document.forms[0].inmm2.selectedIndex; | |
if (unitC == 0) var grainlunit = 1; | |
if (unitC == 1) var grainlunit = mm2in; | |
var cored = parent.document.forms[0].corediam.value; | |
var graind = parent.document.forms[0].graindiam.value; | |
var numgrain = | |
parent.document.forms[0].numgrains.options[ | |
parent.document.forms[0].numgrains.selectedIndex | |
].value; | |
var grainl = parent.document.forms[0].grainlen.value; | |
var isp = parent.document.forms[0].isp.value; | |
if (!parseInt(numgrain) || !parseInt(isp)) { | |
alert("Make sure you have entered all data"); | |
return; | |
} | |
var cored = cored * corediaunit; | |
var graind = graind * graindiaunit; | |
var grainl = grainl * grainlunit; | |
var corearea = (cored / 2) * (cored / 2) * pi; | |
var totendarea = (graind / 2) * (graind / 2) * pi; | |
var endarea = totendarea - corearea; | |
var coresurfarea = cored * pi * grainl; | |
var grainarea = 2 * endarea + coresurfarea; | |
var totgrainarea = numgrain * (2 * endarea + coresurfarea); | |
var result = Math.sqrt(totgrainarea / isp / 0.7854); | |
var result1 = result / mm2in; | |
var result = Math.round(result * 1000) / 1000; | |
var result1 = Math.round(result1 * 1000) / 1000; | |
document.forms[0].result.value = result; | |
document.forms[0].result1.value = result1; | |
document.forms[0].report.value = | |
"Nozzle DATA\r\n" + | |
`Core diameter: ${cored.toFixed(3)} (in) \r\n` + | |
`Grain diameter: ${graind.toFixed(3)} (in) \r\n` + | |
`Grain length: ${grainl.toFixed(3)} (in) \r\n` + | |
`Core end area: ${corearea.toFixed(3)} (sq. in) \r\n` + | |
`Core surf. area: ${coresurfarea.toFixed(3)} (sq. in) \r\n` + | |
`Grain area: ${grainarea.toFixed(3)} (sq. in) \r\n` + | |
`Total grain area: ${totgrainarea.toFixed(3)} (sq. in) \r\n`; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment