<HTML> <HEAD> <TITLE>Calculation of normal depth in a prismatic channel using the Manning equation, Victor Miguel Ponce, San Diego State University</TITLE> <STYLE TYPE="text/css"> a {text-decoration:none} a:hover {color: #cc0000; background: #ffffcc; text-decoration: none} body {font-family: helvetica; font-size: 12pt; color: #000055; background:#114466} .heading1 {font-size: 11pt; font-family: bookman; color: #880000} .heading2 {font-size: 10pt; font-family: helvetica; color: #004400} .heading3 {font-size: 10pt; font-family: courier; color: #770000} .heading4 {font-size: 10pt; font-family: roman; color: #770000} .heading5 {font-size: 10pt; font-family: helvetica; color: #000055} </STYLE> </HEAD> <?php if (!IsSet($_POST['Submit']) || $_POST['Submit'] == 'Reset') { $_POST["discharge"] = ""; $_POST["bottomwidth"] = ""; $_POST["sideslope"] = ""; $_POST["bottomslope"] = ""; $_POST["manningsn"] = ""; $_POST["unitsystems"] = ""; $_POST["lengthunits"] = ""; $_POST["areaunits"] = ""; $_POST["velocityunits"] = ""; $_POST["dischargeunits"] = ""; $_POST["accelerationunits"] = ""; $_POST["unitsystemsname"] = ""; $_POST["x"] = ""; $_POST["xr"] = ""; $_POST["y"] = ""; $_POST["yp"] = ""; $_POST["dx"] = ""; $_POST["tol"] = ""; $_POST["yn"] = ""; $_POST["an"] = ""; $_POST["pn"] = ""; $_POST["tn"] = ""; $_POST["rn"] = ""; $_POST["vn"] = ""; $_POST["dn"] = ""; $_POST["fn"] = ""; $_POST["iflag"] = ""; $_POST["jflag"] = ""; $_POST["kflag"] = ""; } elseif($_POST["Submit"] == 'Calculate') { $discharge = $_POST["discharge"]; $bottomwidth = $_POST["bottomwidth"]; $sideslope = $_POST["sideslope"]; $bottomslope = $_POST["bottomslope"]; $manningsn = $_POST["manningsn"]; $unitsystems = $_POST["unitsystems"]; $lengthunits = $_POST["lengthunits"]; $areaunits = $_POST["areaunits"]; $velocityunits = $_POST["velocityunits"]; $dischargeunits = $_POST["dischargeunits"]; $accelerationunits = $_POST["accelerationunits"]; $unitsystemsname = $_POST["unitsystemsname"]; $x = $_POST["x"]; $xr = $_POST["xr"]; $y = $_POST["y"]; $yp = $_POST["yp"]; $dx = $_POST["dx"]; $tol = $_POST["tol"]; $yn = $_POST["yn"]; $an = $_POST["an"]; $pn = $_POST["pn"]; $tn = $_POST["tn"]; $rn = $_POST["rn"]; $vn = $_POST["vn"]; $dn = $_POST["dn"]; $fn = $_POST["fn"]; $iflag = $_POST["iflag"]; $jflag = $_POST["jflag"]; $kflag = $_POST["kflag"]; //check for input errors if($_POST["discharge"] <= 0) { if($_POST["Submit"] == 'Calculate') { echo "<P><br><P><br><P><br><P><br><table align=\"center\" bgcolor=\"ffffcc\" width=\"50%\" border=\"2\" cellpadding=\"15\"><tr><td>"; echo "<font color=\"000066\" face=\"arial\" size=\"+2\"><b> onlinechannel01: *** Error message 1 *** Please enter only positive number for discharge. Execution stops here. </b></font>"; echo "</td></tr></table>"; die; } } if($_POST["manningsn"] <= 0) { if($_POST["Submit"] == 'Calculate') { echo "<P><br><P><br><P><br><P><br><table align=\"center\" bgcolor=\"ffffcc\" width=\"50%\" border=\"2\" cellpadding=\"15\"><tr><td>"; echo "<font color=\"000066\" face=\"arial\" size=\"+2\"><b> onlinechannel01: *** Error message 2 *** Please enter only positive number for manning's n. Execution stops here. </b></font>"; echo "</td></tr></table>"; die; } } if($_POST["bottomslope"] <= 0) { if($_POST["Submit"] == 'Calculate') { echo "<P><br><P><br><P><br><P><br><table align=\"center\" bgcolor=\"ffffcc\" width=\"50%\" border=\"2\" cellpadding=\"15\"><tr><td>"; echo "<font color=\"000066\" face=\"arial\" size=\"+2\"><b> onlinechannel01: *** Error message 3 *** Please enter only positive number for bottom slope. Execution stops here. </b></font>"; echo "</td></tr></table>"; die; } } if($_POST["bottomwidth"] < 0) { if($_POST["Submit"] == 'Calculate') { echo "<P><br><P><br><P><br><P><br><table align=\"center\" bgcolor=\"ffffcc\" width=\"50%\" border=\"2\" cellpadding=\"15\"><tr><td>"; echo "<font color=\"000066\" face=\"arial\" size=\"+2\"><b> onlinechannel01: *** Error message 4 *** Please enter only nonnegative number for bottom width. Execution stops here. </b></font>"; echo "</td></tr></table>"; die; } } if($_POST["sideslope"] < 0) { if($_POST["Submit"] == 'Calculate') { echo "<P><br><P><br><P><br><P><br><table align=\"center\" bgcolor=\"ffffcc\" width=\"50%\" border=\"2\" cellpadding=\"15\"><tr><td>"; echo "<font color=\"000066\" face=\"arial\" size=\"+2\"><b> onlinechannel01: *** Error message 5 *** Please enter only nonnegative number for side slope. Execution stops here. </b></font>"; echo "</td></tr></table>"; die; } } if(($_POST["bottomwidth"] == 0) && ($_POST["sideslope"] == 0)) { if($_POST["Submit"] == 'Calculate') { echo "<P><br><P><br><P><br><P><br><table align=\"center\" bgcolor=\"ffffcc\" width=\"50%\" border=\"2\" cellpadding=\"15\"><tr><td>"; echo "<font color=\"000066\" face=\"arial\" size=\"+2\"><b> onlinechannel01: *** Error message 6 *** Bottom width and side slope cannot be zero at the same time. Execution stops here. </b></font>"; echo "</td></tr></table>"; die; } } //set unit systems $unitsystems = 0; // default value if(isset($_POST["unitsystems"])) { $unitsystems = $_POST["unitsystems"]; } if ($unitsystems == 1) { $g= 32.17; $c= 1.486; $lengthunits = "ft"; $areaunits = "ft<sup>2</sup>"; $velocityunits = "fps"; $dischargeunits = "cfs "; $accelerationunits = "ft s<sup>-2</sup>"; $unitsystemsname = "U.S. Customary"; } elseif($unitsystems == 0) { $g = 9.81; $c = 1.0; $lengthunits = "m"; $velocityunits = "m s<sup>-1</sup>"; $areaunits = "m<sup>2</sup>"; $dischargeunits = "m<sup>3</sup> s<sup>-1</sup>"; $accelerationunits = "m s<sup>-2</sup>"; $unitsystemsname = "SI (metric)"; } //main calculations $iflag= 0.; $kflag= 0.; $tol= 0.0001; $x = 0.; $dx = 1.; $q = $_POST["discharge"]; $b = $_POST["bottomwidth"]; $z = $_POST["sideslope"]; $s = $_POST["bottomslope"]; $xn = $_POST["manningsn"]; //main while loops while($kflag == 0) { $y = + pow(($x*(0.5*$b + 0.5*$z*$x)),2.5) - 0.5*pow(($q*$xn/(2*$c*pow($s,0.5))),1.5)*$b; $jflag = 0; while($jflag == 0) { if($y < 0.) { $x = $x + $dx; $jflag = 1; } else { while($iflag == 0) { $y = + pow(($x*(0.5*$b + 0.5*$z*$x)),2.5) - 0.5*pow(($q*$xn/(2*$c*pow($s,0.5))),1.5)*$b; $yp = + 1.25*$z*pow($x,2.5)*pow((0.5*$b + 0.5*$z*$x),1.5) - pow(($q*$xn/(2*$c*pow($s,0.5))),1.5)*pow((1 + pow($z,2)),0.5); $xr = $x - $y/$yp; if(abs($xr - $x) < $tol) { $iflag= 1; $jflag= 1; $kflag= 1; } $x = $xr; } } } } $yn = $x; $an = ($b + $z*$yn)*$yn; $pn = $b + 2*$yn*pow((1 + pow($z,2)),0.5); $tn = $b + 2*$z*$yn; $rn = $an/$pn; $vn = $q/$an; $dn = $an/$tn; $fn = $vn/(pow(($g*$dn),0.5)); } ?> <BODY link="000066" vlink="555555" alink="555555"> <P><br><P> <table width="80%" align="center" border="2" cellpadding="10" bgcolor="ffffee"><tr><td> <DIV align="center" class="heading1"><b>onlinechannel_01: Normal depth in a prismatic channel </b></DIV><hr color="000066"> <center> <table align="center" width="90%" cellpadding="10"><tr><td> <table bgcolor="880000" cellpadding="5"><tr><td align="center"> <IMG SRC="onlinechannel_fig05.jpg"><br><font face="helvetica" size="-1" color="ffff66">Definition sketch for a prismatic channel</font> </td> </tr></table> </td><td align="center"><b>Formulas</b> <P> <div align="center" class="heading3"> <hr color="440000" size="1"> A = y(b + zy) <hr color="440000" size="1"> P = b + 2y(1 + z<sup><font size="-1">2</font></sup>)<sup><font size="-1">1/2</font></sup> <hr color="440000" size="1"> T = b + 2zy <hr color="440000" size="1"> R = A/P <hr color="440000" size="1"> D = A/T <hr color="440000" size="1"> Q = (C/n) AR<sup><font size="-1">2/3</font></sup>S<sup><font size="-1">1/2</font></sup> <hr color="440000" size="1"> V = Q/A <hr color="440000" size="1"> F = V/(gD)<sup><font size="-1">1/2</font></sup> <hr color="440000" size="1"> </div> </td> </td> </tr></table> </center> <hr color="000066"> <FORM ACTION="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST"> <table width="100%" cellpadding="5"><tr><td valign="top"> <b>INPUT DATA:</b> <P>Select: <SELECT NAME="unitsystems" size="2"> <OPTION VALUE="0">SI units (metric)</OPTION> <OPTION VALUE="1">U.S. Customary units</OPTION> </SELECT> <P>Flow discharge Q: <INPUT TYPE="text" SIZE="08" MAXLENGTH="12" NAME="discharge" VALUE="<?php echo $_POST['discharge']; ?>"> <?php echo $dischargeunits ?> <P>Bottom width b: <INPUT TYPE="text" SIZE="08" MAXLENGTH="12" NAME="bottomwidth" VALUE="<?php echo $_POST['bottomwidth']; ?>"> <?php echo $lengthunits ?> <P>Side slope z: <INPUT TYPE="text" SIZE="06" MAXLENGTH="12" NAME="sideslope" VALUE="<?php echo $_POST['sideslope']; ?>"> <P>Bottom slope S: <INPUT TYPE="text" SIZE="08" MAXLENGTH="12" NAME="bottomslope" VALUE="<?php echo $_POST['bottomslope']; ?>"> <P>Manning's n: <INPUT TYPE="text" SIZE="08" MAXLENGTH="12" NAME="manningsn" VALUE="<?php echo $_POST['manningsn']; ?>"> </td><td valign="top"> <p><b>INTERMEDIATE CALCS:</b><P> <P>Units selected: <?php echo $unitsystemsname; ?> <P>Gravitational acceleration g: <?php echo $g; ?> <?php echo $accelerationunits ?> <P>Units constant C: <?php echo round($c,3); ?> <P>Wetted perimeter P: <?php echo round($pn,3); ?> <?php echo $lengthunits ?> <P>Top width T: <?php echo round($tn,3); ?> <?php echo $lengthunits ?> <P>Flow area A: <?php echo round($an,2); ?> <?php echo $areaunits ?> <P>Hydraulic radius R: <?php echo round($rn,3); ?> <?php echo $lengthunits ?> <P>Hydraulic depth D: <?php echo round($dn,3); ?> <?php echo $lengthunits ?> </td><td valign="top"> <p><b>OUTPUT:</b><P> <P>Normal flow depth y<sub>n</sub>: <?php echo round($yn,3); ?> <?php echo $lengthunits ?> <P>Normal flow velocity V<sub>n</sub>: <?php echo round($vn,3); ?> <?php echo $velocityunits ?> <P>Normal Froude number F<sub>n</sub>: <?php echo round($fn,3); ?> </td></tr></table> <hr color="000066"> <P> <table cellpadding="4" bgcolor="ffffee" align="center"> <tr> <td bgcolor="880000"><INPUT TYPE="submit" NAME="Submit" VALUE="Calculate"></td> <td> </td> <td bgcolor="880000"><INPUT TYPE="submit" NAME="Submit" VALUE="Reset"></td> </tr> </table> </FORM> <P> <?php echo "<p> Your request was processed at "; echo " "; echo date('h:i:s a \o\n F jS, Y'); ?> [ <?php echo date("ymd");echo (" ");echo date("H:i:s"); ?> ]. <P><hr color="000066"> <DIV align="center" class="heading2"><b>Thank you for running onlinechannel_01. Please call again. [091005]</b></DIV> </td></tr></table> <P> <center> <IMG SRC="http://ponce.sdsu.edu/cgi-bin/Count.cgi?cache=F&expires=0" ALT="Count"> </center> <P><br> </BODY> </HTML>