**5. Numerical results**

**4. Numerical scheme**

*∂T*

*Numerical Modeling and Computer Simulation*

� *k*Δ*p* � *u:*∇*p* þ

Chorin [14] is used for the time discretization:

2.Computation of the pressure *pn*þ<sup>1</sup>

3.Computation of the velocity *un*þ<sup>1</sup>

1.Computation of an intermediate solution *u*<sup>∗</sup>

*<sup>u</sup>*<sup>∗</sup> � *un*

**4.3 Navier-Stokes system**

*<sup>∂</sup><sup>t</sup>* � *<sup>k</sup>*Δ*<sup>T</sup>* <sup>þ</sup> *<sup>u</sup>:*∇*<sup>T</sup>* <sup>þ</sup>

*H* being the maximal mesh element diameter.

*H* ∣*u*∣

*u*Δð Þ *up* |fflfflfflfflfflffl{zfflfflfflfflfflffl} streamline diffusion

The state equation is solved by using a method of ℙ<sup>1</sup> discontinuous Galerkin in

space and implicit finite difference in time. The fluid velocity is very high in relation to its thermal conductivity. To stabilize the induced oscillations, streamline diffusion [12] is introduced in the scheme; hence the solved state equation is as

> *H* ∣*u*∣

As the state equation, the adjoint problem is solved by using a method of ℙ<sup>1</sup> discontinuous Galerkin in space and implicit finite difference in time. Streamline diffusion is introduced in the scheme; hence the solved adjoint state is as follows:

1

CCCA

The Navier-Stokes system is solved by means of a *P*<sup>1</sup> Lagrange finite element method for the velocity and the pressure. The following algorithm proposed by

<sup>Δ</sup>*<sup>t</sup>* ¼ � *un* ð Þ *:*<sup>∇</sup> *un* <sup>þ</sup> *<sup>ν</sup>*Δ*un* <sup>þ</sup> <sup>~</sup>*f n,*

Δ*t*

*un*þ<sup>1</sup> <sup>¼</sup> *<sup>u</sup>*<sup>∗</sup> � <sup>Δ</sup>*t*∇*p<sup>n</sup>*þ<sup>1</sup>

where *u<sup>n</sup>*, *pn*, and ~*f n*, *n* ∈ N<sup>∗</sup> , are, respectively, the approximated velocity, pressure, and source term at the *nth* time step. The mesh is frequently adapted to improve the solution efficiency. For the numerical implementation, the solver of partial differential equations FreeFem++ downloadable at http://www.freefem.org/ff++

∇*:u*<sup>∗</sup> *,*

*,*

<sup>Δ</sup>*pn*þ<sup>1</sup> <sup>¼</sup> <sup>1</sup>

*u*Δð Þ *uT* |fflfflfflfflfflfflffl{zfflfflfflfflfflfflffl} streamline diffusion ¼ *fψ*<sup>1</sup> þ *Uψ*2*,* (37)

ðÞ¼ *<sup>t</sup> <sup>ψ</sup>OBS*ð Þ *<sup>T</sup>* � *Td Tf* � *<sup>t</sup>* � �*:* (38)

**4.1 State equation**

**4.2 Adjoint equation**

*∂p ∂t*

0

BBB@

**30**

follows:

This section presents numerical tests to illustrate the validity of our approach. The river parameters are listed in **Table 1**.

The initial temperature is always constant and equal to *T*<sup>0</sup> ¼ 30°*C*. The initial velocity is given by *u*<sup>0</sup> ¼ 0*m:s* �1. The temperature at the inlet boundary is set to *Tin* ¼ 30°*C*, while the velocity profile is described by the parabolic function:

$$h(\mathbf{x}, \mathbf{y}, t) = u\_{\text{max}} \* \mathbf{y} \* \left(2 - \mathbf{y}\right) \quad m.s^{-1}.\tag{39}$$

*u*max is the maximal value of the velocity. At the outflow boundary, mixed boundary conditions are used with *<sup>α</sup><sup>T</sup>* <sup>¼</sup> <sup>10</sup>�<sup>8</sup> and *<sup>α</sup><sup>u</sup>* <sup>¼</sup> <sup>10</sup>�8. The velocity source at the discharge is given by

$$f\_1 = (\mathbf{0}, -v\_{\text{max}}) \quad m.s^{-1},\tag{40}$$

with *v*max . 0. For the optimal control, the target temperature in the observation area is equal to *Td* ¼ 30°*C*, and the target control is of *Ud* ¼ 0°*C:s* �1. The costefficiency ratio of the objective functional is defined by *β* ¼ 1. The time step is set to Δ*t* ¼ 0*:*1 *s*. The stopping criteria tolerance of the iterative algorithm is given by *tol* ¼ 0*:*02, and the step of the descent gradient algorithm by *τ* ¼ 0*:*5.
