SUMMARYThis paper presents a computational method for water purification using second‐order adjoint equations. In Japan, the waters of polluted rivers are purified by conveying the waters from other rivers into the main rivers or by using outflows from sewage plants. The shallow water flow equation based on the water velocity and elevation and the advection diffusion equation of COD concentration are governing equations. The control problem involves finding a flow velocity into the main river that can reduce the COD concentration as close to the target value as possible. In other words, the problem is to find a water velocity to minimize the performance function, which is the square sum of the discrepancy between the computed and the observed COD concentrations.The present research was motivated by the need to apply water purification controls to practical projects. We have found that the controls occasionally tend to be unstable, and the stability of control must be ensured. By expanding the extended performance function into the Taylor series, the necessary condition for the stationary state is derived. Based on this condition, the first‐and second‐order adjoint equations can be obtained. The backward solution of the adjoint equation leads to the gradient and the Hessian product; these serve as the basis of the quasi‐Newton method. From the condition that the performance function must be minimum, the stability confirmation index can be determined. Using this index, we have derived the trust region method, the computation of which confirms the stability of control.Verification was carried out using a simple channel model. By varying the peak value of the inflow velocity, the outlet velocity has been determined such that the water elevation at the target point is zero. Depending on the peak value of the inflow, unstable control arises; this is determined by the stability confirmation index presented in this paper. The trust region method with the stability confirmation index is shown to be adaptable to judge the stability of control.The present method was applied to the water purification of Teganuma river in Japan. The steady fundamental state was computed with the inflow, outflow, and COD concentration at the inlet being specified. The control velocity at the control point can be determined for a fixed control duration with and without the stability confirmation index. The inflow, outflow, and COD concentration are specified as functions of time. It is shown that this method is suitable for practical use because control stability can be ensured. Moreover, it is also noted that the maximum flow velocity for stable control depending on the given control duration can be obtained. Copyright © 2011 John Wiley & Sons, Ltd.