**3.3 Explicit gradient**

�*k ∂w*<sup>λ</sup> *∂n*

*Numerical Modeling and Computer Simulation*

satisfying

! <sup>þ</sup> *<sup>α</sup><sup>T</sup> <sup>u</sup>: <sup>n</sup>*

! � �

with *<sup>C</sup>* . 0 [13]. The functional spaces are defined by *<sup>H</sup>* <sup>¼</sup> *<sup>L</sup>*<sup>2</sup>

*<sup>V</sup>* <sup>¼</sup> *<sup>v</sup>*<sup>∈</sup> *<sup>H</sup>*<sup>1</sup>

lim λ!0

*3.2.2 Directional derivative computation*

A direct computation gives us

2 ð *Tf*

2 ð *Tf*

0

*∂wu*

�*k ∂wu ∂n*

ð *Tf*

0

0

By dividing this last equality by λ, it becomes

<sup>λ</sup> is solution of the equation:

! <sup>þ</sup> *<sup>α</sup><sup>T</sup> <sup>u</sup>: <sup>n</sup>*

*<sup>∂</sup><sup>t</sup>* � *<sup>k</sup>*Δ*wu* <sup>þ</sup> *<sup>u</sup>:*∇*wu* <sup>¼</sup> *<sup>h</sup>ψ*<sup>2</sup> in <sup>Ω</sup>��0*, Tf* <sup>½</sup>*,*

*wu*ð Þ¼ 0 0 on Ω*:*

�*k ∂wu ∂n*

! � �

By passing to the limit λ ! 0, the directional derivative is written

<sup>~</sup>*J U*ð Þ� <sup>þ</sup> *<sup>λ</sup><sup>h</sup>* <sup>~</sup>*J U*ð Þ¼ <sup>1</sup>

<sup>~</sup>*J U*ð Þ� <sup>þ</sup> *<sup>λ</sup><sup>h</sup>* <sup>~</sup>*J U*ð Þ

where *wu* <sup>¼</sup> *<sup>w</sup>*<sup>λ</sup>

~*J*0

**26**

ð Þ� *U h* ¼

<sup>λ</sup> <sup>¼</sup> <sup>1</sup>

It can be deduced from the preceding inequality that

*<sup>w</sup>*<sup>λ</sup> <sup>¼</sup> 0 in *<sup>L</sup>*<sup>2</sup>

*w*<sup>λ</sup> ¼ 0 on Γ*OUT*��0*, Tf* ½*,*

(19)

(23)

(24)

(25)

ð Þ Ω and

� �*; H* � �*:* (22)

*w*λð Þ¼ 0 0 on Ω*:*

If *<sup>u</sup>* <sup>∈</sup>*L*<sup>∞</sup>ð � <sup>Ω</sup>� <sup>0</sup>*, Tf* ½Þ, this previous system admits a unique weak solution

<sup>∥</sup>*w*λ∥*L*2ð�0*,Tf* ½ Þ *;<sup>V</sup>* <sup>þ</sup> <sup>∥</sup>*w*λ∥*<sup>C</sup>* ½ � <sup>0</sup>*;Tf* ð Þ *;<sup>H</sup>* <sup>þ</sup> <sup>∥</sup>*w*λ∥*L*2ð�0*,Tf ;L*<sup>2</sup> ½ Þ ð Þ <sup>Γ</sup>*OUT* <sup>≤</sup>*Cλ*∥*h*∥*L*2ð�0*,Tf* ½ Þ *;*U*ad :* (20)

ð Þ Ω such that *v* ¼ 0 on Γ*IN*

ð�0*, Tf* ½ Þ *;V* ∩*C* 0*; Tf*

� �*:* (21)

, ð Þ *T*<sup>λ</sup> þ *T* � 2*Td ψOBS; w*<sup>λ</sup> . þ , *λβ*ð Þ 2ð Þþ *U* � *Ud λh ψ*<sup>2</sup> ð Þ *; h* . *dt:*

, ð Þ *T*<sup>λ</sup> þ *T* � 2*Td ψOBS; wu* . þ , *β*ð Þ 2ð Þþ *U* � *Ud λh ψ*<sup>2</sup> ð Þ *; h* . *dt,*

*wu* ¼ 0 on Γ*IN*��0*, Tf* ½*,*

! <sup>¼</sup> <sup>0</sup> on <sup>Γ</sup>*N*��0*, Tf* <sup>½</sup>*,*

*wu* ¼ 0 on Γ*OUT*��0*, Tf* ½*,*

, ð Þ *T* � *Td ψOBS; wu* . þ , *β*ð Þ *U* � *Ud ψ*<sup>2</sup> ð Þ *; h* . *dt:* (26)

Equation (25) is multiplied by the adjoint function *p*~ and integrated over Ω��0*, Tf* ½. The result is

$$\int\_{0}^{T\_{f}} < h\nu\_{\Omega \circ}\bar{p} > dt = \int\_{0}^{T\_{f}} < \frac{\partial w\_{u}}{\partial t} - k\Delta w\_{u} + u.\nabla w\_{u}, \bar{p} > dt. \tag{28}$$

Integrations by parts lead to

$$\int\_{0}^{T\_{f}} < h\nu\_{\Omega\_{2}}, \bar{p} > dt = \int\_{0}^{T\_{f}} < -\partial \frac{\bar{p}}{\partial t} - k\Delta \bar{p} - u. \nabla \bar{p}, w\_{u} > dt + I\_{1} + I\_{2},\tag{29}$$

where

\*  $I\_1 = \int\_{\Omega} (\boldsymbol{\omega}\_u(T\_f)\boldsymbol{\tilde{p}}\left(T\_f\right) - \boldsymbol{w}\_u(\mathbf{0})\boldsymbol{\tilde{p}}\left(\mathbf{0}\right))d\mathbf{x},$  
\*  $I\_2 = \int\_0^{T\_f} \int\_{\partial\Omega} \left( \left( k\partial\frac{\boldsymbol{\tilde{p}}}{\partial\boldsymbol{\tilde{n}}} + \boldsymbol{\alpha}\_T\left(\boldsymbol{u}\cdot\boldsymbol{\tilde{n}}\right)\boldsymbol{\tilde{p}}\right)\boldsymbol{\tilde{p}}\left(\boldsymbol{w}\_u - k\frac{\partial\boldsymbol{w}\_u}{\partial\boldsymbol{\tilde{n}}}\boldsymbol{\tilde{p}}\right) d\boldsymbol{\sigma}d\boldsymbol{t}.$ 

By using the initial and boundary conditions of *wu*, the terms *I*<sup>1</sup> and *I*<sup>2</sup> become

\*  $I\_1 = 
∫\_{
Δ} 
μ\_u(T\_f) 
μ
(T\_f) dx$ , 

$$
√{
κ

μ\_u
}\_{
κ

μ\_u
(T\_f)
∣
}$$

$$\bullet \ I\_2 = \int\_0^{T\_f} \left( -\int\_{\Gamma \mathcal{N}} k \frac{\partial u\_{\mathbf{u}}}{\partial \vec{n}} \, \tilde{p} \, d\sigma + \int\_{\Gamma \mathcal{N}} \left( k \frac{\partial \tilde{p}}{\partial \vec{n}} + \alpha\_T \left( \mu \cdot \vec{n} \right) \check{p} \right) w\_{\mathbf{u}} d\sigma + \int\_{\Gamma \mathcal{O} \mathcal{T}} k \frac{\partial \check{p}}{\partial \vec{n}} w\_{\mathbf{u}} d\sigma \right) dt \dots$$

From the condition *u* ¼ 0 on Γ*N*, it becomes

$$I\_2 = \int\_0^{T\_f} \left( -\int\_{\Gamma\_{IN}} k \frac{\partial \boldsymbol{w}\_{\boldsymbol{n}}}{\partial \vec{\boldsymbol{n}}} \boldsymbol{\bar{p}} d\boldsymbol{\sigma} + \int\_{\Gamma\_N} \boldsymbol{\chi}\_{\boldsymbol{n}\boldsymbol{U}\boldsymbol{U}\boldsymbol{T}} k \frac{\partial \vec{\boldsymbol{p}}}{\partial \vec{\boldsymbol{n}}} \boldsymbol{w}\_{\boldsymbol{n}} d\boldsymbol{\sigma} \right) d\boldsymbol{t} \,\boldsymbol{I}$$

Hence, we assume that *p*~ is solution of the adjoint problem:

$$-\frac{\partial \bar{\tilde{p}}}{\partial t} - k \Delta \bar{\tilde{p}} - \mu . \nabla \bar{\tilde{p}} = (T - T\_d) \nu\_{\text{ORS}} \text{ in } \Omega \times ]0, \ T\_f[,$$

$$\bar{\tilde{p}} = \mathbf{0} \text{ on } \Gamma\_{IN} \times ]0, \ T\_f[, \tag{30}$$

$$k \frac{\partial \bar{\tilde{p}}}{\partial \bar{\tilde{n}}} = \mathbf{0} \text{ on } (\Gamma\_N \cup \Gamma\_{OUT}) \times ]0, \ T\_f[, $$

$$\bar{\tilde{p}}(T) = \mathbf{0} \text{ on } \overline{\Omega}.$$

Consequently, it becomes *I*<sup>1</sup> ¼ 0, *I*<sup>2</sup> ¼ 0, and

$$\int\_{0}^{T\_f} < h\nu\_{\Omega\_l}, \tilde{p} \ge dt = \int\_{0}^{T\_f} < (T - T\_d)\nu\_{\partial \text{BS}}, w\_u \ge dt. \tag{31}$$

A change of variables *p x*ð Þ¼ *; <sup>t</sup> p x* <sup>~</sup> *; Tf* � *<sup>t</sup>* is made where *<sup>p</sup>* is the solution of

*p* ¼ 0 on Γ*IN*��0*, Tf* ½*,*

<sup>∇</sup>~*J U*ð ÞðÞ¼ *<sup>t</sup> p Tf* � *<sup>t</sup>* <sup>þ</sup> *<sup>β</sup>*ð Þ *<sup>U</sup>* � *Ud* ð Þ*<sup>t</sup> <sup>ψ</sup>*<sup>Ω</sup><sup>2</sup>

This gradient allows to solve the minimization problem (12). The gradient

descent algorithm with a fixed step. And finally, this optimal control is used in the state equation to simulate the fluid temperature propagation. The optimal control is

**Input**: Initial control: *<sup>U</sup>*<sup>0</sup>ð Þ*<sup>t</sup>* , Maximal number of iterations: *<sup>m</sup>*max, Tolerance: *tol*.

! <sup>¼</sup> <sup>0</sup> on ð Þ�� <sup>Γ</sup>*<sup>N</sup>* <sup>∪</sup> <sup>Γ</sup>*OUT* <sup>0</sup>*, Tf* <sup>½</sup>*,*

ðÞ¼ *<sup>t</sup> <sup>ψ</sup>OBS*ð Þ *<sup>T</sup>* � *Td Tf* � *<sup>t</sup>* in <sup>Ω</sup>��0*, Tf* <sup>½</sup>*,*

(34)

*:* (35)

to obtain the fluid

, is computed by means of a

ðÞ¼ *<sup>t</sup> <sup>U</sup><sup>m</sup>*ðÞ�*<sup>t</sup> <sup>τ</sup>*∇~*J U<sup>m</sup>* ð Þð Þ*<sup>t</sup> ,* (36)

*∂p ∂t*

The gradient becomes

**3.4 Iterative algorithm**

the limit of the sequence:

**Algorithm 1.**

**29**

*Optimal control algorithm.*

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

*DOI: http://dx.doi.org/10.5772/intechopen.88646*

*k ∂p ∂n*

*Optimal Control of Thermal Pollution Emitted by Power Plants*

descent algorithm is used to compute the optimal control.

First, the Navier-Stokes system is solved on Ω � 0*; Tf*

velocity. Secondly, the optimal control *U t*ð Þ, *t* ∈ 0*; Tf*

*<sup>U</sup>*<sup>0</sup>ð Þ*<sup>t</sup>* <sup>∈</sup>U*ad, U<sup>m</sup>*þ<sup>1</sup>

This algorithm is summarized by **Figure 4**.

*τ* being the step. The algorithm used is described as follows:

*p*ð Þ¼ 0 0 on Ω*:*

Using this above equality in relation (26), we obtain

$$\tilde{f}'(U) \cdot h = \int\_0^{T\_f} \le (\tilde{p} + \beta(U - U\_d)) \mu\_{\Omega\_2^\*} h \ge dt,\tag{32}$$

hence

$$
\nabla \tilde{J}(U) = \left(\tilde{p} + \beta(U - U\_d)\right) \tilde{\mu}\_{\Omega\_2}.\tag{33}
$$

A change of variables *p x*ð Þ¼ *; <sup>t</sup> p x* <sup>~</sup> *; Tf* � *<sup>t</sup>* is made where *<sup>p</sup>* is the solution of

$$\left(\frac{\partial \overline{p}}{\partial t} - k \Delta \overline{p} - u . \nabla \overline{p}\right)(t) = \boldsymbol{\nu}\_{OLS}(T - T\_d)(T\_f - t) \text{ in } \Omega \times ]0, T\_f[.$$

$$\overline{p} = \mathbf{0} \text{ on } \Gamma\_{IN} \times ]0, T\_f[. \tag{34}$$

$$k \frac{\partial \overline{p}}{\partial \overrightarrow{n}} = \mathbf{0} \text{ on } (\Gamma\_N \cup \Gamma\_{OUT}) \times ]0, T\_f[. $$

$$\overline{p}(0) = \mathbf{0} \text{ on } \overline{\Omega}.$$

The gradient becomes

ð *Tf*

*Numerical Modeling and Computer Simulation*

, *hψ*<sup>Ω</sup><sup>2</sup> *, p*~ . *dt* ¼

Using this above equality in relation (26), we obtain

ð *Tf*

0

*Flow chart of the iterative algorithm of the solution to the optimal control problem.*

ð Þ� *U h* ¼

ð *Tf*

, ð Þ *T* � *Td ψOBS, wu* . *dt:* (31)

, *<sup>p</sup>*<sup>~</sup> <sup>þ</sup> *<sup>β</sup>*ð ÞÞ *<sup>U</sup>* � *Ud <sup>ψ</sup>*<sup>Ω</sup><sup>2</sup> *, h* . *dt,* � (32)

<sup>∇</sup>~*J U*ð Þ¼ *<sup>p</sup>*<sup>~</sup> <sup>þ</sup> *<sup>β</sup>*ð ÞÞ *<sup>U</sup>* � *Ud <sup>ψ</sup>*<sup>Ω</sup><sup>2</sup> *:* � (33)

0

0

~*J* 0

hence

**Figure 4.**

**28**

$$
\nabla \tilde{U}(U)(t) = \left(\overline{p}(T\_f - t) + \beta (U - U\_d)(t)\right) \mu\_{\Omega\_2}.\tag{35}
$$

This gradient allows to solve the minimization problem (12). The gradient descent algorithm is used to compute the optimal control.

#### **3.4 Iterative algorithm**

First, the Navier-Stokes system is solved on Ω � 0*; Tf* to obtain the fluid velocity. Secondly, the optimal control *U t*ð Þ, *t* ∈ 0*; Tf* , is computed by means of a descent algorithm with a fixed step. And finally, this optimal control is used in the state equation to simulate the fluid temperature propagation. The optimal control is the limit of the sequence:

$$U^0(t) \in \mathcal{U}\_{ad}, \quad U^{m+1}(t) = U^m(t) - \tau \nabla \tilde{f}(U^m)(t), \tag{36}$$

*τ* being the step. The algorithm used is described as follows: **Input**: Initial control: *<sup>U</sup>*<sup>0</sup>ð Þ*<sup>t</sup>* , Maximal number of iterations: *<sup>m</sup>*max, Tolerance: *tol*. This algorithm is summarized by **Figure 4**.

 $\text{a } m \gets 0.$  $\text{a } m \gets 0.$  $\text{a } m \gets m \max\_{\text{a } \text{b}} \text{ and } \frac{|\nabla \bar{J}(U^m)(t)|}{|\nabla \bar{J}(U^0)(t)|} > tol \text{ do}$ 

$$\frac{\partial T}{\partial t} - k\Delta T + u.\nabla T = f\psi\_1 + U^m\psi\_2,$$

$$\left(\frac{\partial \overline{p}}{\partial t} - k \Delta \overline{p} - u.\nabla \overline{p}\right)(t) = \psi\_{OBS} \left(T - T\_d\right)(T\_f - t),$$

$$U^{m+1}(t) = U^m(t) - \tau \nabla \vec{J}(U^m)(t).$$

**Algorithm 1.** *Optimal control algorithm.*
