Step 4: Refine and implement a solution

The estimates in Step 3 can be improved by zooming in on the portion of the graph near the sag time. A more sophisticated approach is to observe that the minimum DO level occurs when the oxygen deficit is at its maximum value. Moreover, the maximum deficit occurs at the instant in time when the tangent line to the graph of [Maple Math] is horizontal. This condition is equivalent to finding the time when the right-hand side of the Streeter-Phelps equation is zero.

> eqnD;

[Maple Math]

> Dhoriz_eqn := rhs(eqnD) = 0;

[Maple Math]

The explicit solution to the Streeter-Phelps and remaining BOD equations are already known"

> solnD; solnL;

[Maple Math]

[Maple Math]

>

Substitution of these solutions into the right-hand side of the Streeter-Phelps equation can be done in two steps. First, replace [Maple Math] with [Maple Math] and [Maple Math] with [Maple Math] :

> sag_eqn := eval( Dhoriz_eqn, [ L(t)=L, DD(t)=DD ] );

[Maple Math]

Second, substitute the exact solutions into the equation:

> sag_eqn := eval( sag_eqn, [ solnL, solnD ] );

[Maple Math]

>

In this form the sag equation looks rather forbidding. Notice, however, that the equation is actually only a linear combination of two exponential functions:

> sag_eqn := collect( sag_eqn, { exp(-kd*t), exp(-kr*t) } );

[Maple Math]

Further simplification of this expression is possible, but is not particularly useful at this point.

>

The sag time predicted by this equation is:

> tcrit := solve( sag_eqn, {t} );

[Maple Math]

>