@@ -27,11 +27,11 @@ |
|
public class StandardStepMethod { |
|
- boolean irregularGeometry =true; |
+ boolean irregularGeometry =false; |
boolean downstreamCrossSections = true; |
boolean useThalwegElevation = false; |
|
- String subFolder = "Test"; |
+ String subFolder = "SeepageTest3"; |
String mainFolder = "C:/Users/Chris/Documents/Java Projects/StandardStepMethod" + File.separator + subFolder ; |
double measuredDownstreamDepth = 7; |
|
@@ -43,7 +43,7 @@ |
//Reach Characteristics |
double manning_n = .035; |
double bedSlope = 0.0004; |
- double seepage = 0; |
+ double seepage = 0.005; |
|
double channelLength = 20000; //Distance between sample x-sections |
int numberOfReaches = 100; //Length between calculated x-section |
@@ -93,17 +93,18 @@ |
this.subFolder = subFolder; |
} |
|
- public void setStreamDirection(boolean downstreamCrossSections){ |
+ public void setSamplingDirection(boolean downstreamCrossSections){ |
this.downstreamCrossSections = downstreamCrossSections; |
} |
|
//gets |
public String getElevationGraphTitle(){ |
- return "Longitudinal Elevation Profile"; |
- } |
- |
- public String getDepthGraphTitle(){ |
- return "Longitudinal Depth Profile"; |
+ if (downstreamCrossSections){ |
+ return "Downstream Longitudinal Elevation Profile.png"; |
+ } |
+ else{ |
+ return "Upstream Longitudinal Elevation Profile.png"; |
+ } |
} |
|
public String getElevationGraphOutputName(){ |
@@ -115,15 +116,6 @@ |
} |
} |
|
- public String getDepthGraphOutputName(){ |
- if (downstreamCrossSections){ |
- return subFolder + " Downstream Longitudinal Depth Profile.png"; |
- } |
- else{ |
- return subFolder + " Upstream Longitudinal Depth Profile.png"; |
- } |
- } |
- |
public String getSummaryTitle(){ |
if (downstreamCrossSections){ |
return subFolder + " Downstream Summary Data"; |
@@ -132,7 +124,7 @@ |
return subFolder + " Upstream Summary Data"; |
} |
} |
- public String getSummaryOuputName(){ |
+ public String getSummaryOutputName(){ |
if (downstreamCrossSections){ |
return subFolder + " Downstream Summary Data.txt"; |
} |
@@ -161,8 +153,7 @@ |
*/ |
|
public void run() throws IOException { |
- |
- calcStandardStepMethod(); |
+ calcStandardStepMethod(); |
}//end run |
|
/** |
@@ -200,8 +191,8 @@ |
numberOfReaches = readLines(mainFolder + File.separator + "reaches.txt"); |
} |
|
- double[][][] elevationArray = new double[numberOfReaches + 1][2][4]; |
- double[][][] depthArray = new double[numberOfReaches + 1][2][4]; |
+ double[][][] crossSectionResultsArray = new double[numberOfReaches + 1][2][4]; |
+ double[][] reachResultsArray = new double[numberOfReaches + 1][2]; |
|
double [][][] crossSectionGeometries; |
double [][] reachProperties; |
@@ -210,8 +201,8 @@ |
reachProperties = setReachProperties(); |
} |
else{ |
- crossSectionGeometries = new double[1][1][1]; |
- reachProperties = new double[1][1]; |
+ crossSectionGeometries = new double[numberOfReaches+1][1][1]; |
+ reachProperties = new double[numberOfReaches+1][1]; |
} |
|
double downstreamDistance = 0; |
@@ -226,9 +217,11 @@ |
|
double length; |
double reachSlope; |
+ double currentReachSeepage; |
|
if (irregularGeometry) { |
length = currentReachProperties[0]; |
+ currentReachSeepage = currentReachProperties[2]; |
if(useThalwegElevation){ |
reachSlope = calcThalwegElevationSlope(currentReach); |
} |
@@ -237,6 +230,7 @@ |
} |
} else { |
length = channelLength/numberOfReaches; |
+ currentReachSeepage = seepage; |
reachSlope = bedSlope; |
} |
|
@@ -255,6 +249,7 @@ |
|
ChannelGeometry USValues = setUSValues(currentCrossSectionGeometry_US, |
currentReachProperties, |
+ length, |
depth_DS); |
double critDepth_US = USValues.calcCriticalDepth(); |
double normDepth_US = USValues.calcNormalDepth(); |
@@ -265,6 +260,7 @@ |
|
USValues = setUSValues(currentCrossSectionGeometry_US, |
currentReachProperties, |
+ length, |
lower); |
double velocity_US = calcVelocity(USValues); |
double frictionSlope_US = calcFrictionSlope(USValues); |
@@ -279,6 +275,7 @@ |
|
USValues = setUSValues(currentCrossSectionGeometry_US, |
currentReachProperties, |
+ length, |
upper); |
velocity_US = calcVelocity(USValues); |
frictionSlope_US = calcFrictionSlope(USValues); |
@@ -300,6 +297,7 @@ |
guessDepth_US = (lower + upper) / 2; |
USValues = setUSValues(currentCrossSectionGeometry_US, |
currentReachProperties, |
+ length, |
guessDepth_US); |
velocity_US = calcVelocity(USValues); |
frictionSlope_US = calcFrictionSlope(USValues); |
@@ -323,6 +321,7 @@ |
guessDepth_US = (lower + upper) / 2; |
USValues = setUSValues(currentCrossSectionGeometry_US, |
currentReachProperties, |
+ length, |
guessDepth_US); |
velocity_US = calcVelocity(USValues); |
frictionSlope_US = calcFrictionSlope(USValues); |
@@ -347,98 +346,50 @@ |
|
|
|
- boolean append_to_file; |
+ |
+ |
if (currentReach == 0) { |
- elevationArray[currentReach] = writeElevationArray(depth_DS, |
+ crossSectionResultsArray[currentReach] = writeCrossSectionResultsArray(depth_DS, |
critDepth_DS, |
normDepth_DS, |
downstreamDistance, |
- bedElevation); |
- depthArray[currentReach] = writeDepthArray(depth_DS, |
- critDepth_DS, |
- normDepth_DS, |
- downstreamDistance, |
- bedElevation); |
- append_to_file = false; |
- String summaryOutputName = getSummaryOuputName(); |
- String summaryTitle = getSummaryTitle(); |
- |
- writeToFile(summaryTitle,append_to_file,summaryOutputName); |
- append_to_file = true; |
- writeToFile("",append_to_file,summaryOutputName); |
- writeToFile("Cross Section " + currentReach + " (Origin): " + downstreamDistance + " m downstream",append_to_file,summaryOutputName); |
- writeToFile(" Depth: " + depth_DS,append_to_file,summaryOutputName); |
- writeToFile(" Critical Depth: " + critDepth_DS,append_to_file,summaryOutputName); |
- writeToFile(" Normal Depth: " + normDepth_DS,append_to_file,summaryOutputName); |
- writeToFile(" Bed Elevation: " + bedElevation,append_to_file,summaryOutputName); |
- writeToFile(" Water Surface Elevation: " + (depth_DS + bedElevation),append_to_file,summaryOutputName); |
- writeToFile("",append_to_file,summaryOutputName); |
- writeToFile("Reach " + (currentReach + 1), append_to_file, summaryOutputName); |
- writeToFile(" Length: " + length, append_to_file, summaryOutputName); |
- writeToFile(" Slope: " + reachSlope, append_to_file, summaryOutputName); |
- writeToFile("",append_to_file,summaryOutputName); |
- |
+ bedElevation, |
+ discharge_DS); |
+ |
downstreamDistance = downstreamDistance + length; |
bedElevation = bedElevation - (reachSlope * length); |
+ discharge_DS = discharge_DS + (currentReachSeepage*length); |
|
- |
- elevationArray[currentReach + 1] = writeElevationArray(guessDepth_US, |
- critDepth_US, |
- normDepth_US, |
- downstreamDistance, |
- bedElevation); |
- depthArray[currentReach + 1] = writeDepthArray(guessDepth_US, |
+ crossSectionResultsArray[currentReach + 1] = writeCrossSectionResultsArray(guessDepth_US, |
critDepth_US, |
normDepth_US, |
downstreamDistance, |
- bedElevation); |
- |
- writeToFile("Cross Section " + (currentReach + 1) + ": " + downstreamDistance + " m downstream",append_to_file,summaryOutputName); |
- writeToFile(" Depth: " + guessDepth_US,append_to_file,summaryOutputName); |
- writeToFile(" Critical Depth: " + critDepth_US,append_to_file,summaryOutputName); |
- writeToFile(" Normal Depth: " + normDepth_US,append_to_file,summaryOutputName); |
- writeToFile(" Bed Elevation: " + bedElevation,append_to_file,summaryOutputName); |
- writeToFile(" Water Surface Elevation: " + (guessDepth_US + bedElevation),append_to_file,summaryOutputName); |
- writeToFile("",append_to_file,summaryOutputName); |
- |
+ bedElevation, |
+ discharge_DS); |
+ reachResultsArray[currentReach] = writeReachResultsArray(length, |
+ reachSlope); |
+ |
} |
else { |
downstreamDistance = downstreamDistance + length; |
+ bedElevation = bedElevation - (reachSlope * length); |
+ discharge_DS = discharge_DS + (currentReachSeepage*length); |
|
- |
- bedElevation = bedElevation - (reachSlope * length); |
- |
- |
- elevationArray[currentReach + 1] = writeElevationArray(guessDepth_US, |
+ crossSectionResultsArray[currentReach + 1] = writeCrossSectionResultsArray(guessDepth_US, |
critDepth_US, |
normDepth_US, |
downstreamDistance, |
- bedElevation); |
- depthArray[currentReach + 1] = writeDepthArray(guessDepth_US, |
- critDepth_US, |
- normDepth_US, |
- downstreamDistance, |
- bedElevation); |
- append_to_file = true; |
- String summaryOutputName = getSummaryOuputName(); |
- writeToFile("Reach " + (currentReach + 1), append_to_file, summaryOutputName); |
- writeToFile(" Length: " + length, append_to_file, summaryOutputName); |
- writeToFile(" Slope: " + reachSlope, append_to_file, summaryOutputName); |
- writeToFile("",append_to_file,summaryOutputName); |
- writeToFile("Cross Section " + (currentReach + 1) + ": " + downstreamDistance + " m downstream",append_to_file,summaryOutputName); |
- writeToFile(" Depth: " + guessDepth_US,append_to_file,summaryOutputName); |
- writeToFile(" Critical Depth: " + critDepth_US,append_to_file,summaryOutputName); |
- writeToFile(" Normal Depth: " + normDepth_US,append_to_file,summaryOutputName); |
- writeToFile(" Bed Elevation: " + bedElevation,append_to_file,summaryOutputName); |
- writeToFile(" Water Surface Elevation: " + (guessDepth_US + bedElevation),append_to_file,summaryOutputName); |
- writeToFile("",append_to_file,summaryOutputName); |
- |
- } |
+ bedElevation, |
+ discharge_DS); |
+ reachResultsArray[currentReach] = writeReachResultsArray(length, |
+ reachSlope); |
+ } |
|
depth_DS = guessDepth_US; |
+ |
} //end for statement |
|
- graphLongitudinalProfile(elevationArray, |
+ graphLongitudinalProfile(crossSectionResultsArray, |
numberOfReaches, |
getElevationGraphTitle(), |
getElevationGraphOutputName(), |
@@ -448,16 +399,9 @@ |
"Normal Depth", |
"Channel Bed Elevation", |
"Elevation (m)"); |
- graphLongitudinalProfile(depthArray, |
- numberOfReaches, |
- getDepthGraphTitle(), |
- getDepthGraphOutputName(), |
- mainFolder, |
- "Water Surface Depth", |
- "Critical Depth", |
- "Normal Depth", |
- "Channel Bed (x-axis)", |
- "Depth (m)"); |
+ writeSummaryFile(crossSectionResultsArray, |
+ reachResultsArray); |
+ |
|
}//end calcStandardStepMethod |
|
@@ -559,10 +503,12 @@ |
double critDepth, |
double normDepth, |
double distance_DS, |
- double bedElevation) { |
+ double bedElevation, |
+ double discharge) { |
|
double[][] results = new double[2][4]; |
results[0][0] = distance_DS; |
+ results[0][1] = discharge; |
results[1][0] = waterDepth + bedElevation; |
results[1][1] = critDepth + bedElevation; |
results[1][2] = normDepth + bedElevation; |
@@ -586,21 +532,32 @@ |
* the current cross-section. |
*/ |
|
- public double[][] writeDepthArray(double waterDepth, |
+ public double[][] writeCrossSectionResultsArray(double waterDepth, |
double critDepth, |
double normDepth, |
double distance_DS, |
- double bedElevation){ |
+ double bedElevation, |
+ double discharge){ |
|
double[][] results = new double[2][4]; |
results[0][0] = distance_DS; |
+ results[0][1] = discharge; |
results[1][0] = waterDepth; |
results[1][1] = critDepth; |
results[1][2] = normDepth; |
+ results[1][3] = bedElevation; |
|
return results; |
}//end writeDepthArray |
|
+ public double[] writeReachResultsArray(double length, |
+ double slope){ |
+ double[] results = new double[2]; |
+ results[0] = length; |
+ results[1] = slope; |
+ return results; |
+ } |
+ |
/** |
* Determines the number of lines in a given text file (including blank lines). |
* |
@@ -880,6 +837,7 @@ |
* @param currentCrossSectionGeometry_US An array containing the xy-points for the |
* upstream cross-section. |
* @param currentReachProperties An array containing the properties of the current reach. |
+ * @param currentReachLength The distance between the up and downstream cross-sections. |
* @param depth The calculated depth of the upstream cross-section. |
* |
* @return A new ChannelGeometry object with the values set for the upstream cross-section. |
@@ -889,6 +847,7 @@ |
|
public ChannelGeometry setUSValues(double[][] currentCrossSectionGeometry_US, |
double[] currentReachProperties, |
+ double currentReachLength, |
double depth) throws IOException { |
|
ChannelGeometry USValues = new ChannelGeometry(); |
@@ -898,14 +857,14 @@ |
USValues.setXYPoints(currentCrossSectionGeometry_US); |
USValues.setDepth(depth); |
double currentReachSeepage = currentReachProperties[2]; |
- USValues.setDischarge(discharge_DS + currentReachSeepage); |
+ USValues.setDischarge(discharge_DS+(currentReachSeepage*currentReachLength)); |
USValues.setManningRoughness(currentReachProperties[1]); |
USValues.setBedSlope(currentReachProperties[3]); |
} else { |
USValues.setBottomWidth(bottomWidth); |
USValues.setSideSlope(sideSlope); |
USValues.setDepth(depth); |
- USValues.setDischarge(discharge_DS + seepage); |
+ USValues.setDischarge(discharge_DS+(seepage*currentReachLength)); |
USValues.setManningRoughness(manning_n); |
USValues.setBedSlope(bedSlope); |
} |
@@ -984,15 +943,15 @@ |
//Graph data |
XYSeries series1 = new XYSeries(series1_name); |
for (int i = 0; i < numberOfReaches + 1; i++) { |
- series1.add(resultsArray[i][0][0], resultsArray[i][1][0]); |
+ series1.add(resultsArray[i][0][0], resultsArray[i][1][0]+resultsArray[i][1][3]); |
} |
XYSeries series2 = new XYSeries(series2_name); |
for (int i = 0; i < numberOfReaches + 1; i++) { |
- series2.add(resultsArray[i][0][0], resultsArray[i][1][1]); |
+ series2.add(resultsArray[i][0][0], resultsArray[i][1][1]+resultsArray[i][1][3]); |
} |
XYSeries series3 = new XYSeries(series3_name); |
for (int i = 0; i < numberOfReaches + 1; i++) { |
- series3.add(resultsArray[i][0][0], resultsArray[i][1][2]); |
+ series3.add(resultsArray[i][0][0], resultsArray[i][1][2]+resultsArray[i][1][3]); |
} |
XYSeries series4 = new XYSeries(series4_name); |
for (int i = 0; i < numberOfReaches + 1; i++) { |
@@ -1049,7 +1008,52 @@ |
} catch (IOException e) { |
System.err.println("A problem occurred while trying to create the chart."); |
} |
- }//end graphRatingCurve |
+ }//end graphLongitudinalProfile |
+ |
+ /** |
+ * Creates a text file in the selected folder that summarizes the calculated |
+ * values from the standard step method. |
+ * |
+ * @param depthArray A 3-dimensional array containing all the calculated values |
+ * for every cross-section. |
+ * @param reachArray A 2-dimensional array containing all the calculated values |
+ * for every reach. |
+ * |
+ * @throws IOException |
+ */ |
+ |
+ public void writeSummaryFile(double[][][] depthArray, |
+ double[][] reachArray)throws IOException{ |
+ |
+ boolean append_to_file = false; |
+ String summaryTitle = getSummaryTitle(); |
+ String summaryOutputName = getSummaryOutputName(); |
+ int numberOfCrossSections = depthArray.length; |
+ |
+ try{ |
+ writeToFile(summaryTitle,append_to_file,summaryOutputName); |
+ for(int i = 0; i<numberOfCrossSections; i++){ |
+ append_to_file = true; |
+ writeToFile("",append_to_file,summaryOutputName); |
+ writeToFile("Cross Section " + i + ": " + depthArray[i][0][0] + " m downstream",append_to_file,summaryOutputName); |
+ writeToFile(" Depth: " + depthArray[i][1][0]+" m",append_to_file,summaryOutputName); |
+ writeToFile(" Discharge: " + depthArray[i][0][1]+" m^3/s",append_to_file,summaryOutputName); |
+ writeToFile(" Critical Depth: " + depthArray[i][1][1]+" m",append_to_file,summaryOutputName); |
+ writeToFile(" Normal Depth: " + depthArray[i][1][2]+" m",append_to_file,summaryOutputName); |
+ writeToFile(" Bed Elevation: " + depthArray[i][1][3]+" m (above origin)",append_to_file,summaryOutputName); |
+ writeToFile(" Water Surface Elevation: " + (depthArray[i][1][0] + depthArray[i][1][3])+ " m (above origin)",append_to_file,summaryOutputName); |
+ writeToFile("",append_to_file,summaryOutputName); |
+ writeToFile("Reach " + (i+1)+":", append_to_file, summaryOutputName); |
+ writeToFile(" Length: " + reachArray[i][0]+" m", append_to_file, summaryOutputName); |
+ writeToFile(" Slope: " + reachArray[i][1]+" m/m", append_to_file, summaryOutputName); |
+ writeToFile("",append_to_file,summaryOutputName); |
+ } |
+ System.out.println(mainFolder + File.separator + summaryOutputName); |
+ } |
+ catch(IOException e){ |
+ System.out.println("A problem occured while trying to create the Summary Table."); |
+ } |
+ } |
|
/** |
* Writes a given line to a text file. |