
The unknown water surface elevation at a cross section is determined by an iterative solution of the gradually varied flow
equation (Equation 21) and the energy
head loss
equation (Equation 22).

The computational procedure is as follows:

Assume a water surface elevation WS2 at the upstream cross section (or
downstream cross section if a supercritical profile is being calculated).

Based on the assumed water surface elevation, determine the
corresponding total conveyance and velocity head.

With values from step 2, compute S_{f} and solve Equation 22 for h_{e}.

With values from steps 2 and 3, solve Equation 21 for WS2.

Compare the computed value of WS2 with the value assumed in step
1; repeat steps 1 through 5 until the values agree to within .01 feet (.003 m), or the userdefined tolerance.
 The criterion used to assume water surface elevations in the iterative
procedure varies from trial to trial.
 The first trial water surface is based on projecting the previous cross section's water depth onto the current cross
section.
 The second trial water surface elevation is set to the assumed water surface elevation plus 70% of the error from the first trial
(computed W.S.  assumed W.S.).
 In other words, W.S. new = W.S. assumed + 0.70 * (W.S. computed  W.S. assumed).
 The third and subsequent trials are generally based on a "Secant" method of projecting the rate of
change of the difference between computed and assumed elevations for the previous two trials.

The change from one trial to the next is constrained to a maximum of 50% of the assumed depth from the previous trial.
 On occasion the secant method can fail if the value of error difference becomes too small.

If the error difference is less than 0.01,
then the secant method is not used.
 When this occurs, the program computes a new guess by taking the average of the assumed and computed water surfaces from the previous iteration.

The program is constrained by a maximum number of iterations (the default is 20) for balancing the water surface.
 While the program is iterating, it keeps track of the water surface that produces the minimum amount of error
between the assumed and computed values.
 This water surface is called the minimum error water surface.
 If the maximum number of iterations is
reached before a balanced water surface is achieved, the program will then
calculate critical depth (if this has not already been done).
 The program then checks to see if the error associated with the minimum error water surface is within a predefined
tolerance (the default is 0.3 ft or 0.1 m).
 If the minimum error water surface has an associated error less than the predefined tolerance,
and this water surface is on the correct side of critical depth,
then the program will use this water surface as the final
answer and set a warning message that it has done so.
 If the minimum error water surface has an associated error
that is greater than the predefined tolerance, or it is on the wrong side of
critical depth, the program will use critical depth as the final answer for the
cross section and set a warning message that it has done so.
 The rationale for using the minimum error water surface is that it is probably a better answer
than critical depth, as long as the above criteria are met.
 Both the minimum error water surface and critical depth are only used in this situation to allow
the program to continue the solution of the water surface profile.
 Neither of these two answers are considered to be valid solutions,
and therefore warning messages are issued when either is used.
 In general, when the program
cannot balance the energy equation at a cross section,
it is usually caused by an inadequate number of cross sections
(cross sections spaced too far apart) or bad cross section data.
 Occasionally, this can occur because the program is
attempting to calculate a subcritical water surface when the flow regime is actually supercritical.
 When a balanced water surface elevation has been obtained for a cross section,
checks are made to ascertain that the elevation is on the right side of the critical water surface elevation
(e.g., above the critical elevation if a subcritical profile has been requested by the user).

If the balanced elevation is on the wrong side of the critical water surface elevation,
critical depth is assumed for the cross section and a warning message to that effect is
displayed by the program.
 The program user should be aware of critical depth assumptions and determine
the reasons for their occurrence, because in many cases they result from reach lengths being too long or from
misrepresentation of the effective flow areas of cross sections.
 For a subcritical profile, a preliminary check for proper flow regime involves checking the Froude number.
 The program calculates the Froude number of the balanced
water surface for both the main channel only and the entire cross section.
 If either of these two Froude numbers are greater than 0.94,
then the program will check the flow regime by calculating a more accurate
estimate of critical depth using the minimum specific energy method (this method is described in the next section).
 A Froude number of 0.94 is used instead of 1.0, because the calculation of Froude number
in irregular channels is not accurate.
 Therefore, using a value of 0.94 is conservative,
in that the program will calculate critical depth more often than it may need to.
 For a supercritical profile, critical depth
is automatically calculated for every cross section, which enables a direct comparison between balanced and critical elevations.
