1 Introduction

The simplest form of the Cahn–Hilliard equation with or without viscosity (see [3, 12, 13]) reads as follows

$$\begin{aligned} \partial _{t}y - \Delta w = 0 \quad \hbox {and}\quad w = \tau \partial _{t}y {-\Delta y +} {\fancyscript{W}}'(y) \quad \text {in }\Omega \times (0,T) \end{aligned}$$
(1.1)

where \(\Omega \) is the domain where the evolution takes place, \(y\) and \(w\) denote the order parameter and the chemical potential, respectively, and \(\tau \ge 0\) is the viscosity coefficient. Moreover, \({\fancyscript{W}}'\) represents the derivative of a double well potential \({\fancyscript{W}}\), and typical and important examples are the classical regular potential \({\fancyscript{W}}_{reg}\) and the logarithmic double-well potential \({\fancyscript{W}}_{log}\) given by

$$\begin{aligned}&{\fancyscript{W}}_{reg}(r) = \frac{1}{4}(r^2-1)^2 \,,\quad r \in {\mathbb {R}}\end{aligned}$$
(1.2)
$$\begin{aligned}&{\fancyscript{W}}_{log}(r) = ((1+r)\ln (1+r)+(1-r)\ln (1-r)) - c r^2 \,,\quad r \in (-1,1) \end{aligned}$$
(1.3)

where \(c>0\) in the latter is large enough in order to kill convexity.

Moreover, an initial condition like \(y(0)=y_{0}\) and suitable boundary conditions must complement the above equations. As far as the latter are concerned, the most common ones in the literature are the usual no-flux conditions for both \(y\) and \(w\). However, different boundary conditions have been recently proposed: namely, still the usual no-flux condition for the chemical potential

$$\begin{aligned} (\partial _{n}w){}_{|_{\Gamma }}=0\quad \text {on }\Gamma \times (0,T) \end{aligned}$$
(1.4)

in order to preserve mass conservation, and the dynamic boundary condition

$$\begin{aligned} (\partial _{n}y){}_{|_{\Gamma }}+ \partial _{t}y_{\Gamma }- \Delta _\Gamma y_{\Gamma }+ {\fancyscript{W}}'_\Gamma (y_{\Gamma }) = u_{\Gamma }\quad \text {on }\Gamma \times (0,T) \end{aligned}$$
(1.5)

where \(y_{\Gamma }\) denotes the trace \(y{}_{|_{\Gamma }}\) on the boundary \(\Gamma \) of \(\Omega \), \(\Delta _\Gamma \) stands for the Laplace–Beltrami operator on \(\Gamma \), \({\fancyscript{W}}'_\Gamma \) is a nonlinearity analoguous to \({\fancyscript{W}}'\) but now acting on the boundary value of the order parameter, and finally \(u_{\Gamma }\) is a boundary source term. We just quote, among other contributions, [5, 18, 21, 23, 24, 28] and especially the papers [14] and [10]. In the former, the reader can find the physical meaning and free energy derivation of the boundary value problem given by (1.1) and (1.4)–(1.5), besides the mathematical treatment of the problem itself. The latter provides existence, uniqueness and regularity results for the same boundary value problem by assuming that the dominating potential is the boundary potential \({\fancyscript{W}}_\Gamma \) rather than the bulk potential \({\fancyscript{W}}\) (thus, in contrast to [14]) and thus it is close from this point of view to [4], where the Allen–Cahn equation with dynamic boundary condition is studied (see also [7] in which a mass constraint is considered, too).

The aim of this paper is to study an associated optimal boundary control problem, the control being the forcing term \(u_{\Gamma }\) that appears on the right-hand side of the dynamic boundary condition (1.5). While numerous investigations deal with the well-posedness and asymptotic behavior of Cahn–Hilliard systems, there are comparatively few contributions dedicated to aspects of optimal control. Usually, these papers treat the non-viscous case (\(\tau =0\)) and are restricted to distributed controls, with the no-flux boundary condition \(\,(\partial _n y)_{|_\Gamma }=0\,\) assumed in place of the more difficult dynamic boundary condition (1.5). In this connection, we refer to [27] and [15], where the latter paper also applies to the case in which the differentiable potentials (1.2) or (1.3) are replaced by the non-differentiable “double obstacle potential” given by

$$\begin{aligned} {\mathcal{W}_{2obst}(r)= \left\{ \begin{array}{cl} c\,(1-r^2) &{} \text { if } \,|r|\le 1\\ + \infty &{} \text { if } \,|r| >1 \end{array} \right. \quad \,\text {for some }c>0.} \end{aligned}$$
(1.6)

Note that in this case the second equation in (1.1) has to be interpreted as a differential inclusion, since \({\fancyscript{W}}'\) cannot be a usual derivative. Instead, the derivative of the convex part of \({\fancyscript{W}}\) is given by \(\partial I_{[-1, 1]}\), the subdifferential of the indicator function of the interval \([-1,1]\), which is defined by

$$\begin{aligned} s \in \partial I_{[-1, 1]} (r)\quad \text { if and only if } \quad s \ \left\{ \begin{array}{ll} \displaystyle \le \, 0 \ &{}\text {if } \ r=-1\\ = 0 \ &{}\text {if } \ -1< r < 1\\ \ge 0 \ &{}\text {if } \ r = 1 \,.\\ \end{array} \right. \end{aligned}$$
(1.7)

We remark that the double obstacle case is particularly challenging from the viewpoint of optimal control, because this case is well known to fall into the class of “Mathematical Programs with Equilibrium Constraints (MPEC) Problems”; indeed, the corresponding state system then contains a differential inclusion for which all of the standard nonlinear programming constraint qualifications are violated so that the existence of Lagrange multipliers cannot be shown via standard techniques.

Quite recently, also convective Cahn–Hilliard systems have been investigated from the viewpoint of optimal control. In this connection, we refer to [29] and [30], where the latter paper deals with the spatially two-dimensional case. The three-dimensional case with a nonlocal potential is studied in [25]. There also exist contributions dealing with discretized versions of the more general Cahn–Hilliard–Navier–Stokes system, cf. [17] and [16]. Finally, we mention the contributions [8] and [9], in which control problems for a generalized Cahn–Hilliard system introduced in [22] are investigated.

To the authors’ best knowledge, there are presently no contributions to the optimal boundary control of viscous or non-viscous Cahn–Hilliard systems with dynamic boundary conditions of the form (1.5). We are aware, however, of the recent contributions [11] and [6] for the corresponding Allen–Cahn equation. In particular, [11] treats both the cases of distributed and boundary controls for logarithmic-type potentials as in (1.3). More precisely, both the existence of optimal controls and twice continuous Fréchet differentiability for the well-defined control-to-state mapping were established, as well as first-order necessary and second-order sufficient optimality conditions. The related paper [6] deals with the existence of optimal controls and the derivation of first-order necessary conditions of optimality for the more difficult case of the double obstacle potential. The method used consists in performing a so-called “deep quench limit” of the problem studied in [11].

As mentioned above, the recent paper [10] contains a number of results that regard the problem obtained by complementing the equations (1.1) with the already underlined initial and boundary conditions, namely,

$$\begin{aligned}&\partial _{t}y - \Delta w = 0\quad \text {in }\, Q:=\Omega \times (0,T)\end{aligned}$$
(1.8)
$$\begin{aligned}&w = \tau \, \partial _{t}y - \Delta y + {\fancyscript{W}}'(y)\quad \text {in }\,Q\end{aligned}$$
(1.9)
$$\begin{aligned}&\partial _{n}w = 0\quad \text {on }\, \Sigma := \Gamma \times (0,T)\end{aligned}$$
(1.10)
$$\begin{aligned}&y_{\Gamma }= y{}_{|_{\Gamma }}\quad \hbox {and}\quad \partial _{t}y_{\Gamma }+ (\partial _{n}y){}_{|_{\Gamma }}- \Delta _\Gamma y_{\Gamma }+ {\fancyscript{W}}'_\Gamma (y_{\Gamma }) = u_{\Gamma }\quad \text {on }\, \Sigma \end{aligned}$$
(1.11)
$$\begin{aligned}&y(0) = y_{0}\quad \text {in }\, \Omega . \end{aligned}$$
(1.12)

More precisely, existence, uniqueness and regularity results were proved for general potentials that include (1.2)–(1.3) and (1.6), and are valid for both the viscous and non-viscous cases, i.e., by assuming just \(\tau \ge 0\). Moreover, further regularity of the solution was ensured provided that \(\tau >0\) and too singular potentials like (1.6) were excluded. Furthermore, results for the linearization around a solution were given as well. In such a problem, \({\fancyscript{W}}'(y)\) and \({\fancyscript{W}}'_\Gamma (y_{\Gamma })\) are replaced by \(\lambda \,y\) and \(\lambda _\Gamma y_{\Gamma }\), for some given functions \(\lambda \) and \(\lambda _\Gamma \) on \(Q\) and \(\Sigma \), respectively. Therefore, the proper material is already prepared for the control problem to be studied here.

Among several possibilities, we choose the tracking-type cost functional

$$\begin{aligned} \fancyscript{J}(y,y_{\Gamma },u_{\Gamma }):= & {} \frac{b_{Q}}{2} \, \left\| y-z_{Q} \right\| _{L^2(Q)}^2+ \frac{b_{\Sigma }}{2} \, \left\| {y_{\Gamma }}-z_{\Sigma } \right\| _{L^2(\Sigma )}^2+ \frac{b_{\Omega }}{2} \, \left\| y(T)-z_{\Omega } \right\| _{L^2(\Omega )}^2\nonumber \\&+\, \frac{b_{\Gamma }}{2} \, \left\| y_{\Gamma }(T)-z_{\Gamma } \right\| _{L^2(\Gamma )}^2+ \frac{b_{0}}{2} \, \left\| u_{\Gamma } \right\| _{L^2(\Sigma )}^2 \end{aligned}$$
(1.13)

where the functions \(z_Q, z_\Sigma ,z_\Omega ,z_\Gamma \) and the nonnegative constants \(b_{Q},b_{\Sigma },b_{\Omega },b_{\Gamma },b_{0}\) are given. The control problem then consists in minimizing (1.13) subject to the state system (1.8)–(1.12) and to the constraint \(u_{\Gamma }\in {\fancyscript{U}}_{{\mathrm{ad}}}\), where the control box \({\fancyscript{U}}_{{\mathrm{ad}}}\) is given by

$$\begin{aligned}&{\fancyscript{U}}_{{\mathrm{ad}}}:= \bigl \{ u_{\Gamma }\in H^{1}(0,T;H_{\Gamma })\cap L^{\infty }(\Sigma ):\nonumber \\&\qquad \qquad \ u_{\Gamma , \mathrm{min}}\le u_{\Gamma }\le u_{\Gamma , \mathrm{max}}\ \hbox {a.e. on }\Sigma ,\ \left\| \partial _{t}u_{\Gamma } \right\| _2\le M_{0}\bigr \} \end{aligned}$$
(1.14)

for some given functions \(u_{\Gamma , \mathrm{min}},u_{\Gamma , \mathrm{max}}\in L^{\infty }(\Sigma )\) and some prescribed positive constant \(M_{0}\). In this paper, we confine ourselves to the viscous case \(\tau >0\) and avoid potentials like (1.6), in order to be able to apply all of the results proved in [10]. However, regular and singular potentials like (1.2) and (1.3) are allowed. In this framework, we prove both the existence of an optimal control \(\overline{u}_{\Gamma }\) and first-order necessary conditions for optimality. To this end, we show the Fréchet differentiability of the control-to-state mapping and introduce and solve a proper adjoint problem, which consists in a backward Cauchy problem for the system

$$\begin{aligned}&q = -\Delta p\quad \hbox {and}\quad {- \partial _{t}(p+q) - \Delta q + \lambda q = \varphi }\quad \text {in }Q\end{aligned}$$
(1.15)
$$\begin{aligned}&\partial _{n}p = 0\quad \hbox {and}\quad \partial _{t}q_{\Gamma }+ \partial _{n}q - \Delta _\Gamma q_{\Gamma }+ \lambda _\Gamma q_{\Gamma }= \varphi _\Gamma \quad \text {on }\Sigma , \end{aligned}$$
(1.16)

where \(q_{\Gamma }\) is the trace \(q{}_{|_{\Gamma }}\) of \(q\) on the boundary, and where the functions \(\lambda \), \(\lambda _\Gamma \), \(\varphi \) and \(\varphi _\Gamma \) are suitably related to the functions \(z_Q, z_\Sigma ,z_\Omega ,z_\Gamma \) and the constants \(b_{Q},b_{\Sigma },b_{\Omega },b_{\Gamma },b_{0}\) appearing in the cost functional (1.13), as well as to the state \((\overline{y},\overline{y}_{\Gamma })\) associated with the optimal control \(\overline{u}_{\Gamma }\).

The paper is organized as follows. In the next section, we list our assumptions and state the problem in a precise form. Moreover, we present some auxiliary material and sketch our results. The existence of an optimal control will be proved in Sect. 3, while the rest of the paper is devoted to the derivation of first-order necessary conditions for optimality. The final result will be proved in Sect. 6; it is prepared in Sects. 4 and 5, where we study the control-to-state mapping and solve the adjoint problem.

2 Statement of the Problem and Results

In this section, we describe the problem under study, present the auxiliary material we need and give an outline of our results. As in Sect. 1, \(\Omega \) is the body where the evolution takes place. We assume \(\Omega \subset {\mathbb {R}}^3\) to be open, bounded, connected, and smooth, and we write \(|\Omega |\) for its Lebesgue measure. Moreover, \(\Gamma \), \(\partial _{n}\), \(\nabla _{\Gamma }\) and \(\Delta _\Gamma \) still stand for the boundary of \(\Omega \), the outward normal derivative, the surface gradient and the Laplace–Beltrami operator, respectively. Given a finite final time \(T>0\), we set for convenience

$$\begin{aligned}&Q_t := \Omega \times (0,t)\quad \hbox {and}\quad \Sigma _t := \Gamma \times (0,t)\quad \text {for every }t\in (0,T]\end{aligned}$$
(2.1)
$$\begin{aligned}&Q := Q_T \,,\quad \hbox {and}\quad \Sigma := \Sigma _T \,. \end{aligned}$$
(2.2)

Now, we specify the assumptions on the structure of our system. Some of the results we need are known and hold under rather mild conditions. However, the control problem under study in this paper needs the high level of regularity for the solution that we are going to specify. In particular, the values of the state variable have to be bounded far away from the singularity of the bulk and boundary potentials in order that the solution to the linearized problem introduced below is smooth as well. Even though all this could be true (for smooth data) also in other situations, i.e., if the structure of the system is somehow different, we give a list of assumptions that implies the whole set of conditions listed in [10], since the latter surely guarantee all we need. We also assume the potentials to be slightly smoother than in [10], since this will be useful later on. In order to avoid a heavy notation, we write \(f\) and \(f_{\Gamma }\) in place of \({\fancyscript{W}}\) and \({\fancyscript{W}}_\Gamma \), respectively. Moreover, as we only consider the case of a positive viscosity coefficient, we take \(\tau =1\) without loss of generality. We make the following assumptions for the structure of our system.

$$\begin{aligned}&-\infty \le r_{-}< 0 < r_{+}\le +\infty \end{aligned}$$
(2.3)
$$\begin{aligned}&f,\,f_{\Gamma }:(r_{-},r_{+})\rightarrow [0,+\infty )\text { are }C^3\text { functions such that}\end{aligned}$$
(2.4)
$$\begin{aligned}&f(0) = f_{\Gamma }(0) = 0\quad \hbox {and}\quad f''\text { and }f_{\Gamma }''\text { are bounded from below}\end{aligned}$$
(2.5)
$$\begin{aligned}&{|f'(r)| \le \eta \,|f_{\Gamma }'(r)| + C\quad \text {for some }\eta ,\, C>0\text { and every }r\in (r_{-},r_{+})}\end{aligned}$$
(2.6)
$$\begin{aligned}&{\lim \limits _{r{{\scriptscriptstyle \searrow }}r_{-}} f'(r)= \lim \limits _{r{{\scriptscriptstyle \searrow }}r_{-}} f_{\Gamma }'(r)= -\infty \quad \hbox {and}\quad \lim \limits _{r{{\scriptscriptstyle \nearrow }}r_{+}} f'(r)= \lim \limits _{r{{\scriptscriptstyle \nearrow }}r_{+}} f_{\Gamma }'(r)= +\infty \, .}\qquad \end{aligned}$$
(2.7)

We note that (2.3)–(2.7) imply the possibility of splitting \(f'\) as \(f'=\beta +\pi \), where \(\beta \) is a monotone function that diverges at \(r_\pm \) and \(\pi \) is a perturbation with a bounded derivative. Moreover, the same is true for \(f_{\Gamma }\), so that the assumptions of [10] are satisfied. Furthermore, the choices \(f={\fancyscript{W}}_{reg}\) and \(f={\fancyscript{W}}_{log}\) corresponding to (1.2) and (1.3) are allowed.

Remark 2.1

Let us notice that our assumptions (2.3)–(2.7) perfectly fit the framework of the paper [10], in which it is postulated that the boundary potential dominates the bulk one via condition (2.6). However, the reader may wonder whether, especially in cases like \(f={\fancyscript{W}}_{reg}\), assumption (2.6) can be released. To this concern, let us refer to the paper [14] where other conditions for the bulk and boundary potentials are discussed from the viewpoint of well-posedness: it would be interesting to check whether our results for the optimal control problem can be extended.

Next, in order to simplify notation, we set

$$\begin{aligned}&V := H^{1}(\Omega ), \quad H := L^{2}(\Omega ), \quad H_{\Gamma }:= L^{2}(\Gamma )\quad \hbox {and}\quad V_{\Gamma }:= H^{1}(\Gamma )\qquad \end{aligned}$$
(2.8)
$$\begin{aligned}&{\fancyscript{V}}:= \left\{ (v,v_{\Gamma })\in V\times V_{\Gamma }:\ v_{\Gamma }=v{}_{|_{\Gamma }}\right\} \quad \hbox {and}\quad {\fancyscript{H}}:= H \times H_{\Gamma } \end{aligned}$$
(2.9)

and endow these spaces with their natural norms. For \(1\le p\le \infty \), \(\left\| \,\cdot \, \right\| _p\) is the usual norm in \(L^p\) spaces (\(L^{p}(\Omega )\), \(L^{p}(\Sigma )\), etc.), while \(\left\| \,\cdot \, \right\| _X\) stands for the norm in the generic Banach space \(X\). Furthermore, the symbol \(\left\langle \,\cdot \,,\,\cdot \,\right\rangle \) stands for the duality pairing between \(V^{*}\), the dual space of \(V\), and \(V\) itself. In the following, it is understood that \(H\) is embedded in \(V^{*}\) in the usual way, i.e., such that we have \(\left\langle u,v\right\rangle =(u,v)\) with the inner product \((\,\cdot \,,\,\cdot )\) of \(H\), for every \(u\in H\) and \(v\in V\). Finally, if \(u\in V^{*}\) and \(\underline{u}\in L^{1}(0,T;V^{*})\), we define their generalized mean values \(u^{\Omega }\in {\mathbb {R}}\) and \(\underline{u}^\Omega \in L^1(0,T)\) by setting

$$\begin{aligned} u^{\Omega }:= \frac{1}{|\Omega |} \, \left\langle u, 1\right\rangle \quad \hbox {and}\quad \underline{u}^\Omega (t) := \bigl ( \underline{u}(t) \bigr )^\Omega \quad \hbox {for a.a. }t\in (0,T). \end{aligned}$$
(2.10)

Clearly, (2.10) give the usual mean values when applied to elements of \(H\) or \(L^{1}(0,T;H)\).

At this point, we can describe the state problem. For the data we assume that

$$\begin{aligned}&y_{0}\in H^{2}(\Omega ) \,, \quad y_{0}{}_{|_{\Gamma }}\in H^{2}(\Gamma )\end{aligned}$$
(2.11)
$$\begin{aligned}&r_{-}< y_{0}(x) < r_{+}\quad \text {for every }x\in \overline{\Omega }. \end{aligned}$$
(2.12)

Moreover, \(u_{\Gamma }\) is given in \(H^{1}(0,T;H_{\Gamma })\). Even though we could write the equations and the boundary conditions in their strong forms, we prefer to use the variational formulation of system (1.8)–(1.12). Thus, we look for a triplet \((y,y_{\Gamma },w)\) satisfying

$$\begin{aligned}&y \in W^{1,\infty }(0,T;H) \cap H^{1}(0,T;V) \cap L^{\infty }(0,T;H^{2}(\Omega ))\end{aligned}$$
(2.13)
$$\begin{aligned}&y_{\Gamma }\in W^{1,\infty }(0,T;H_{\Gamma })\cap H^{1}(0,T;V_{\Gamma })\cap L^{\infty }(0,T;H^{2}(\Gamma ))\end{aligned}$$
(2.14)
$$\begin{aligned}&y_{\Gamma }(t) = y(t){}_{|_{\Gamma }}\quad \hbox {for a.a. }t\in (0,T)\end{aligned}$$
(2.15)
$$\begin{aligned}&r_{-}< \mathop {\mathrm{inf\,ess}}\limits _Q y \le \mathop {\mathrm{sup\,ess}}\limits _Q y < r_{+}\end{aligned}$$
(2.16)
$$\begin{aligned}&w \in L^{\infty }(0,T;H^{2}(\Omega )) \end{aligned}$$
(2.17)

as well as, for almost every \(t\in (0,T)\), the variational equations

$$\begin{aligned}&\int _{\Omega }{\partial _{t}} y(t) \, v+ \int _{\Omega }\nabla w(t) \cdot \nabla v = 0\end{aligned}$$
(2.18)
$$\begin{aligned}&\int _{\Omega }w(t) \, {v}\!=\! \int _{\Omega }\partial _{t}y(t) \, v\!+\! \int _{\Gamma }\partial _{t}y_{\Gamma }(t) \, v_{\Gamma }\!+ \!\int _{\Omega }\nabla y(t) \cdot \nabla v+ \int _{\Gamma }\nabla _{\Gamma }y_{\Gamma }(t) \cdot \nabla _{\Gamma }v_{\Gamma }\qquad \nonumber \\&\qquad \qquad \qquad + \int _{\Omega }f'(y(t)) \, v+ \int _{\Gamma }\bigl ( f_{\Gamma }'(y_{\Gamma }(t)) - u_{\Gamma }(t) \bigr ) \, v_{\Gamma } \end{aligned}$$
(2.19)

for every \(v\in V\) and every \((v,v_{\Gamma })\in {\fancyscript{V}}\), respectively, and the Cauchy condition

$$\begin{aligned} y(0) = y_{0}\,. \end{aligned}$$
(2.20)

We note that an equivalent formulation of (2.18)–(2.19) is given by

$$\begin{aligned}&\int _{Q}\partial _{t}y \, v+ \int _{Q}\nabla w \cdot \nabla v = 0\end{aligned}$$
(2.21)
$$\begin{aligned}&\int _{Q}wv= \int _{Q}\partial _{t}y \, v+ \int _{\Sigma }\partial _{t}y_{\Gamma }\, v_{\Gamma }+ \int _{Q}\nabla y \cdot \nabla v+ \int _{\Sigma }\nabla _{\Gamma }y_{\Gamma }\cdot \nabla _{\Gamma }v_{\Gamma }\qquad \nonumber \\&\qquad \qquad \quad + \int _{Q}f'(y) \, v+ \int _{\Sigma }\bigl ( f_{\Gamma }'(y_{\Gamma }) - u_{\Gamma }\bigr ) \, v_{\Gamma }\qquad \end{aligned}$$
(2.22)

for every \(v\in L^{2}(0,T;V)\) and every \((v,v_{\Gamma })\in L^{2}(0,T;{\fancyscript{V}})\), respectively. It is worth noting that (see notation (2.10))

$$\begin{aligned}&(\partial _{t}y(t))^\Omega = 0\quad \hbox {for a.a. }t\in (0,T)\quad \hbox {and}\quad y(t)^\Omega = m_0\quad \text {for every }t\in [0,T]\qquad \nonumber \\&\quad \text {where }m_0=(y_{0})^\Omega \text { is the mean value of }y_{0}, \end{aligned}$$
(2.23)

as usual for the Cahn–Hilliard equation.

As far as existence, uniqueness, regularity and continuous dependence are concerned, we can apply Theorems 2.2, 2.3, 2.4, 2.6 and Corollary 2.7 of [10] (where \({\fancyscript{V}}\) has a slightly different meaning with respect to the present paper) and deduce what we need as a particular case. Moreover, as the proofs of the regularity (2.13)–(2.17) of the solution performed in [10] mainly rely on a priori estimates and compactness arguments, it is clear that a stability estimate holds as well. However, referring to [10] let us point out to the reader that the assumption (2.37) explicitly required in the statements of [10], Thms. 2.4 and 2.6, Cor. 2.7] contains the condition \(\partial _n {y_{0}}_{{ |_\Gamma }}=0\) which is completely useless (actually, it is never employed in the proofs, as one can easily check). Therefore, we have

Theorem 2.2

Assume (2.3)–(2.7) and (2.11)–(2.12), and let \(u_{\Gamma }\in H^{1}(0,T;H_{\Gamma })\). Then, problem (2.13)–(2.20) has a unique solution \((y,y_{\Gamma },w)\), and this solution satisfies

$$\begin{aligned}&\left\| y \right\| _{W^{1,\infty }(0,T;H) \cap H^{1}(0,T;V) \cap L^{\infty }(0,T;H^{2}(\Omega ))}\nonumber \\&\quad + \left\| y_{\Gamma } \right\| _{W^{1,\infty }(0,T;H_{\Gamma })\cap H^{1}(0,T;V_{\Gamma })\cap L^{\infty }(0,T;H^{2}(\Gamma ))}\nonumber \\&\quad + \left\| w \right\| _{L^{\infty }(0,T;H^{2}(\Omega ))}\,\le \,c\end{aligned}$$
(2.24)
$$\begin{aligned}&r_{-}' \le y \le r_{+}'\quad \hbox {a.e. in }Q \end{aligned}$$
(2.25)

for some constants \(c>0\) and \(r_{-}',r_{+}'\in (r_{-},r_{+})\) that depend only on \(\Omega \), \(T\), the shape of the nonlinearities \(f\) and \(f_{\Gamma }\), the initial datum \(y_{0}\), and on an upper bound for the norm of \(u_{\Gamma }\) in \(H^{1}(0,T;H_{\Gamma })\). Moreover, if \(u_{\Gamma \!,i}\in H^{1}(0,T;H_{\Gamma })\), \(i=1,2\), are two forcing terms and \((y_i,y_{\Gamma \!,i},w_i)\) are the corresponding solutions, the inequality

$$\begin{aligned}&\left\| y_1-y_2 \right\| _{L^{\infty }(0,T;H)}^2+ \left\| y_{\Gamma \!,1}-y_{\Gamma \!,2} \right\| _{L^{\infty }(0,T;H_{\Gamma })}^2\nonumber \\&\quad + \left\| \nabla (y_1-y_2) \right\| _{L^{2}(0,T;H)}^2+ \left\| \nabla _{\Gamma }(y_{\Gamma \!,1}-y_{\Gamma \!,2)} \right\| _{L^{2}(0,T;H_{\Gamma })}^2\nonumber \\&\le c \, \left\| u_{\Gamma \!,1}-u_{\Gamma \!,2} \right\| _{L^{2}(0,T;H_{\Gamma })}^2 \end{aligned}$$
(2.26)

holds true with a constant \(c\) that depends only on \(\Omega \), \(T\), and the shape of the nonlinearities \(f\) and \(f_{\Gamma }\).

Once well-posedness for problem (2.13)–(2.20) is established, we can address the corresponding control problem. As in the Sect. 1, given four functions

$$\begin{aligned} z_{Q}\in L^{2}(Q) , \quad z_{\Sigma }\in L^{2}(\Sigma ) , \quad z_{\Omega }\in L^{2}(\Omega )\quad \hbox {and}\quad z_{\Gamma }\in L^{2}(\Gamma ) \end{aligned}$$
(2.27)

and nonnegative constants \(b_{Q},\, b_{\Sigma },\, b_{\Omega },\, b_{\Gamma },\, b_{0}\), we set

$$\begin{aligned} \fancyscript{J}(y,{y_\Gamma ,} u_{\Gamma }):= & {} \frac{b_{Q}}{2} \, \left\| y-z_{Q} \right\| _{L^2(Q)}^2+ \frac{b_{\Sigma }}{2} \, \left\| {y_\Gamma }-z_{\Sigma } \right\| _{L^2(\Sigma )}^2+ \frac{b_{\Omega }}{2} \, \left\| y(T)-z_{\Omega } \right\| _{L^2(\Omega )}^2\nonumber \\&+ \frac{b_{\Gamma }}{2} \, \left\| y_{\Gamma }(T)-z_{\Gamma } \right\| _{L^2(\Gamma )}^2+ \frac{b_{0}}{2} \, \left\| u_{\Gamma } \right\| _{L^2(\Sigma )}^2 \end{aligned}$$
(2.28)

for, say, \(y\in C^{0}([0,T];H)\), \(y_{\Gamma }\in C^{0}([0,T];H_{\Gamma })\) and \(u_{\Gamma }\in L^{2}(\Sigma )\), and consider the problem of minimizing the cost functional (2.28) subject to the constraint \(u_{\Gamma }\in {\fancyscript{U}}_{{\mathrm{ad}}}\), where the control box \({\fancyscript{U}}_{{\mathrm{ad}}}\) is given by

$$\begin{aligned}&{\fancyscript{U}}_{{\mathrm{ad}}}:= \bigl \{ u_{\Gamma }\in H^{1}(0,T;H_{\Gamma })\cap L^{\infty }(\Sigma ):\nonumber \\&\qquad \qquad \ u_{\Gamma , \mathrm{min}}\le u_{\Gamma }\le u_{\Gamma , \mathrm{max}}\ \hbox {a.e. on }\Sigma ,\ \left\| \partial _{t}u_{\Gamma } \right\| _2\le M_{0}\bigr \} \end{aligned}$$
(2.29)

and to the state system (2.18)–(2.20). We simply assume that

$$\begin{aligned} M_{0}> 0 , \quad u_{\Gamma , \mathrm{min}},\, u_{\Gamma , \mathrm{max}}\in L^{\infty }(\Sigma )\quad \hbox {and}\quad {\fancyscript{U}}_{{\mathrm{ad}}}\text { is nonempty}. \end{aligned}$$
(2.30)

Here is our first result.

Theorem 2.3

Assume (2.3)–(2.7) and (2.11)–(2.12), and let and be defined by (2.29) and (2.28) under the assumptions (2.30) and (2.27). Then, there exists \(\overline{u}_{\Gamma }\in {\fancyscript{U}}_{{\mathrm{ad}}}\) such that

(2.31)

where \(\overline{y}\), \(\overline{y}_{\Gamma }\), \(y\) and \(y_{\Gamma }\) are the components of the solutions \((\overline{y},\overline{y}_{\Gamma },\overline{w})\) and \((y,y_{\Gamma },w)\) to the state system (2.13)–(2.20) corresponding to the controls \(\overline{u}_{\Gamma }\) and \(u_{\Gamma }\), respectively.

From now on, it is understood that the assumptions (2.3)–(2.7) and (2.11)–(2.12) on the structure and on the initial datum \(y_{0}\) are satisfied and that the cost functional and the control box are defined by (2.28) and (2.29) under the assumptions (2.30) and (2.27). Thus, we do not remind anything of that in the statements given in the sequel.

Our next aim is to formulate necessary optimality conditions. To this end, by recalling the involved definitions (2.8)–(2.9), we introduce the control-to-state mapping by

$$\begin{aligned}&{\fancyscript{X}}:= H^{1}(0,T;H_{\Gamma })\cap L^{\infty }(\Sigma ), \quad {\fancyscript{Y}}:= H^{1}(0,T;{\fancyscript{H}})\cap L^{\infty }(0,T;{\fancyscript{V}})\nonumber \\\end{aligned}$$
(2.32)
$$\begin{aligned}&{\fancyscript{U}}\text { is an open set in }{\fancyscript{X}}\text { that includes }{\fancyscript{U}}_{{\mathrm{ad}}}\end{aligned}$$
(2.33)
$$\begin{aligned}&{\fancyscript{S}}: {\fancyscript{U}}\rightarrow {\fancyscript{Y}}, \quad u_{\Gamma }\mapsto {\fancyscript{S}}(u_{\Gamma }) =: (y,y_{\Gamma }),\quad \text {where }\,(y,y_{\Gamma },w)\text { is the unique}\nonumber \\&\text {solution to (2.13)-(2.20) corresponding to }\,u_{\Gamma }\,,\qquad \end{aligned}$$
(2.34)

as well as the so-called “reduced cost functional”

$$\begin{aligned} \widetilde{\fancyscript{J}}: {\fancyscript{U}}\rightarrow {\mathbb {R}},\quad \hbox {defined by} \quad \widetilde{\fancyscript{J}}(u_{\Gamma }) := \fancyscript{J}(y,y_{\Gamma },u_{\Gamma })\quad \hbox {where} \quad (y,y_{\Gamma }) = {\fancyscript{S}}(u_{\Gamma }). \end{aligned}$$
(2.35)

As \({\fancyscript{U}}_{{\mathrm{ad}}}\) is convex, the desired necessary condition for optimality is

(2.36)

provided that the derivative exists in the dual space \((H^{1}(0,T;H_{\Gamma }))^*\) at least in the Gâteaux sense. Then, the natural approach consists in proving that \({\fancyscript{S}}\) is Fréchet differentiable at \(\overline{u}_{\Gamma }\) and applying the chain rule. As we shall see in Sect. 4, this leads to the linearized problem that we describe at once and that can be stated starting from a generic element \(u_{\Gamma }\in {\fancyscript{U}}\). Let \(u_{\Gamma }\in {\fancyscript{U}}\) and \(h_{\Gamma }\in H^{1}(0,T;H_{\Gamma })\) be given. We set \((y,y_{\Gamma }):={\fancyscript{S}}(u_{\Gamma })\) and

$$\begin{aligned} \lambda := f''(y)\quad \hbox {and}\quad \lambda _\Gamma := f_{\Gamma }''(y_{\Gamma }) . \end{aligned}$$
(2.37)

Then the problem consists in finding \((\xi ,\xi _{\Gamma },\eta )\) satisfying the analogue of the regularity requirements (2.13)–(2.17), solving \(\hbox {for a.a. }t\in (0,T)\) the variational equations

$$\begin{aligned}&\int _{\Omega }\partial _{t}\xi (t) \, v+ \int _{\Omega }\nabla \eta (t) \cdot \nabla v = 0\end{aligned}$$
(2.38)
$$\begin{aligned}&\int _{\Omega }\eta (t) v= \int _{\Omega }\partial _{t}\xi (t) \, v+ \int _{\Gamma }\partial _{t}\xi _{\Gamma }(t) \, v_{\Gamma }+ \int _{\Omega }\nabla \xi (t) \cdot \nabla v+ \int _{\Gamma }\nabla _{\Gamma }\xi _{\Gamma }(t) \cdot \nabla _{\Gamma }v_{\Gamma }\qquad \nonumber \\&\qquad \qquad \qquad + \int _{\Omega }\lambda (t) \, \xi (t) \, v+ \int _{\Gamma }\bigl ( \lambda _\Gamma (t) \, \xi _{\Gamma }(t) - h_{\Gamma }(t) \bigr ) \, v_{\Gamma } \end{aligned}$$
(2.39)

for every \(v\in V\) and every \((v,v_{\Gamma })\in {\fancyscript{V}}\), respectively, and satisfying the Cauchy condition

$$\begin{aligned} \xi (0) = 0 \,. \end{aligned}$$
(2.40)

Note that property (2.23) applied to \(\xi \) becomes

$$\begin{aligned} \xi ^\Omega (t) = 0\quad \hbox {for a.a. }t\in (0,T), \end{aligned}$$
(2.41)

since \(\xi (0)=0\). As \(\lambda \) and \(\lambda _\Gamma \) are bounded, we can apply [10], Cor. 2.5] to conclude the following result.

Proposition 2.4

Let \(u_{\Gamma }\in {\fancyscript{U}}\). Moreover, let \((y,y_{\Gamma })={\fancyscript{S}}(u_{\Gamma })\) and define \(\lambda \) and \(\lambda _\Gamma \) by (2.37). Then, for every \(h_{\Gamma }\in H^{1}(0,T;H_{\Gamma })\), there exists a unique triplet \((\xi ,\xi _{\Gamma },\eta )\) satisfying the analogue of (2.13)–(2.17) and solving the linearized problem (2.38)–(2.40).

Namely, we shall prove that the Fréchet derivative \(D{\fancyscript{S}}(u_{\Gamma })\in {\fancyscript{L}}({\fancyscript{X}},{\fancyscript{Y}})\) actually exists and the value that it assigns to the generic element \(h_{\Gamma }\in {\fancyscript{X}}\) is precisely \((\xi ,\xi _{\Gamma })\in {\fancyscript{Y}}\), where \((\xi ,\xi _{\Gamma },\eta )\) is the solution to the linearized problem corresponding to the datum \(h_{\Gamma }\). This will be done in Sect. 4. Once this will be established, we may use the chain rule to prove that the necessary condition (2.36) for optimality takes the form

$$\begin{aligned}&b_{Q}\int _{Q}(\overline{y}- z_{Q}) \xi + b_{\Sigma }\int _{\Sigma }(\overline{y}_{\Gamma }- z_{\Sigma }) \xi _{\Gamma }+ b_{\Omega }\int _{\Omega }(\overline{y}(T) - z_{\Omega }) \xi (T)\nonumber \\&\quad +\, b_{\Gamma }\int _{\Gamma }(\overline{y}_{\Gamma }(T) - z_{\Gamma }) \xi _{\Gamma }(T)+ b_{0}\int _{\Sigma }\overline{u}_{\Gamma }(v_{\Gamma }- \overline{u}_{\Gamma })\ge 0\quad \text {for any }v_{\Gamma }\in {\fancyscript{U}}_{{\mathrm{ad}}},\nonumber \\ \end{aligned}$$
(2.42)

where, for any given \(v_{\Gamma }\in {\fancyscript{U}}_{{\mathrm{ad}}}\), the functions \(\xi \) and \(\xi _{\Gamma }\) are the first two components of the solution \((\xi ,\xi _{\Gamma },\eta )\) to the linearized problem corresponding to \(h_{\Gamma }=v_{\Gamma }-\overline{u}_{\Gamma }\).

The final step then consists in eliminating the pair \((\xi ,\xi _{\Gamma })\) from (2.42). This will be done by introducing a triplet \((p,q,q_{\Gamma })\) that fulfills the regularity requirements

$$\begin{aligned}&p \in H^{1}(0,T;H^{2}(\Omega )) \cap L^{2}(0,T;H^{4}(\Omega ))\end{aligned}$$
(2.43)
$$\begin{aligned}&q \in H^{1}(0,T;H) \cap L^{2}(0,T;H^{2}(\Omega ))\end{aligned}$$
(2.44)
$$\begin{aligned}&q_{\Gamma }\in H^{1}(0,T;H_{\Gamma })\cap L^{2}(0,T;H^{2}(\Gamma ))\end{aligned}$$
(2.45)
$$\begin{aligned}&q_{\Gamma }(t) = q(t){}_{|_{\Gamma }}\quad \hbox {for a.a. }t\in (0,T) \end{aligned}$$
(2.46)

and solves a suitable backward-in-time problem (the so-called “adjoint system”): namely, the variational equations

$$\begin{aligned} \int _{\Omega }q(t) \, v = \int _{\Omega }\nabla p(t) \cdot \nabla v {\quad \text {for all } v\in V \text { and } t\in [0,T]} \end{aligned}$$
(2.47)
$$\begin{aligned} {- \int _{\Omega }\partial _{t}\bigl ( p(t) + q(t) \bigr ) \, v+ \int _{\Omega }\nabla q(t) \cdot \nabla v+ \int _{\Omega }f''(\overline{y}(t)) \, q(t) \, v}\qquad \nonumber \\ \quad - \int _{\Gamma }\partial _{t}q_{\Gamma }(t) \, v_{\Gamma }+ \int _{\Gamma }\nabla _{\Gamma }q_{\Gamma }(t) \cdot \nabla _{\Gamma }v_{\Gamma }+ \int _{\Gamma }f_{\Gamma }''(\overline{y}_{\Gamma }(t)) \, q_{\Gamma }(t) \, v_{\Gamma }\nonumber \\ = \int _{\Omega }b_{Q}\bigl ( \overline{y}(t) - z_{Q}(t) \bigr ) v+ \int _{\Gamma }b_{\Sigma }\bigl ( \overline{y}_{\Gamma }(t) - z_{\Sigma }(t) \bigr ) v_{\Gamma }\nonumber \\ {\quad \text {for every } (v,v_{\Gamma })\in {\fancyscript{V}}\text { and a.a. } t\in (0,T)} \end{aligned}$$
(2.48)

and the final condition

$$\begin{aligned}&\int _{\Omega }(p+q)(T) \, v+ \int _{\Gamma }q_{\Gamma }(T) \, v_{\Gamma }= \int _{\Omega }b_{\Omega }\bigl ( \overline{y}(T) - z_{\Omega }\bigr ) v+ \int _{\Gamma }b_{\Gamma }\bigl ( \overline{y}_{\Gamma }(T) - z_{\Gamma }\bigr ) v_{\Gamma }\nonumber \\ {}&\quad {\text {for every}}\, (v,v_{\Gamma })\in \mathcal{V} \end{aligned}$$
(2.49)

have to be satisfied. Some assumptions will be given in order that this problem has a unique solution, and the optimality condition (2.42) will be rewritten in a much simpler form. For instance, one can assume that

$$\begin{aligned} b_{\Omega }= 0 \quad \hbox {and}\quad b_{\Gamma }= 0 \,. \end{aligned}$$
(2.50)

In Sects. 5 and 6, we will prove the results stated below and sketch how to avoid (2.50) by weakening a little the summability requirements on the solution (see the forthcoming Remark 5.6).

Theorem 2.5

Let \(\overline{u}_{\Gamma }\) and \((\overline{y},\overline{y}_{\Gamma })={\fancyscript{S}}(\overline{u}_{\Gamma })\) be an optimal control and the corresponding state and assume in addition that (2.50) holds. Then the adjoint problem (2.47)–(2.49) has a unique solution \((p,q,q_{\Gamma })\) satisfying the regularity conditions (2.43)–(2.46).

Theorem 2.6

Let \(\overline{u}_{\Gamma }\) be an optimal control. Moreover, let \((\overline{y},\overline{y}_{\Gamma })={\fancyscript{S}}(\overline{u}_{\Gamma })\) and \((p,q,q_{\Gamma })\) be the associate state and the unique solution to the adjoint problem (2.47)–(2.49) given by Theorem 2.5. Then we have

$$\begin{aligned} \int _{\Sigma }(q_{\Gamma }+ b_{0}\overline{u}_{\Gamma }) (v_{\Gamma }- \overline{u}_{\Gamma }) \ge 0\quad \text {for every }v_{\Gamma }\in {\fancyscript{U}}_{{\mathrm{ad}}}. \end{aligned}$$
(2.51)

In particular, if \(b_{0}>0\), we remark that \(u_{\Gamma }\) is just a projection, namely

$$\begin{aligned} \overline{u}_{\Gamma }{\textit{ is the orthogonal projection of }}-q_{\Gamma }/b_{0}{\textit{ on }}{\fancyscript{U}}_{{\mathrm{ad}}} \end{aligned}$$
(2.52)

with respect to the standard scalar product in \(L^{2}(\Sigma )\).

In the remainder of this section, we recall some well-known facts and introduce some notation. First of all, we often owe to the elementary Young inequality

$$\begin{aligned} ab \le \delta a^2 + \frac{1}{4\delta } \, b^2\quad \text {for every }a,b\ge 0\text { and }\delta >0 \end{aligned}$$
(2.53)

and to the Hölder inequality. Moreover, we account for the well-known Poincaré inequality

$$\begin{aligned} \left\| v \right\| _V^2 \le C \bigl ( \left\| \nabla v \right\| _H^2 + |v^{\Omega }|^2 \bigr )\quad \text {for every }v\in V \end{aligned}$$
(2.54)

where \(C\) depends only on \(\Omega \). Next, we recall a tool that is generally used in the context of problems related to the Cahn–Hilliard equations. We define

$$\begin{aligned} {\text {dom}}{\fancyscript{N}}:= \left\{ v_{*}\in V^{*}: \ v_{*}^\Omega = 0\right\} \quad \hbox {and}\quad {\fancyscript{N}}: {\text {dom}}{\fancyscript{N}}\rightarrow \left\{ v \in V : \ v^{\Omega }= 0\right\} \end{aligned}$$
(2.55)

by setting for \(v_{*}\in {\text {dom}}{\fancyscript{N}}\)

$$\begin{aligned} {{\fancyscript{N}}v_{*}\in V, \quad ({\fancyscript{N}}v_{*})^\Omega = 0 ,\quad \hbox {and}\quad \int _{\Omega }\nabla {\fancyscript{N}}v_{*}\cdot \nabla z = \left\langle v_{*},z\right\rangle \quad \text {for every }z\in V} \end{aligned}$$
(2.56)

i.e., \({\fancyscript{N}}v_{*}\) is the solution \(v\) to the generalized Neumann problem for \(-\Delta \) with datum \(v_{*}\) that satisfies \(v^{\Omega }=0\). Indeed, if \(v_{*}\in H\), the above variational equation means \(-\Delta {\fancyscript{N}}v_{*}= v_{*}\) and \(\partial _{n}{\fancyscript{N}}v_{*}= 0\). As \(\Omega \) is bounded, smooth, and connected, it turns out that (2.56) yields a well-defined isomorphism which also satisfies

$$\begin{aligned}&{\fancyscript{N}}v_{*}\in H^{s+2}(\Omega )\quad \hbox {and}\quad \left\| {\fancyscript{N}}v_{*} \right\| _{H^{s+2}(\Omega )}\le C_s \left\| v_{*} \right\| _{H^{s}(\Omega )}\nonumber \\&\quad \text {if }s\ge 0\quad \hbox {and}\quad v_{*}\in H^{s}(\Omega ) \cap {\text {dom}}{\fancyscript{N}} \end{aligned}$$
(2.57)

with a constant \(C_s\) that depends only on \(\Omega \) and \(s\). Moreover, we have

$$\begin{aligned} \left\langle u_{*}, {\fancyscript{N}}v_{*}\right\rangle = \left\langle v_{*}, {\fancyscript{N}}u_{*}\right\rangle = \int _{\Omega }(\nabla {\fancyscript{N}}u_{*}) \cdot (\nabla {\fancyscript{N}}v_{*})\quad \text {for }u_{*},v_{*}\in {\text {dom}}{\fancyscript{N}} \end{aligned}$$
(2.58)

whence also

$$\begin{aligned} 2 \left\langle \partial _{t}v_{*}(t) , {\fancyscript{N}}v_{*}(t)\right\rangle = \frac{d}{dt} \int _{\Omega }|\nabla {\fancyscript{N}}v_{*}(t)|^2= \frac{d}{dt} \, \left\| v_{*}(t) \right\| _{*}^2\quad \hbox {for a.a. }t\in (0,T) \end{aligned}$$
(2.59)

for every \(v_{*}\in H^{1}(0,T;V^{*})\) satisfying \((v_{*})^\Omega =0\) \(\hbox {a.e. in }(0,T)\).

We conclude this section by stating a general rule we use as far as constants are concerned, in order to avoid a boring notation. Throughout the paper, the small-case symbol \(c\) stands for different constants which depend only on \(\Omega \), on the final time \(T\), the shape of the nonlinearities and on the constants and the norms of the functions involved in the assumptions of our statements. Hence, the meaning of \(c\) might change from line to line and even in the same chain of equalities or inequalities. On the contrary, capital letters (with or without subscripts) stand for precise constants which we can refer to.

3 Existence of an Optimal Control

We prove Theorem 2.3 by the direct method, recalling that \({\fancyscript{U}}_{{\mathrm{ad}}}\) is a nonempty, closed and convex set in \(L^{2}(\Sigma )\). Let \(\left\{ u_{\Gamma ,n}\right\} \) be a minimizing sequence for the optimization problem and, for any \(n\), let us take the corresponding solution \((y_{n},y_{\Gamma , n},w_{n})\) to problem (2.13)–(2.20). Thus, \(u_{\Gamma ,n}\in {\fancyscript{U}}_{{\mathrm{ad}}}\) for every \(n\), and we can account for the definition (2.29) of \({\fancyscript{U}}_{{\mathrm{ad}}}\), assumptions (2.30) and estimates (2.24)–(2.25) for the solutions. In particular, we have that

$$\begin{aligned} r_{-}< r_{-}' \le y_{n}\le r_{+}' < r_{+}\quad \hbox {a.e. in }Q\text { and for every }n. \end{aligned}$$
(3.1)

Next, owing to weak star and strong compactness results (see, e.g., [26], Sect. 8, Cor. 4]), we deduce that suitable (not relabeled) subsequences exist such that

Clearly, \(\overline{u}_{\Gamma }\in {\fancyscript{U}}_{{\mathrm{ad}}}\). Moreover, \(\overline{y}(0)=y_{0}\). Furthermore, by (3.1) and the regularity of \(f\) and \(f_{\Gamma }\) we have assumed in (2.3)–(2.7), we also deduce that \(f'(y_{n})\) and \(f_{\Gamma }'(y_{\Gamma , n})\) converge to \(f'(\overline{y})\) and \(f_{\Gamma }'(\overline{y}_{\Gamma })\), e.g., strongly in \(C^{0}([0,T];H)\) and \(C^{0}([0,T];H_{\Gamma })\), respectively. Thus, we can pass to the limit in the integrated variational formulation (2.21)–(2.22) written for \((y_{n},y_{\Gamma , n},w_{n})\) and \(u_{\Gamma ,n}\), and immediately conclude that the triplet \((\overline{y},\overline{y}_{\Gamma },\overline{w})\) is the solution \((y,y_{\Gamma },w)\) to (2.21)–(2.22) corresponding to \(u_{\Gamma }:=\overline{u}_{\Gamma }\). Finally, by semicontinuity, it is clear that the value is the infimum of the cost functional since we have started from a minimizing sequence. \(\square \)

4 The Control-to-State Mapping

We recall the definitions (2.32)–(2.34) of the spaces \({\fancyscript{X}}\), \({\fancyscript{Y}}\), the set \({\fancyscript{U}}\) and the map \({\fancyscript{S}}\). As sketched in Sect. 2, the main point is the Fréchet differentiability of the control-to-state mapping \({\fancyscript{S}}\). Our result on that point is prepared by a stability estimate given by the following lemma.

Lemma 4.1

Let \(u_{\Gamma ,i}\in H^{1}(0,T;H_{\Gamma })\) for \(i=1,2\) and let \((y_i,y_{\Gamma ,i},w_i)\) be the corresponding solutions given by Theorem 2.2. Then, the following estimate

$$\begin{aligned} \left\| (y_1,y_{\Gamma ,1}) - (y_2,y_{\Gamma ,2}) \right\| _{{\fancyscript{Y}}}\le c \left\| u_{\Gamma ,1} - u_{\Gamma ,2} \right\| _{L^{2}(0,T;H_{\Gamma })} \end{aligned}$$
(4.1)

holds true for some constant \(c>0\) that depends only on \(\Omega \), \(T\), the shape of the nonlinearities \(f\) and \(f_{\Gamma }\), and the initial datum \(y_{0}\).

Proof

We set for convenience

$$\begin{aligned} u_{\Gamma }:= u_{\Gamma ,1} - u_{\Gamma ,2} \,, \quad y := y_1 - y_2 \,, \quad y_{\Gamma }:= y_{\Gamma ,1} - y_{\Gamma ,2}\quad \hbox {and}\quad w := w_1 - w_2 \,. \end{aligned}$$

By writing problem (2.13)–(2.20) for both solutions \((y_i,y_{\Gamma ,i},w_i)\) and taking the difference, we immediately derive that

$$\begin{aligned}&\int _{\Omega }\partial _{t}y(t) \, v+ \int _{\Omega }\nabla w(t) \cdot \nabla v = 0\end{aligned}$$
(4.2)
$$\begin{aligned}&\int _{\Omega }w(t) \, v\!=\! \int _{\Omega }\partial _{t}y(t) \, v\!+\! \int _{\Gamma }\partial _{t}y_{\Gamma }(t) \, v_{\Gamma }\!+\! \int _{\Omega }\nabla y(t) \cdot \nabla v+ \int _{\Gamma }\nabla _{\Gamma }y_{\Gamma }(t) \cdot \nabla _{\Gamma }v_{\Gamma }\qquad \nonumber \\&\qquad \qquad \qquad + \int _{\Omega }\bigl ( f'(y_1(t))\! -\! f'(y_2(t)) \bigr ) \, v\!+\! \int _{\Gamma }\bigl ( f_{\Gamma }'(y_1(t)) - f_{\Gamma }'(y_2(t)) - u_{\Gamma }(t) \bigr ) \, v_{\Gamma }\nonumber \\ \end{aligned}$$
(4.3)

\(\hbox {for a.a. }t\in (0,T)\) and for every \(v\in V\) and every \((v,v_{\Gamma })\in {\fancyscript{V}}\), respectively. Moreover, \(y(0)=0\) and \(\partial _{t}y\) has zero mean value since (2.23) holds for \(\partial _{t}y_i\). Therefore, \(\mathcal{N}(\partial _t y)\) is well defined \(\hbox {a.e. in }(0,T)\) (see (2.55)) and we can test (4.2)–(4.3) written at the time \(s\) by \({\fancyscript{N}}(\partial _{t}y(s))\) and \(-\partial _{t}(y,y_{\Gamma })(s)\), respectively. Then we add the resulting equalities and integrate over \((0,t)\) with respect to \(s\), where \(t\in (0,T)\) is arbitrary. We obtain

$$\begin{aligned}&\int _{Q_{t}}\partial _{t}y \, {{\fancyscript{N}}(\partial _{t}y)}+ \int _{Q_{t}}{\nabla w }\cdot \nabla {\fancyscript{N}}(\partial _{t}y)- \int _{Q_{t}}w \, \partial _{t}y\nonumber \\&\quad + \int _{Q_{t}}|\partial _{t}y|^2+ \int _{\Sigma _t}|\partial _{t}y_{\Gamma }|^2+ \frac{1}{2} \int _{\Omega }|\nabla y(t)|^2+ \frac{1}{2} \int _{\Gamma }|\nabla _{\Gamma }y_{\Gamma }(t)|^2\nonumber \\&\quad = - \int _{Q_{t}}\bigl ( f'(y_1) - f'(y_2) \bigr ) \partial _{t}y- \int _{\Sigma _t}\bigl ( f_{\Gamma }'(y_1) - f_{\Gamma }'(y_2) \bigr ) \partial _{t}y_{\Gamma }+ \int _{\Sigma _t}u_{\Gamma }\, \partial _{t}y_{\Gamma }\,.\nonumber \\ \end{aligned}$$
(4.4)

By accounting for (2.58) and (2.56), we have

$$\begin{aligned} \int _{Q_{t}}\partial _{t}y \, {\fancyscript{N}}(\partial _{t}y)+ \int _{Q_{t}}{\nabla w} \cdot \nabla {\fancyscript{N}}(\partial _{t}y)- \int _{Q_{t}}w \, \partial _{t}y= { \int _{Q_{t}}|\nabla {\fancyscript{N}}\partial _{t}y|^2} \, \ge \,0 \,. \end{aligned}$$

Moreover, all the other integrals on the left-hand side of (4.4) are nonnegative. The first two terms on the right-hand side need the same treatement and we only deal with the first of them. We notice that both \(y_1\) and \(y_2\) satisfy (2.25) and that \(f'\) is Lipschitz continuous on \([r_{-}',r_{+}']\). By using this and the Hölder, Young and Poincaré inequalities (see (2.54)), we derive that

$$\begin{aligned} - \int _{Q_{t}}\bigl ( f'(y_1) - f'(y_2) \bigr ) \partial _{t}y\le \frac{1}{4} \int _{Q_{t}}|\partial _{t}y|^2+ c \int _{Q_{t}}|\nabla y|^2 \,. \end{aligned}$$

Finally, we simply have

$$\begin{aligned} \int _{\Sigma _t}u_{\Gamma }\, \partial _{t}y_{\Gamma }\le \frac{1}{4} \int _{\Sigma _t}|\partial _{t}y_{\Gamma }|^2+ \int _{\Sigma _t}|u_{\Gamma }|^2 \,. \end{aligned}$$

By combining these inequalities and (4.4), we see that we can apply the standard Gronwall lemma. This directly yields (4.1). \(\square \)

Theorem 4.2

Let \(u_{\Gamma }\in {\fancyscript{U}}\). Moreover, let \((y,y_{\Gamma })={\fancyscript{S}}(u_{\Gamma })\) and define \(\lambda \) and \(\lambda _\Gamma \) by (2.37). Then the control-to-state mapping \({\fancyscript{S}}:\mathcal{U}\subset \mathcal{X}\rightarrow \mathcal{Y} \) is Fréchet differentiable at \(u_{\Gamma }\), and its Fréchet derivative \(D{\fancyscript{S}}(u_{\Gamma }) \in \mathcal{L}(\mathcal{X},\mathcal{Y})\) is given as follows: for \(h_{\Gamma }\in {\fancyscript{X}}\), the value of \(D{\fancyscript{S}}(u_{\Gamma })\) at \(h_{\Gamma }\) is the pair \((\xi ,\xi _{\Gamma })\), where \((\xi ,\xi _{\Gamma },\eta )\) is the unique solution to the linearized problem (2.38)–(2.40).

Proof

At first, a closer inspection of the proof of Theorem 4.1 in [10] for the linear case reveals that the linear mapping, which assigns to each \(h_\Gamma \in \mathcal{X}\) the pair \((\xi ,\xi _\Gamma )\), where \((\xi ,\xi _\Gamma ,\eta )\) is the associated unique solution to the linearized system (2.38)–(2.40), is bounded as a mapping from \(\mathcal{X}\) into \(\mathcal{Y}\). Hence, if \(D\mathcal{S}(u_\Gamma )\) has in fact the asserted form, then it belongs to \(\mathcal{L}(\mathcal{X},\mathcal{Y})\).

In the following, it understood that \(\left\| h_{\Gamma } \right\| _{{\fancyscript{X}}}\) is small enough in order that \(u_{\Gamma }+h_{\Gamma }\in {\fancyscript{U}}\). As we would like writing the inequality that shows the desired differentiability in a simple form, we introduce some auxiliary functions. First of all, we also need the third component \(w\) of the solution \((y,y_{\Gamma },w)\) associated to \(u_{\Gamma }\). Moreover, given \(h_{\Gamma }\in {\fancyscript{X}}\) small enough, we set

$$\begin{aligned}&(y^{h},y^{h}_{\Gamma },w^{h}) := \text {solution to (2.13)-(2.20) corresponding to }u_{\Gamma }+h_{\Gamma },\\&\quad \text {whence} \quad (y^{h},y^{h}_{\Gamma }) = {\fancyscript{S}}(u_{\Gamma }+h_{\Gamma })\\&q^{h}:= y^{h}- y - \xi , \quad q^{h}_{\Gamma }:= y^{h}_{\Gamma }- y_{\Gamma }- \xi _{\Gamma }\quad \hbox {and}\quad z^{h}:= w^{h}- w - \eta \,. \end{aligned}$$

By the definition of the Fréchet derivative, we need to show that \(\left\| (q^{h},q^{h}_{\Gamma }) \right\| _{{\fancyscript{Y}}}=o(\left\| h_{\Gamma } \right\| _{{\fancyscript{X}}})\) as \(\left\| h_{\Gamma } \right\| _{{\fancyscript{X}}}\rightarrow 0\). We prove a preciser estimate, namely

$$\begin{aligned} \left\| (q^{h},q^{h}_{\Gamma }) \right\| _{{\fancyscript{Y}}}\le c \left\| h_{\Gamma } \right\| _{L^{2}(\Sigma )}^2 \,. \end{aligned}$$
(4.5)

By definition, the triplets \((y^{h},y^{h}_{\Gamma },w^{h})\) and \((y,y_{\Gamma },w)\) satisfy problem (2.13)–(2.20) with data \(u_{\Gamma }+ h_{\Gamma }\) and \(u_{\Gamma }\), respectively. Moreover, \((\xi ,\xi _{\Gamma },\eta )\) solves the linearized problem (2.38)–(2.40). By writing everything and taking the difference, we obtain \(\hbox {for a.a. }t\in (0,T)\)

$$\begin{aligned}&\int _{\Omega }\partial _{t}q^{h}(t) \, v+ \int _{\Omega }\nabla z^{h}(t) \cdot \nabla v = 0\end{aligned}$$
(4.6)
$$\begin{aligned}&\int _{\Omega }z^{h}(t) \, {v}\!=\! \int _{\Omega }\partial _{t}q^{h}(t) \, v\!+\! \int _{\Gamma }\partial _{t}q^{h}_{\Gamma }(t) \, v_{\Gamma }\!+\! \int _{\Omega }\nabla q^{h}(t) \cdot \nabla v\!+\! \int _{\Gamma }\nabla _{\Gamma }q^{h}_{\Gamma }(t) \!\cdot \!\nabla _{\Gamma }v_{\Gamma }\qquad \nonumber \\&\qquad \qquad \qquad + \int _{\Omega }\bigl ( f'(y^{h}(t)) - f'(y(t)) - f''(y(t)) \xi (t) \bigr ) \, v\qquad \nonumber \\&\qquad \qquad \qquad + \int _{\Gamma }\bigl ( f_{\Gamma }'(y^{h}_{\Gamma }(t)) - f_{\Gamma }'(y^{h}_{\Gamma }(t)) - f_{\Gamma }''(y_{\Gamma }(t)) \xi _{\Gamma }(t) \bigr ) \, v_{\Gamma } \end{aligned}$$
(4.7)

for every \(v\in V\) and every \((v,v_{\Gamma })\in {\fancyscript{V}}\), respectively. Moreover, \(q^{h}(0)=0\). We observe that the choice \(v=1\) in (4.6) yields that \(\partial _{t}q^{h}(t)\) has zero mean value and thus belongs to the domain of \({\fancyscript{N}}\) \(\hbox {for a.a. }t\in (0,T)\) (see (2.55)). Therefore, we can test (4.6)–(4.7) written at the time \(s\) by \({\fancyscript{N}}(\partial _{t}q^{h}(s))\) and \(-\partial _{t}(q^{h},q^{h}_{\Gamma })(s)\), respectively. Then, we add the resulting equalities and integrate over \((0,t)\) with respect to \(s\), where \(t\in (0,T)\) is arbitrary. We obtain

$$\begin{aligned}&\int _{Q_{t}}\partial _{t}q^{h}\, {\fancyscript{N}}(\partial _{t}q^{h})+ \int _{Q_{t}}\nabla z^{h}\cdot \nabla {\fancyscript{N}}(\partial _{t}q^{h})- \int _{Q_{t}}z^{h}\, \partial _{t}q^{h}\nonumber \\&\quad + \int _{Q_{t}}|\partial _{t}q^{h}|^2+ \int _{\Sigma _t}|\partial _{t}q^{h}_{\Gamma }|^2+ \frac{1}{2} \int _{\Omega }|\nabla q^{h}(t)|^2+ \frac{1}{2} \int _{\Gamma }|\nabla _{\Gamma }q^{h}_{\Gamma }(t)|^2\nonumber \\&= \!- \!\int _{Q_{t}}\bigl ( f'(y^{h})\! -\! f'(y) \!-\! f''(y) \xi \bigr ) \, \partial _{t}q^{h}\!-\! \int _{\Sigma _t}\bigl ( f_{\Gamma }'(y^{h}_{\Gamma }) \!-\! f_{\Gamma }'(y^{h}_{\Gamma }) \!-\! f_{\Gamma }''(y_{\Gamma }) \xi _{\Gamma }\bigr ) \, \partial _{t}q^{h}_{\Gamma }\,.\nonumber \\ \end{aligned}$$
(4.8)

As in the proof of Lemma 4.1, the sum of the first three integrals on the left-hand side of (4.8) is nonnegative as well as each of the other terms. Now, we estimate the first integral on the right-hand side. We write the second order Taylor expansion of the \(C^2\) function \(f'\) (see (2.4)) at \(y\) in the Lagrange form. As \(y^{h}-y=\xi +q^{h}\), we obtain

$$\begin{aligned} f'(y^{h}) - f'(y) - f''(y) \xi = f''(y) \, q^{h}+ \frac{1}{2} \, f'''(\sigma ) |y^{h}-y|^2, \end{aligned}$$

with some function \(\sigma \) taking its values between the ones of \(y^{h}\) and \(y\). As \(y^{h}\) and \(y\) are bounded away from \(r^\pm \) (see (2.25), which holds for both of them), \(f''(y)\) and \(f'''(\sigma )\) are bounded in \(L^{\infty }(Q)\), and the above expansion yields

$$\begin{aligned} |f'(y^{h}) - f'(y) - f''(y) \xi |\le c \bigl ( |q^{h}| + |y^{h}-y|^2 \bigr ) . \end{aligned}$$

Hence, we have

$$\begin{aligned} - \int _{Q_{t}}\bigl ( f'(y^{h}) - f'(y) - f''(y) \xi \bigr ) \, \partial _{t}q^{h}\le C_1 \int _{Q_{t}}|q^{h}| \, |\partial _{t}q^{h}|+ C_2 \int _{Q_{t}}|y^{h}-y|^2 |\partial _{t}q^{h}| \end{aligned}$$
(4.9)

where we have marked the constants in front of the last two integrals for a future reference. We deal with the first term on the right-hand side of the last inequality as follows:

$$\begin{aligned} C_1 \int _{Q_{t}}|q^{h}| \, |\partial _{t}q^{h}|\le \frac{1}{4} \int _{Q_{t}}|\partial _{t}q^{h}|^2+ c \int _{Q_{t}}|q^{h}|^2\le \frac{1}{4} \int _{Q_{t}}|\partial _{t}q^{h}|^2+ c \int _{Q_{t}}|\nabla q^{h}|^2 \,, \end{aligned}$$

by the Poincaré inequality (2.54), since \(q^{h}{= y^{h}- y - \xi }\) has zero mean value. Indeed, \((y^{h})^\Omega =y^\Omega \) and \(\xi ^\Omega =0\) since \(y^{h}(0)=y(0)\) and \(\xi (0)=0\) (see (2.23)). As far as the last term in (4.9) is concerned, we can estimate it this way

$$\begin{aligned}&C_2 \int _{Q_{t}}|y^{h}-y|^2 |\partial _{t}q^{h}|\le c \left\| y^{h}-y \right\| _{L^{\infty }(0,T;V)}^2 \Bigl ( \int _{Q_{t}}|\partial _{t}q^{h}|^2 \Bigr )^{1/2}\\&\qquad \le \frac{1}{4} \int _{Q_{t}}|\partial _{t}q^{h}|^2+ c \left\| y^{h}-y \right\| _{L^{\infty }(0,T;V)}^4\le \frac{1}{4} \int _{Q_{t}}|\partial _{t}q^{h}|^2+ c \left\| h_{\Gamma } \right\| _{L^{2}(\Sigma )}^4 \end{aligned}$$

thanks to the stability estimate (4.1). As the same calculation can be done for the last term on the right-hand side of (4.8), we can combine, apply the standard Gronwall lemma, and conclude that (4.5) holds true. \(\square \)

5 The Adjoint Problem

In this section, we prove Theorem 2.5, i.e., we show that problem (2.47)–(2.49) has a unique solution under the further assumptions (2.50). Moreover, we briefly show how (2.50) can be avoided by just requiring less regularity to the solution (see Remark 5.6).

In order to solve problem (2.47)–(2.49), we first prove that it is equivalent to a decoupled problem that can be solved by first finding \(q\) and then reconstructing \(p\). The basic ideas are explained at once. We note that the function \(q(t)\) has zero mean value \(\hbox {for a.a. }t\in (0,T)\), as we immediately see by choosing \(v=1\) in (2.47). So, if we introduce the mean value function \(p^{\Omega }\in C^0([0,T])\) (see (2.10)), we realize that, \(\hbox {for a.a. }t\in (0,T)\), \((p-p^{\Omega })(t)\) satisfies definition (2.56) with \(v_{*}=q(t)\). We thus have \(p(t)-p^{\Omega }(t)={\fancyscript{N}}(q(t))\). On the other hand, for any fixed \(t\), the function \(p^{\Omega }(t)\) is a constant; thus, it is orthogonal in \(L^{2}(\Omega )\) to the subspace of functions having zero mean value. Thus, \(p\) is completely eliminated from Eq. (2.48) if we confine ourselves to use test functions with zero mean value. Similar remarks have to be done for the final condition on \(p+q\) that appears in (2.49). Whenever we find a solution \((q,q_{\Gamma })\) to this new problem, then we can reconstruct \(p\) as just said, provided that we can calculate \(p^{\Omega }\). All this is made precise in our next theorem. As we are going to use test functions with zero mean value, we introduce the proper spaces by

$$\begin{aligned} {\fancyscript{H}}_{\Omega }:= \left\{ (v,v_{\Gamma }) \in {\fancyscript{H}}:\ v^{\Omega }=0\right\} \quad \hbox {and}\quad {\fancyscript{V}}_{\Omega }:= {\fancyscript{H}}_{\Omega }\cap {\fancyscript{V}} \end{aligned}$$
(5.1)

and endow them with their natural topologies as subspaces of \({\fancyscript{H}}\) and \({\fancyscript{V}}\), respectively. We observe that the first components \(v\) of the elements \((v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\) cannot span the whole of \(C^\infty _c(\Omega )\) because of the zero mean value condition. This has the following consequence: variational equations with test functions in \({\fancyscript{V}}_{\Omega }\) cannot be immediately read as equations in the sense of distributions (this is the price we have to pay for the transformation of the old adjoint system into the new one!). Hence, some care is in order, and we have to prove some auxiliary lemmas. Here, we use the notation \(u_{\Gamma }\) even though it has nothing to do with the control variable.

Lemma 5.1

The set \(\left\{ v_{\Gamma }:\ (v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\right\} \) is the whole of \(V_{\Gamma }\).

Proof

Take any \(v_{\Gamma }\in V_{\Gamma }\). As \(V_{\Gamma }\subset H^{1/2}(\Gamma )\), there exists some \(g\in H^{1}(\Omega )\) such that \({g} {}_{|_{\Gamma }}=v_{\Gamma }\). Now, we fix a closed ball \(B\subset \Omega \) and a function \(\zeta \in C^1(\overline{\Omega })\) such that \(\zeta =0\) in \(\Omega \setminus B\) and \(\int _B\zeta =1\). Next, we define \(m=\int _{\Omega }g \) and \(v:= g -m\zeta \). Then, it turns out that \(v \in H^{1}(\Omega )\), \(v{}_{|_{\Gamma }}=g{}_{|_{\Gamma }}= v_{\Gamma }\), and \(\int _{\Omega }v=0\), i.e., \((v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\). \(\square \)

Lemma 5.2

Assume that \((u,u_{\Gamma })\in {\fancyscript{H}}\). Then the condition

$$\begin{aligned} \int _{\Omega }uv + \int _{\Gamma }u_{\Gamma }v_{\Gamma }= 0\quad \text {for every }(v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega } \end{aligned}$$
(5.2)

implies that \(u\) is a constant, namely, the mean value \(u^{\Omega }\) of \(u\), and \(u_{\Gamma }=0\). Moreover, \(u=0\) if (5.2) holds for every \((v,v_{\Gamma })\in {\fancyscript{V}}\).

Proof

We first decouple (5.2). To this end, we fix \(v_{0}\in {H^1_0(\Omega )}\) such that \(v_{0}^\Omega =1\) and set \(k:=|\Omega |^{-1}\int _{\Omega }u\,v_{0}\). Now, we take any \(v\in {H^1_0(\Omega )}\) and observe that \(v-v^{\Omega }v_{0}\) belongs to \({H^1_0(\Omega )}\) and has zero mean value. Hence, \((v-v^{\Omega }v_{0},0)\in {\fancyscript{V}}_{\Omega }\), and (5.2) yields that

$$\begin{aligned} 0 = \int _{\Omega }u (v-v^{\Omega }v_{0})= \int _{\Omega }u \, v - k \int _{\Omega }v= \int _{\Omega }(u - k) v. \end{aligned}$$

As \(v\in {H^1_0(\Omega )}\) is arbitrary and \({H^1_0(\Omega )}\) is dense in \(L^{2}(\Omega )\), we infer that \(u=k\) \(\hbox {a.e. in }\Omega \), i.e., \(u\) is a constant, and this constant must equal \(u^{\Omega }\). Hence, (5.2) implies

$$\begin{aligned} \int _{\Gamma }u_{\Gamma }v_{\Gamma }= 0\quad \text {for every }(v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }. \end{aligned}$$

By Lemma 5.1, the above equality holds for every \(v_{\Gamma }\in V_{\Gamma }\). As this space is dense in \(L^{2}(\Gamma )\), we deduce that \(u_{\Gamma }=0\). If in addition (5.2) holds for every \((v,v_{\Gamma })\in {\fancyscript{V}}\), then we can take \(v=1\) and \(v_{\Gamma }=1\) in (5.2) and deduce that \(u^{\Omega }=0\) (since we already know that \(u_{\Gamma }=0\)). \(\square \)

Corollary 5.3

The space \({\fancyscript{V}}_{\Omega }\) is dense in \({\fancyscript{H}}_{\Omega }\).

Proof

We prove the following equivalent statement: the only element \((u,u_{\Gamma })\in {\fancyscript{H}}_{\Omega }\) that is orthogonal to \({\fancyscript{V}}_{\Omega }\) with respect to the scalar product in \({\fancyscript{H}}\) is the zero element of \({\fancyscript{H}}_{\Omega }\). Thus, we assume that

$$\begin{aligned} \int _{\Omega }u \, v + \int _{\Gamma }u_{\Gamma }\, v_{\Gamma }= 0\quad \text {for every }(v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }. \end{aligned}$$
(5.3)

By Lemma 5.2, we deduce that \(u\) is a constant and that \(u_{\Gamma }=0\). As \(u\in {\fancyscript{H}}_{\Omega }\), the constant must be \(0\). Therefore, \((u,u_{\Gamma })=(0,0)\). \(\square \)

In order to simplify the form of the problems we are dealing with, we introduce a notation. Starting from the state \((\overline{y},\overline{y}_{\Gamma })\) associated to an optimal control, we set

$$\begin{aligned}&\lambda := f''(\overline{y}) \,, \quad \lambda _\Gamma := f_{\Gamma }''(\overline{y}_{\Gamma })\end{aligned}$$
(5.4)
$$\begin{aligned}&\varphi _{Q}:= b_{Q}(\overline{y}-z_{Q}) \,, \quad \varphi _{\Sigma }:= b_{\Sigma }(\overline{y}_{\Gamma }-z_{\Sigma })\end{aligned}$$
(5.5)
$$\begin{aligned}&\varphi _{\Omega }:= b_{\Omega }\bigl ( \overline{y}(T) - z_{\Omega }\bigr ) \,, \quad \varphi _{\Gamma }:= b_{\Gamma }\bigl ( \overline{y}_{\Gamma }(T) - z_{\Gamma }\bigr ) \,. \end{aligned}$$
(5.6)

Then, the adjoint problem (2.47)–(2.49) becomes:

$$\begin{aligned}&\int _{\Omega }q(t) \, v= \int _{\Omega }\nabla p(t) \cdot \nabla v\quad \text {for all }t\in [0,T]\text { and }v\in V\end{aligned}$$
(5.7)
$$\begin{aligned}&{- \int _{\Omega }\partial _{t}\bigl ( p(t) + q(t) \bigr ) \, v+ \int _{\Omega }\nabla q(t) \cdot \nabla v+ \int _{\Omega }\lambda (t) \, q(t) \, v}\qquad \nonumber \\&\qquad - \int _{\Gamma }\partial _{t}q_{\Gamma }(t) \, v_{\Gamma }+ \int _{\Gamma }\nabla _{\Gamma }q_{\Gamma }(t) \cdot \nabla _{\Gamma }v_{\Gamma }+ \int _{\Gamma }\lambda _\Gamma (t) \, q_{\Gamma }(t) \, v_{\Gamma }\nonumber \\&\quad = \int _{\Omega }\varphi _{Q}(t) v+ \int _{\Gamma }\varphi _{\Sigma }(t) v_{\Gamma }\quad \hbox {for a.a. }t\in (0,T)\text { and every }(v,v_{\Gamma })\in {\fancyscript{V}}\qquad \end{aligned}$$
(5.8)
$$\begin{aligned}&\int _{\Omega }(p+q)(T) \, v+ \int _{\Gamma }q_{\Gamma }(T) \, v_{\Gamma }= \int _{\Omega }\varphi _{\Omega }v+ \int _{\Gamma }\varphi _{\Gamma }v_{\Gamma }\quad \text {for every }(v,v_{\Gamma })\in {\fancyscript{V}}.\nonumber \\ \end{aligned}$$
(5.9)

The result stated below ensures the equivalence of problem (5.7)–(5.9) and a new problem with decoupled equations, as sketched at the beginning of the present section. We note at once that the latter is plainly meaningful since \({\fancyscript{N}}q\) is well defined (see (2.55)). The statement also involves the operator \({\fancyscript{M}}:L^{2}(0,T;H^{2}(\Omega ))\rightarrow H^1(0,T)\) defined by

$$\begin{aligned} ({\fancyscript{M}}(v))(t) :=(\varphi _{\Omega })^{\Omega }- \frac{1}{|\Omega |} \int _t^T \!\! \int _{\Omega }\bigl ( - \Delta v + \lambda v - \varphi _{Q}\bigr )\quad \text {for every }t\in [0,T]. \end{aligned}$$
(5.10)

We notice that the subsequent proof will also show that the adjoint problem is solved in the strong form presented in the Sect. 1.

Theorem 5.4

Assume (2.43)–(2.46). Then, \((p,q,q_{\Gamma })\) solves problem (5.7)–(5.9) if and only if

$$\begin{aligned} q^\Omega (t) = 0\quad \hbox {and}\quad p(t) = {\fancyscript{N}}(q(t)) + ({\fancyscript{M}}(q))(t)\quad {\text {for every } t\in [0,T]} \end{aligned}$$
(5.11)
$$\begin{aligned}&- \int _{\Omega }\partial _{t}\bigl ( {\fancyscript{N}}(q(t)) + q(t) \bigr ) \, v+ \int _{\Omega }\nabla q(t) \cdot \nabla v+ \int _{\Omega }\lambda (t) \, q(t) \, v\qquad \nonumber \\&\qquad - \int _{\Gamma }\partial _{t}q_{\Gamma }(t) \, v_{\Gamma }+ \int _{\Gamma }\nabla _{\Gamma }q_{\Gamma }(t) \cdot \nabla _{\Gamma }v_{\Gamma }+ \int _{\Gamma }\lambda _\Gamma (t) \, q_{\Gamma }(t) \, v_{\Gamma }\nonumber \\&\quad = \int _{\Omega }\varphi _{Q}(t) v+ \int _{\Gamma }\varphi _{\Sigma }(t) v_{\Gamma }\quad \hbox {for a.a. }t\in (0,T)\text { and every }(v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega } \end{aligned}$$
(5.12)
$$\begin{aligned} \int _{\Omega }\bigl ( {\fancyscript{N}}q + q \bigr )(T) \, v+ \int _{\Gamma }q_{\Gamma }(T) \, v_{\Gamma }= \int _{\Omega }\varphi _{\Omega }v+ \int _{\Gamma }\varphi _{\Gamma }v_{\Gamma }\quad \text {for every }(v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\,. \end{aligned}$$
(5.13)

Proof

We assume that \((p,q,q_{\Gamma })\) satisfies (5.7)–(5.9) and prove that it solves (5.11)–(5.13). We often omit writing the time \(t\) in order to simplify the notation. By taking \(v=1\) in (5.7), we see that the first assertion of (5.11) holds. In particular, the second assertion of (5.11) is meaningful. Moreover, by the definition (2.56) of \({\fancyscript{N}}\), we have

$$\begin{aligned} p(t) - p^{\Omega }(t) = {\fancyscript{N}}(q(t))\quad \text {or} \quad p(t) = {\fancyscript{N}}(q(t)) + p^{\Omega }(t)\quad \hbox {for a.a. }t\in (0,T).\nonumber \\ \end{aligned}$$
(5.14)

We now prove the second equality in (5.11). By taking any \(v\in {{\fancyscript{D}}(\Omega )}\) and using \((v,0)\) as a test functions in (5.8), we derive that

$$\begin{aligned} - \partial _{t}(p+q) - \Delta q + \lambda q = \varphi _{Q}\quad \text {or} \quad \frac{1}{|\Omega |} \, \partial _{t}(p+q)= \frac{1}{|\Omega |} \, ( -\Delta q + \lambda q - \varphi _{Q}) \end{aligned}$$

in the sense of distributions on \(Q\), whence \(\hbox {a.e. in }Q\) as well, due to the regularity of \(p\) and \(q\). By observing that both \(q\) and \(\partial _{t}q\) have zero mean value (the latter as a consequence of the former), and just integrating the last equation over \(\Omega \), we obtain

$$\begin{aligned}&\frac{dp^{\Omega }}{dt}= \frac{1}{|\Omega |}\int _{\Omega }( -\Delta q + \lambda q - \varphi _{Q})\quad \text {whence} \\&\quad p^{\Omega }(t) = p^{\Omega }(T) -\, \frac{1}{|\Omega |} \int _t^T \!\! \int _{\Omega }( -\Delta q + \lambda q - \varphi _{Q}) \,. \end{aligned}$$

On the other hand, (5.9) implies that \((p+q)(T)=\varphi _{\Omega }\), whence \(p^{\Omega }(T)=(\varphi _{\Omega })^{\Omega }\) since \(q(T)\) has zero mean value. By combining, we infer that

$$\begin{aligned} p^{\Omega }(t)= (\varphi _{\Omega })^{\Omega }- \frac{1}{|\Omega |} \int _t^T \!\! \int _{\Omega }( -\Delta q + \lambda q - \varphi _{Q})= ({\fancyscript{M}}(q))(t) \,. \end{aligned}$$

Therefore, the second assertion in (5.11) follows from (5.14). In order to prove (5.12)–(5.13), it suffices to write (5.8)–(5.9) with \((v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\), by recalling (5.14) once more and observing that \(\partial _{t}p^{\Omega }\) and \(p^{\Omega }(T)\) are space independent.

Conversely, we now assume that \((p,q,q_{\Gamma })\) solves (5.11)–(5.13) and prove that the Eqs. (5.7)–(5.9) are satisfied. We start from (5.11). As \({\fancyscript{M}}(q)\) is space independent, by recalling the definition (2.56) of the operator \({\fancyscript{N}}\), we have, \(\hbox {for a.a. }t\in (0,T)\) and every \(v\in V\),

$$\begin{aligned} \int _{\Omega }\nabla p(t) \cdot \nabla v= \int _{\Omega }\nabla {\fancyscript{N}}q(t) \cdot \nabla v= \int _{\Omega }q(t) v \,. \end{aligned}$$

This is exactly (5.7). Now, we prove (5.8). We deduce the strong form of the problem hidden in the variational Eq. (5.12) thanks to the integration by parts formulas

$$\begin{aligned}&\int _{\Omega }\nabla q(t) \cdot \nabla v= \int _{\Omega }(-\Delta q(t)) v+ \int _{\Gamma }\partial _{n}q(t) \, v{}_{|_{\Gamma }}= \int _{\Omega }(-\Delta q(t)) v+ \int _{\Gamma }\partial _{n}q(t) \, v_{\Gamma }\\&\int _{\Gamma }\nabla _{\Gamma }q_{\Gamma }(t) \cdot \nabla _{\Gamma }v_{\Gamma }= \int _{\Gamma }(-\Delta _\Gamma {q_{\Gamma }} (t)) \, v_{\Gamma }, \end{aligned}$$

where \((v,v_{\Gamma })\in {\fancyscript{V}}\). Thus, (5.12) becomes

$$\begin{aligned} \int _{\Omega }u(t) v + \int _{\Gamma }u_{\Gamma }(t) v_{\Gamma }= 0\quad \hbox {for a.a. }t\in (0,T)\text { and every }(v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }, \end{aligned}$$

where the pair \((u,u_{\Gamma })\in L^{2}(0,T;{\fancyscript{H}})\) is given by

$$\begin{aligned} u(t):= & {} -\partial _{t}\bigl ( {\fancyscript{N}}(q(t)) + q(t) \bigr )- \Delta q(t) + \lambda (t) \, q(t) - \varphi _{Q}(t)\\ u_{\Gamma }(t):= & {} \partial _{n}q(t) - \partial _{t}q_{\Gamma }(t) - \Delta _\Gamma q_{\Gamma }(t) + \lambda _\Gamma (t) \, q_{\Gamma }(t) - \varphi _{\Sigma }(t) \,. \end{aligned}$$

Then, Lemma 5.2 yields

$$\begin{aligned} u(t) = (u(t))^\Omega \quad \hbox {and}\quad u_{\Gamma }(t) = 0\quad \hbox {for a.a. }t\in (0,T). \end{aligned}$$

On the other hand, by recalling that \({\fancyscript{N}}(\partial _{t}q)\) and \(\partial _{t}q\) have zero mean values by the definition of \({\fancyscript{N}}\) and the first identity in (5.11), and owing to the definition (5.10) of \({\fancyscript{M}}\), we have

$$\begin{aligned}&|\Omega | \, (u(t))^\Omega = \int _{\Omega }\bigl \{- \bigl ( {\fancyscript{N}}(\partial _{t}q(t)) + \partial _{t}q(t) \bigr )- \Delta q(t) + \lambda (t) \, q(t) - \varphi _{Q}(t)\bigr \}\\&\qquad \qquad \qquad = \int _{\Omega }\bigl \{- \Delta q(t) + \lambda (t) \, q(t) - \varphi _{Q}(t)\bigr \}= |\Omega | \, \partial _{t}({\fancyscript{M}}(q))(t)\quad \hbox {for a.a. }t\in (0,T). \end{aligned}$$

We infer that

$$\begin{aligned} -\partial _{t}\bigl ( {\fancyscript{N}}(q(t)) + q(t) \bigr )- \Delta q(t) + \lambda (t) \, q(t) - \varphi _{Q}(t)= \partial _{t}({\fancyscript{M}}(q))(t)\quad \hbox {for a.a. }t\in (0,T)\end{aligned}$$

so that (5.11) yields

$$\begin{aligned}&\int _{\Omega }\bigl \{- \partial _{t}\bigl ( p(t) + q(t) \bigr )- \Delta q(t) + \lambda (t) \, q(t) - \varphi _{Q}(t)\bigr \} \, v= 0\\&\quad \hbox {for a.a. }t\in (0,T)\text { and every }v\in V. \end{aligned}$$

Now, the identity \(u_{\Gamma }=0\) implies

$$\begin{aligned}&\int _{\Gamma }\bigl \{\partial _{n}q(t) - \partial _{t}q_{\Gamma }(t) - \Delta _\Gamma q_{\Gamma }(t) + \lambda _\Gamma (t) \, q_{\Gamma }(t) - \varphi _{\Sigma }(t)\bigr \}\, {v_{\Gamma }}= 0\\&\quad \hbox {for a.a. }t\in (0,T)\text { and every }v_{\Gamma }\in V_{\Gamma }. \end{aligned}$$

In particular, for any \((v,v_{\Gamma })\in {\fancyscript{V}}\), we can write both previous equalities and add them to each other. By integrating by parts in the opposite direction, we deduce (5.8). Finally, by applying Lemma 5.2 once more, we derive from (5.13)

$$\begin{aligned} \bigl ( {\fancyscript{N}}q + q \bigr )(T) - \varphi _{\Omega }= k\quad \hbox {and}\quad q_{\Gamma }(T) - \varphi _{\Gamma }= 0 \end{aligned}$$

where \(k\) is the mean value of the left-hand side. Note that both \(q(T)\) and \(({\fancyscript{N}}q)(T)\) have zero mean value by the first identity in (5.11) and the definition (2.56) of \({\fancyscript{N}}\). Then, we have \(k=-(\varphi _{\Omega })^{\Omega }\). Hence, by the definition of \({\fancyscript{M}}\), we infer that

$$\begin{aligned} ({\fancyscript{N}}q+q)(T)= \varphi _{\Omega }- (\varphi _{\Omega })^{\Omega }= \varphi _{\Omega }- (M(q))(T) . \end{aligned}$$

Then, the second assertion in (5.11) yields \((p+q)(T)=\varphi _{\Omega }\), and (5.9) follows immediately. \(\square \)

Thanks to the theorem just proved, we can replace the old adjoint problem by the new one in which the equations are decoupled. As we are going to see the sub-problem for \((q,q_{\Gamma })\) as an abstract differential equation, we prepare the proper framework, which is related to the Hilbert spaces \({\fancyscript{V}}_{\Omega }\) and \({\fancyscript{H}}_{\Omega }\) defined in (5.1). To this end, let \(_{\mathcal{V}^*_\Omega } \langle \,\cdot \,,\,\cdot \,\rangle _{\mathcal{V}_\Omega }\,\) denote the dual pairing between \(\mathcal{V}^*_\Omega \) and \(\mathcal{V}_\Omega \). Then, recalling that \({\fancyscript{V}}_{\Omega }\) is by Corollary 5.3 dense in \({\fancyscript{H}}_{\Omega }\), we can construct the Hilbert triplet \(({\fancyscript{V}}_{\Omega },{\fancyscript{H}}_{\Omega },{\fancyscript{V}}_{\Omega }^{*})\), that is, we identify \({\fancyscript{H}}_{\Omega }\) with a subspace of \({\fancyscript{V}}_{\Omega }^{*}\), the dual space of \({\fancyscript{V}}_{\Omega }\), in order that

$$\begin{aligned} _{{\fancyscript{V}}_{\Omega }^{*}} \left\langle (u,u_{\Gamma }) , (v,v_{\Gamma })\right\rangle _{{\fancyscript{V}}_{\Omega }}= \bigl ( (u,u_{\Gamma }) , (v,v_{\Gamma }) \bigr )_{{\fancyscript{H}}_{\Omega }}\quad \forall \,(u,u_{\Gamma })\in {\fancyscript{H}}_{\Omega }, \quad \forall \,(v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\,. \end{aligned}$$
(5.15)

Here, we define the scalar product \((\,\cdot \,,\,\cdot \,)_{{\fancyscript{H}}_{\Omega }}\) and the scalar product in \({\fancyscript{V}}_{\Omega }\) by

$$\begin{aligned}&\bigl ( (u,u_{\Gamma }) , (v,v_{\Gamma }) \bigr )_{{\fancyscript{H}}_{\Omega }}&:= \int _{\Omega }u \, v + \int _{\Gamma }u_{\Gamma }\, v_{\Gamma }\end{aligned}$$
(5.16)
$$\begin{aligned}&\bigl ( (u,u_{\Gamma }) , (v,v_{\Gamma }) \bigr )_{{\fancyscript{V}}_{\Omega }}&:= \int _{\Omega }\nabla u \cdot \nabla v + \int _{\Gamma }\nabla _{\Gamma }u_{\Gamma }\cdot \nabla _{\Gamma }v_{\Gamma }\,. \end{aligned}$$
(5.17)

In (5.16) (resp. (5.17)), \((u,u_{\Gamma })\) and \((v,v_{\Gamma })\) denote generic elements of \({\fancyscript{H}}_{\Omega }\) (resp. \({\fancyscript{V}}_{\Omega }\)). Note that (5.17) actually defines a scalar product in \({\fancyscript{V}}_{\Omega }\) that is equivalent to the standard one by the Poincaré inequality (2.54). We also introduce the associated Riesz operator \({\fancyscript{R}}_{\Omega }\in {\fancyscript{L}}({\fancyscript{V}}_{\Omega },{\fancyscript{V}}_{\Omega }^{*})\), namely

$$\begin{aligned} _{{\fancyscript{V}}_{\Omega }^{*}} \left\langle {\fancyscript{R}}_{\Omega }(u,u_{\Gamma }) , (v,v_{\Gamma })\right\rangle _{{\fancyscript{V}}_{\Omega }}= \bigl ( (u,u_{\Gamma }) , (v,v_{\Gamma }) \bigr )_{{\fancyscript{V}}_{\Omega }}\quad \text {for every }(u,u_{\Gamma }),(v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\,. \end{aligned}$$
(5.18)

Since, as already mentioned, variational equations with test functions in \({\fancyscript{V}}_{\Omega }\) cannot immediately be read as differential equations, we also prove the following lemma.

Lemma 5.5

Assume \((u,u_{\Gamma })\in {\fancyscript{V}}_{\Omega }\) and \({\fancyscript{R}}_{\Omega }(u,u_{\Gamma })\in {\fancyscript{H}}_{\Omega }\). Then we have \(u\in H^{2}(\Omega )\) and \(u_{\Gamma }\in H^{2}(\Gamma )\). Moreover, it holds

$$\begin{aligned} \left\| u \right\| _{H^{2}(\Omega )} + \left\| u_{\Gamma } \right\| _{H^{2}(\Gamma )}\le c\, \left\| {\fancyscript{R}}_{\Omega }(u,u_{\Gamma }) \right\| _{{\fancyscript{H}}_{\Omega }}\,, \end{aligned}$$
(5.19)

where \(c\) depends only on \(\Omega \).

Proof

The assumptions mean that there exists some \((\psi ,\psi _{\Gamma })\in {\fancyscript{H}}_{\Omega }\) such that

$$\begin{aligned}&\bigl ( (u,u_{\Gamma }) , (v,v_{\Gamma }) \bigr )_{{\fancyscript{V}}_{\Omega }}= \bigl ( (\psi ,\psi _{\Gamma }) , (v,v_{\Gamma }) \bigr )_{{\fancyscript{H}}_{\Omega }} \,,\quad \text {that is,}\nonumber \\&\int _{\Omega }\nabla u \cdot \nabla v + \int _{\Gamma }\nabla _{\Gamma }u_{\Gamma }\cdot \nabla _{\Gamma }v_{\Gamma }= \int _{\Omega }\psi v + \int _{\Gamma }\psi _{\Gamma }v_{\Gamma } \end{aligned}$$
(5.20)

for every \((v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\). As in the proof of Lemma 5.2, we decouple (5.20). We fix \(v_{0}\in {H^1_0(\Omega )}\) such that \(v_{0}^\Omega =1\) and set

$$\begin{aligned} c_1:=\int _{\Omega }\nabla u\cdot \nabla v_{0}, \quad c_2:=\int _{\Omega }\psi v_{0}\end{aligned}$$

and \(k_i:=c_i/|\Omega |\) for \(i=1,2\). Now, we take any \(v\in {H^1_0(\Omega )}\). As \(v-v^{\Omega }v_{0}\) belongs to \({H^1_0(\Omega )}\) and has zero mean value, we have \((v-v^{\Omega }v_{0},0)\in {\fancyscript{V}}_{\Omega }\), and (5.20) yields

$$\begin{aligned} \int _{\Omega }\nabla u \cdot \nabla (v-v^{\Omega }v_{0})= \int _{\Omega }\psi (v-v^{\Omega }v_{0})\quad \text {or} \quad \int _{\Omega }(\nabla u \cdot \nabla v - k_1 v)= \int _{\Omega }(\psi - k_2) v \,. \end{aligned}$$

As \(v\in {H^1_0(\Omega )}\) is arbitray, this simply means

$$\begin{aligned} - \Delta u = \psi + k\quad \text {where }k:=k_1-k_2. \end{aligned}$$
(5.21)

In particular, we infer that \(\Delta u\in L^{2}(\Omega )\) and this, combined with \(u{}_{|_{\Gamma }}= u_{\Gamma }\in H^1(\Gamma )\), yields (cf., e.g., [2], Thm. 3.2, p. 1.79]) \(u\in H^{3/2} (\Omega )\). Then, by a trace theorem stated, e.g., in [2], Thm. 2.25, p. 1.62] it follows that \(\partial _{n}u\) lies in \(L^{2}(\Gamma )\) and we can integrate by parts. Hence, for any \((v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\) we have

$$\begin{aligned}&\int _{\Omega }(\psi + k) v+ \int _{\Gamma }\nabla _{\Gamma }u_{\Gamma }\cdot \nabla _{\Gamma }v_{\Gamma }= \int _{\Omega }(-\Delta u) v+ \int _{\Gamma }\nabla _{\Gamma }u_{\Gamma }\cdot \nabla _{\Gamma }v_{\Gamma }\\&= \int _{\Omega }\nabla u \cdot \nabla v{- \int _{\Gamma }\partial _{n}u \, v{}_{|_{\Gamma }}}+ \int _{\Gamma }\nabla _{\Gamma }u_{\Gamma }\cdot \nabla _{\Gamma }v_{\Gamma }\\&= \int _{\Omega }\psi v+ \int _{\Gamma }\psi _{\Gamma }v_{\Gamma }{- \int _{\Gamma }\partial _{n}u \, v_{\Gamma }}= \int _{\Omega }(\psi + k) v+ \int _{\Gamma }(\psi _{\Gamma }{- \partial _{n}u ) v_{\Gamma }.} \end{aligned}$$

Therefore, we deduce that

$$\begin{aligned} \int _{\Gamma }\nabla _{\Gamma }u_{\Gamma }\cdot \nabla _{\Gamma }v_{\Gamma }{= \int _{\Gamma }(\psi _{\Gamma }- \partial _{n}u ) v_{\Gamma }}\quad \text {for every }(v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\end{aligned}$$

and Lemma 5.1 implies that the same equality holds for every \(v_{\Gamma }\in V_{\Gamma }\), whence

$$\begin{aligned} - \Delta _\Gamma u_{\Gamma }= \psi _{\Gamma }- \partial _{n}u \quad \text {on }\Gamma . \end{aligned}$$
(5.22)

As \(\psi _{\Gamma }\) and \(\partial _{n}u\) both belong to \(L^{2}(\Gamma )\), the regularity theory for elliptic equations (in fact, its boundary version) implies that \(u_{\Gamma }\in H^{2}(\Gamma )\) (see, e.g., [20], Thms. 7.4 and 7.3, pp. 187–188] or [2], Thm. 3.2, p. 1.79, and Thm. 2.27, p. 1.64]). Coming back to \(u\), we thus have \(\Delta u\in L^{2}(\Omega )\) and \(u{}_{|_{\Gamma }}=u_{\Gamma }\in H^{2}(\Gamma )\), whence \(u\in H^{2}(\Omega )\). Finally, as each of the regularity results we have used corresponds to an estimate for the related norm, (5.19) holds as well. \(\square \)

At this point, we are ready to prove Theorem 2.5. Thanks to Theorem 5.4, it is sufficient to prove that there exists a unique solution to problem (5.11)–(5.13) satisfying the regularity requirements (2.43)–(2.46). Moreover, once the existence of a unique solution \((q,q_{\Gamma })\) to (5.12)–(5.13) with the prescribed regularity is established, it suffices to observe that (5.11) provides a function \(p\) that fulfills (2.43). Indeed, (2.44) and (2.57) imply \({\fancyscript{N}}q\in L^{2}(0,T;H^{4}(\Omega ))\) and \(\partial _{t}{\fancyscript{N}}q={\fancyscript{N}}(\partial _{t}q)\in L^{2}(0,T;H^{2}(\Omega ))\). On the other hand, \({\fancyscript{M}}(q)\) is space independent, and its time derivative belongs to \(L^2(0,T)\) since it is the mean value of an element of \(L^{2}(Q)\). Hence, we have that \(p\in L^{2}(0,T;H^{4}(\Omega ))\) and \(\partial _{t}p\in L^{2}(0,T;H^{2}(\Omega ))\).

In the following, we denote pairs belonging to \(\mathcal{H}_\Omega \) by bold letters, writing, for instance, \(\mathbf{v}\) in place of \((v,v_\Gamma )\). From this no confusion will arise. We are going to present the problem in the form

$$\begin{aligned}&- \frac{d}{dt} \, \bigl ( {\fancyscript{B}}{\mathbf {q}}(t),{\mathbf {v}}\bigr )_{{\fancyscript{H}}_{\Omega }}+ _{{\fancyscript{V}}_{\Omega }^{*}} \left\langle {\fancyscript{A}}(t){\mathbf {q}}(t) , {\mathbf {v}}\right\rangle _{{\fancyscript{V}}_{\Omega }}= _{{\fancyscript{V}}_{\Omega }^{*}} \left\langle {\mathbf {f}}(t),{\mathbf {v}}\right\rangle _{{\fancyscript{V}}_{\Omega }}\nonumber \\&\quad \hbox {for a.a. }t\in (0,T)\text { and every }{\mathbf {v}}\in {\fancyscript{V}}_{\Omega }\end{aligned}$$
(5.23)
$$\begin{aligned}&\bigl ( ({\fancyscript{B}}{\mathbf {q}})(T) , {\mathbf {v}}\bigr )_{{\fancyscript{H}}_{\Omega }}= \bigl ( {\mathbf {z}}_{T}, {\mathbf {v}}\bigr )_{{\fancyscript{H}}_{\Omega }}\quad \text {for every }{\mathbf {v}}\in {\fancyscript{H}}_{\Omega } \end{aligned}$$
(5.24)

with a proper choice of the operators \({\fancyscript{A}}(t)\in {\fancyscript{L}}({\fancyscript{V}}_{\Omega },{\fancyscript{V}}_{\Omega }^{*})\) and \({\fancyscript{B}}\in {\fancyscript{L}}({\fancyscript{V}}_{\Omega },{\fancyscript{H}}_{\Omega })\), and of the data \({\mathbf {f}}\in L^{2}(0,T;{\fancyscript{V}}_{\Omega }^{*})\) and \({\mathbf {z}}_{T}\in {\fancyscript{H}}_{\Omega }\). This means that the following backward Cauchy problem

$$\begin{aligned} -\frac{d}{dt} \, \bigl ( {\fancyscript{B}}\, {\mathbf {q}}(t) \bigr ) + {\fancyscript{A}}(t) \, {\mathbf {q}}(t) = {\mathbf {f}}(t)\quad \hbox {for a.a. }t\in (0,T),\quad \hbox {and}\quad ({\fancyscript{B}}{\mathbf {q}})(T) = {\mathbf {z}}_{T} \end{aligned}$$
(5.25)

has to be solved. Problem (5.25) (in fact the equivalent forward problem obtained by replacing \(t\) by \(T-t\)) is well known (see [1] for a very general situation that allows for time dependent and even nonlocal operators). Here, we recall sufficient conditions that imply those given in [19], Thm. 7.1, p. 70] and thus yield well-posedness in a proper framework. We can require that

$$\begin{aligned}&\!{\fancyscript{A}}(t) \!=\! {\fancyscript{A}}_{0}\!+\! \Lambda (t) \,, \quad {\fancyscript{A}}_{0}\in \!{\fancyscript{L}}({\fancyscript{V}}_{\Omega },{\fancyscript{V}}_{\Omega }^{*}),\\&\quad \hbox {and}\quad \Lambda (t) \in {\fancyscript{L}}({\fancyscript{H}}_{\Omega },{\fancyscript{H}}_{\Omega })\quad \hbox {for a.a. }t\in (0,T);\\&_{{\fancyscript{V}}_{\Omega }^{*}} \left\langle {\fancyscript{A}}_{0}{\mathbf {v}}, {\mathbf {v}}\right\rangle _{{\fancyscript{V}}_{\Omega }}\ge \alpha \left\| {\mathbf {v}} \right\| _{{\fancyscript{V}}_{\Omega }}^2\quad \text {for some }\alpha >0\text { and every }{\mathbf {v}}\in {\fancyscript{V}}_{\Omega };\\&\left\| \Lambda (t){\mathbf {v}} \right\| _{{\fancyscript{H}}_{\Omega }}\le M \left\| {\mathbf {v}} \right\| _{{\fancyscript{H}}_{\Omega }}\quad \text {for some constant }M>0\text { and every }{\mathbf {v}}\in {\fancyscript{H}}_{\Omega };\\&{\fancyscript{B}}\in {\fancyscript{L}}({\fancyscript{H}}_{\Omega },{\fancyscript{H}}_{\Omega })\quad \text {is symmetric and satisfies}\\&_{{\fancyscript{H}}_{\Omega }} \bigl ( {\fancyscript{B}}{\mathbf {v}}, {\mathbf {v}}\bigr ) _{{\fancyscript{H}}_{\Omega }}\ge \alpha \left\| {\mathbf {v}} \right\| _{{\fancyscript{H}}_{\Omega }}^2\quad \text {for some }\alpha >0\text { and every }{\mathbf {v}}\in {\fancyscript{V}}_{\Omega }\,. \end{aligned}$$

Moreover, \(\Lambda \) is (properly) measurable with respect to \(t\). If such conditions hold then, for every \({\mathbf {f}}\in L^{2}(0,T;{\fancyscript{V}}_{\Omega }^{*})\) and \({\mathbf {z}}_{T}\in {\fancyscript{H}}_{\Omega }\), problem (5.25) has a unique solution

$$\begin{aligned} {\mathbf {q}}\in H^{1}(0,T;{\fancyscript{V}}_{\Omega }^{*})\cap L^{2}(0,T;{\fancyscript{V}}_{\Omega })\subset C^{0}([0,T];{\fancyscript{H}}_{\Omega })\,. \end{aligned}$$

Furthermore, the solution \({\mathbf {q}}\) also satisfies

$$\begin{aligned} {\mathbf {q}}' \in L^{2}(0,T;{\fancyscript{H}}_{\Omega })\quad \text {if} \quad {\fancyscript{A}}_{0}\text { is symmetric, } {\mathbf {f}}\in L^{2}(0,T;{\fancyscript{H}}_{\Omega })\text { and } {\mathbf {q}}(T)\in {\fancyscript{V}}_{\Omega }. \end{aligned}$$

In our case, we choose

$$\begin{aligned}&{\fancyscript{A}}_{0}= {\fancyscript{R}}_{\Omega }\,,\quad \text {the Riesz operator (5.18)}\\&\Lambda (t) (v,v_{\Gamma }) = \bigl ( \lambda (t) v - (\lambda (t) v)^\Omega , \lambda _\Gamma (t) v_{\Gamma }\bigr )\quad \hbox {for a.a. }t\in (0,T)\text { and }(v,v_{\Gamma })\in {\fancyscript{H}}_{\Omega }\\&{\fancyscript{B}}(v,v_{\Gamma }) = ({\fancyscript{N}}v + v , v_{\Gamma })\quad \text {for every }(v,v_{\Gamma })\in {\fancyscript{H}}_{\Omega }\\&{\mathbf {f}}(t) := \bigl ( \varphi _{Q}(t) - (\varphi _{Q}(t))^\Omega , \varphi _{\Sigma }(t) \bigr )\quad \hbox {for a.a. }t\in (0,T)\\&{\mathbf {z}}_{T}:= \bigl ( \varphi _{\Omega }- (\varphi _{\Omega })^{\Omega }, \varphi _{\Gamma }\bigr ) \,. \end{aligned}$$

The choices of \({\fancyscript{A}}_{0}\) and \({\fancyscript{B}}\) being clear, the other ones exactly yield what we need, i.e.,

$$\begin{aligned}&\bigl ( \Lambda (t) (u,u_{\Gamma }) , (v,v_{\Gamma }) \bigr )_{{\fancyscript{H}}_{\Omega }}= \int _{\Omega }\lambda (t) \, uv+ \int _{\Gamma }\lambda _\Gamma (t) \, u_{\Gamma }v_{\Gamma }\\&\quad \hbox {for a.a. }t\in (0,T)\text { and }(u,u_{\Gamma }),\,(v,v_{\Gamma })\in {\fancyscript{H}}_{\Omega }\\&_{{\fancyscript{V}}_{\Omega }^{*}} \left\langle {\mathbf {f}}(t),(v,v_{\Gamma })\right\rangle _{{\fancyscript{V}}_{\Omega }}= \int _{\Omega }\varphi _{Q}(t) v + \int _{\Gamma }\varphi _{\Sigma }(t) v_{\Gamma }\\&\quad \hbox {for a.a. }t\in (0,T)\text { and }(v,v_{\Gamma })\in {\fancyscript{V}}_{\Omega }\\&\bigl ( {\mathbf {z}}_{T}, (v,v_{\Gamma }) \bigr )_{{\fancyscript{H}}_{\Omega }}= \int _{\Omega }\varphi _{\Omega }v + \int _{\Gamma }\varphi _{\Gamma }v_{\Gamma }\quad \text {for }(v,v_{\Gamma })\in {\fancyscript{H}}_{\Omega }\,. \end{aligned}$$

Furthermore, the conditions we have required on the operators are fulfilled. Indeed,

$$\begin{aligned} \left\| \lambda (t) v - (\lambda (t) v)^\Omega \right\| _H+ \left\| \lambda _\Gamma (t) v_{\Gamma } \right\| _{H_{\Gamma }}\le c \bigl ( \left\| v \right\| _H + \left\| v_{\Gamma } \right\| _{H_{\Gamma }}\bigr ) \end{aligned}$$

\(\hbox {for a.a. }t\in (0,T)\) and every \((v,v_{\Gamma })\in {\fancyscript{H}}_{\Omega }\), since the functions \(\lambda \) and \(\lambda _\Gamma \) are bounded (see (5.4)). Moreover, \({\fancyscript{B}}\) is symmetric and coercive since \({\fancyscript{N}}\) is symmetric and positive (see, in particular, (2.58)). Finally, by accounting for (2.27), (5.5)–(5.6), (2.50), we see that \({\mathbf {f}}\in L^{2}(0,T;{\fancyscript{H}}_{\Omega })\) and \({\mathbf {q}}(T)=(0,0)\). Therefore, problem (5.12)–(5.13) has a unique solution satisfying

$$\begin{aligned} (q,q_{\Gamma }) \in H^{1}(0,T;{\fancyscript{H}}_{\Omega }) \cap L^{2}(0,T;{\fancyscript{V}}_{\Omega })\quad \hbox {and}\quad {\fancyscript{R}}_{\Omega }(q,q_{\Gamma }) \in L^{2}(0,T;{\fancyscript{H}}_{\Omega }), \end{aligned}$$

the last one by comparison in (5.25). Then, Lemma 5.5 ensures that \(q(t)\in H^{2}(\Omega )\) and \(q_{\Gamma }(t)\in H^{2}(\Gamma )\) \(\hbox {for a.a. }t\in (0,T)\) and that the estimate

$$\begin{aligned} \left\| q(t) \right\| _{H^{2}(\Omega )} + \left\| q_{\Gamma }(t) \right\| _{H^{2}(\Gamma )}\le c \left\| {\fancyscript{R}}_{\Omega }(q(t),q_{\Gamma }(t)) \right\| _{{\fancyscript{H}}_{\Omega }} \end{aligned}$$

holds true \(\hbox {for a.a. }t\in (0,T)\). This implies \(q\in L^{2}(0,T;H^{2}(\Omega ))\) and \(q_{\Gamma }\in L^2 (0,T; H^2(\Gamma ))\), and the proof is complete. \(\square \)

Remark 5.6

Assumption (2.50) can be avoided provided that we require less regularity from the solution to the adjoint problem. More precisely, we keep the regularity related to the variational structure of (2.47)–(2.49), e.g., we ask for \(q\in H^{1}(0,T;V^{*}) \cap L^{2}(0,T;V)\), while we replace \(L^2\) summability by weighted \(L^2\) summability where spaces of smooth functions on \(\Omega \) are involved, e.g., \(q\in L^{2}(0,T;H^2(\Omega ))\). Namely, we require that

$$\begin{aligned}&\text {the functions} \quad t\mapsto (T-t)^{1/2}q(t)\quad \hbox {and}\quad t\mapsto (T-t)^{1/2}\partial _{t}q(t)\\&\text {belong to }L^{2}(0,T;H^{2}(\Omega ))\text { and to }L^{2}(0,T;H),\text { respectively} \end{aligned}$$

and we analogously deal with the other conditions. By doing that, the equivalence stated in Theorem 5.4 still holds. On the other hand, the derivative \({\mathbf {q}}'\) of the solution \({\mathbf {q}}\) to the abstract problem satisfies the right weighted summability that yields the new requirements without assuming that \({\mathbf {q}}(T)\in {\fancyscript{V}}_{\Omega }\), so that (2.50) is not needed. For the reader’s convenience, we sketch the formal a priori estimate that yields the mentioned property of \({\mathbf {q}}'\) whenever it is replaced by a rigorous argument. For convenience, we set

$$\begin{aligned} u(t):={\mathbf {q}}(T-t), \quad \mu (t) := \Lambda (T-t)\quad \hbox {and}\quad g(t) := {\mathbf {f}}(T-t) \end{aligned}$$

and write (5.25) as a forward Cauchy problem for \(u\). Then, we formally test the new equation by \(tu'(t)\) and integrate with respect to time. We simply write \((\,\cdot \,,\,\cdot \,)\) for both the duality pairing between \({\fancyscript{V}}_{\Omega }^{*}\) and \({\fancyscript{V}}_{\Omega }\) and for the scalar product in \({\fancyscript{H}}_{\Omega }\). We have, for every \(t\in [0,T]\),

$$\begin{aligned} \int _{0}^{t}\bigl ( {\fancyscript{B}}u'(s) , s u'(s) \bigr ) \, ds+ \int _{0}^{t}\bigl ({\fancyscript{A}}_{0}u(s) , s u'(s) \bigr ) \, ds= \int _{0}^{t}\bigl ( g(s) - \mu (s) u(s), s u'(s) \bigr ) \, ds \,. \end{aligned}$$

As \({\fancyscript{A}}_{0}\) is symmetric and both \({\fancyscript{A}}_{0}\) and \({\fancyscript{B}}\) are coercive, we can estimate the left-hand side from below as follows

$$\begin{aligned}&\int _{0}^{t}\bigl ( {\fancyscript{B}}u'(s) , s u'(s) \bigr ) \, ds+ \int _{0}^{t}\bigl ( {\fancyscript{A}}_{0}u(s) , s u'(s) \bigr ) \, ds\\&\!=\! \int _{0}^{t}s \bigl ( {\fancyscript{B}}u'(s) , u'(s) \bigr ) \, ds\!+\! \frac{1}{2} \int _{0}^{t}\frac{d}{ds} \, \!\bigl \{ s \bigr ( {\fancyscript{A}}_{0}u(s), u(s) \bigr ) \bigr \} \, ds\!-\! \frac{1}{2} \!\int _{0}^{t}\bigl ( {\fancyscript{A}}_{0}u(s) , u(s) \bigr ) \, ds\\&\ge \alpha \int _{0}^{t}s \left\| u'(s) \right\| _{{\fancyscript{H}}_{\Omega }}^2 \, ds+ \frac{\alpha }{2} \, t \left\| u(t) \right\| _{{\fancyscript{V}}_{\Omega }}^2- c \int _{0}^{T}\left\| u(s) \right\| _{{\fancyscript{V}}_{\Omega }}^2 \, ds \,. \end{aligned}$$

On the other hand, as \(\left\| \mu (t) \right\| _{{\fancyscript{L}}({\fancyscript{H}}_{\Omega },{\fancyscript{H}}_{\Omega })}\le M\) \(\hbox {for a.a. }t\in (0,T)\), we also have

$$\begin{aligned}&\int _{0}^{t}\bigl ( g(s) - \mu (s) u(s) , s u'(s) \bigr ) \, ds\\&\quad \le \frac{\alpha }{2} \int _{0}^{t}s \left\| u'(s) \right\| _{{\fancyscript{H}}_{\Omega }}^2 \, ds+ c \int _{0}^{T}s \left\| g(s) \right\| _{{\fancyscript{H}}_{\Omega }}^2 \, ds+ c \int _{0}^{T}s \left\| u(s) \right\| _{{\fancyscript{H}}_{\Omega }}^2 \, ds \,. \end{aligned}$$

By combining we infer that

$$\begin{aligned}&\int _{0}^{t}s \left\| u'(s) \right\| _{{\fancyscript{H}}_{\Omega }}^2 \, ds+ t \left\| u(t) \right\| _{{\fancyscript{V}}_{\Omega }}^2\le c \bigl ( \left\| g \right\| _{L^{2}(0,T;{\fancyscript{H}}_{\Omega })}^2 + \left\| u \right\| _{L^{2}(0,T;{\fancyscript{V}}_{\Omega })}^2 \bigr )\\&\quad \text {for every }t\in [0,T]. \end{aligned}$$

As the last norm of \(u\) is supposed to be already estimated, we obtain the desired weighted summability for \(u'\) as well as a weighted boundedness for \(u\) in \({\fancyscript{V}}_{\Omega }\), as a by-product.

6 Necessary Optimality Conditions

In this section, we derive the optimality condition (2.51) stated in Theorem 2.6. We start from (2.36) and first prove (2.42). We recall the definitions (2.32)–(2.34) of the spaces \({\fancyscript{X}}\) and \({\fancyscript{Y}}\) and of the control-to-state mapping \({\fancyscript{S}}\).

Proposition 6.1

Let \(\overline{u}_{\Gamma }\) be an optimal control and \((\overline{y},\overline{y}_{\Gamma }):={\fancyscript{S}}(\overline{u}_{\Gamma })\). Then, (2.42) holds.

Proof

This is just due to the chain rule for Fréchet derivatives, as already said in Sect. 2, and we just provide some detail. Let \(\tilde{\fancyscript{S}}:{\fancyscript{U}}\rightarrow {\fancyscript{Y}}\times {\fancyscript{X}}\) be given by \(\tilde{\fancyscript{S}}(u_{\Gamma }):=({\fancyscript{S}}(u_{\Gamma }),u_{\Gamma })\). Then, \(\tilde{\fancyscript{S}}\) is Fréchet differentiable at any \(u_{\Gamma }\in {\fancyscript{U}}\) since \({\fancyscript{S}}\) is so. Precisely, thanks to Theorem 4.2, the Fréchet derivative \(D\tilde{\fancyscript{S}}(u_{\Gamma })\) acts as follows

where \((\xi ,\xi _{\Gamma },\eta )\) is the solution to the linearized problem (2.38)–(2.40) corresponding to \(h_{\Gamma }\). On the other hand, if we see the cost functional (2.28) as a map from \({\fancyscript{Y}}\times {\fancyscript{X}}\) to \({\mathbb {R}}\), it is clear that its Fréchet derivative at \((y,y_{\Gamma },u_{\Gamma })\in {\fancyscript{Y}}\times {\fancyscript{X}}\) at \((y,y_{\Gamma },u_{\Gamma })\in {\fancyscript{Y}}\times {\fancyscript{X}}\) is given by

$$\begin{aligned}&[D\fancyscript{J}(y,y_{\Gamma },u_{\Gamma })](k,k_\Gamma ,h_{\Gamma })= b_{Q}\int _{Q}(y-z_{Q}) k+ b_{\Sigma }\int _{\Sigma }(y_{\Gamma }-z_{\Sigma }) k_\Gamma \\&\quad {}+ b_{\Omega }\int _{\Omega }(y(T)-z_{\Omega }) k(T)+ b_{\Gamma }\int _{\Gamma }(y(T)-z_{\Gamma }) k_\Gamma (T)+ b_{0}\int _{\Sigma }u_{\Gamma }h_{\Gamma }\\&\hbox {for }(k,k_\Gamma )\in {\fancyscript{Y}}\hbox { and }h_{\Gamma }\in {\fancyscript{X}}. \end{aligned}$$

Therefore, being \(\widetilde{\fancyscript{J}}=\fancyscript{J}\circ \tilde{\fancyscript{S}}\), the chain rule implies that maps any \(h_{\Gamma }\in {\fancyscript{X}}\) into

$$\begin{aligned}&[D\widetilde{\fancyscript{J}}(u_{\Gamma })](h_{\Gamma })= [D\fancyscript{J}(\tilde{\fancyscript{S}}(u_{\Gamma })] \bigl ( [D\tilde{\fancyscript{S}}(u_{\Gamma })] (h_{\Gamma }) \bigr )\\&= [D\fancyscript{J}(\tilde{\fancyscript{S}}(u_{\Gamma })] (\xi ,\xi _{\Gamma },h_{\Gamma })= [D\fancyscript{J}(y,y_{\Gamma },u_{\Gamma })] (\xi ,\xi _{\Gamma },h_{\Gamma })\\&= b_{Q}\int _{Q}(y-z_{Q}) \xi + b_{\Sigma }\int _{\Sigma }(y_{\Gamma }-z_{\Sigma }) \xi _{\Gamma }\\&\quad {}+ b_{\Omega }\int _{\Omega }(y(T)-z_{\Omega }) \xi (T)+ b_{\Gamma }\int _{\Gamma }(y(T)-z_{\Gamma }) \xi _{\Gamma }(T)+ b_{0}\int _{\Sigma }u_{\Gamma }h_{\Gamma }\end{aligned}$$

where \((y,y_{\Gamma })={\fancyscript{S}}(u_{\Gamma })\) and \((\xi ,\xi _{\Gamma })\) has the same meaning as before. Therefore, (2.42) immediately follows from (2.36). \(\square \)

At this point, we are ready to prove Theorem 2.6 on optimality, i.e., the necessary condition (2.51) for \(\overline{u}_{\Gamma }\) to be an optimal control in terms of the solution \((p,q,q_{\Gamma })\) of the adjoint problem (2.47)–(2.49). We note that it is sufficient to prove the following: if \(u_{\Gamma }\in {\fancyscript{U}}\), \((y,y_{\Gamma })={\fancyscript{S}}(u_{\Gamma })\), \(h_{\Gamma }\in {\fancyscript{X}}\), \((\xi ,\xi _{\Gamma },\eta )\) is the solution to the linearized problem (2.38)–(2.40) corresponding to \(h_{\Gamma }\), and \((p,q,q_{\Gamma })\) solves the adjoint problem (2.47)–(2.49) (where one reads \((y,y_{\Gamma })\) in place of \((\overline{y},\overline{y}_{\Gamma })\)), then

$$\begin{aligned}&\displaystyle \int _{\Sigma }q_{\Gamma }h_{\Gamma }= \int _{Q}b_{Q}(y - z_{Q}) \xi + \int _{\Sigma }b_{\Sigma }(y_{\Gamma }- z_{\Sigma }) \xi _{\Gamma }\nonumber \\&\qquad \qquad \qquad + \int _{\Omega }b_{\Omega }(y(T) - z_{\Omega }) \xi (T)+ \int _{\Gamma }b_{\Gamma }(y_{\Gamma }(T) - z_{\Gamma }) \xi _{\Gamma }(T) \,. \end{aligned}$$
(6.1)

Indeed, once this is proved, we can apply it to any optimal control \(u_{\Gamma }:=\overline{u}_{\Gamma }\), and (2.51) follows from the necessary condition (2.42) already established in Proposition 6.1. So, we fix \(u_{\Gamma }\in {\fancyscript{U}}\) and \(h_{\Gamma }\in {\fancyscript{X}}\), and write both the linearized problem and the adjoint problem we are interested in, for the reader’s convenience. All the variational equations hold \(\hbox {for a.a. }t\in (0,T)\), but we avoid writing the time \(t\), for brevity. We have

$$\begin{aligned}&\int _{\Omega }\partial _{t}\xi \, v+ \int _{\Omega }\nabla \eta \cdot \nabla v = 0\end{aligned}$$
(6.2)
$$\begin{aligned}&\int _{\Omega }q \, v= \int _{\Omega }\nabla p \cdot \nabla v\end{aligned}$$
(6.3)
$$\begin{aligned}&\int _{\Omega }\eta v= \int _{\Omega }\partial _{t}\xi \, v+ \int _{\Gamma }\partial _{t}\xi _{\Gamma }\, v+ \int _{\Omega }\nabla \xi \cdot \nabla v+ \int _{\Gamma }\nabla _{\Gamma }\xi _{\Gamma }\cdot \nabla _{\Gamma }v_{\Gamma }\qquad \nonumber \\&\qquad \qquad \quad + \int _{\Omega }\lambda \, \xi \, v+ \int _{\Gamma }\bigl ( \lambda _\Gamma \, \xi _{\Gamma }- h_{\Gamma }\bigr ) \, v_{\Gamma }\end{aligned}$$
(6.4)
$$\begin{aligned}&\qquad \qquad \quad {- \int _{\Omega }\partial _{t}\bigl ( p + q \bigr ) \, v+ \int _{\Omega }\nabla q \cdot \nabla v+ \int _{\Omega }\lambda \, q \, v }\nonumber \\&\qquad \qquad \quad - \int _{\Gamma }\partial _{t}q_{\Gamma }\, v_{\Gamma }+ \int _{\Gamma }\nabla _{\Gamma }q_{\Gamma }\cdot \nabla _{\Gamma }v_{\Gamma }+ \int _{\Gamma }\lambda _\Gamma \, q_{\Gamma }\, v_{\Gamma }\qquad \nonumber \\&\qquad \quad = \int _{\Omega }b_{Q}\bigl ( y - z_{Q}\bigr ) v+ \int _{\Gamma }b_{\Sigma }\bigl ( y_{\Gamma }- z_{\Sigma }\bigr ) v_{\Gamma }\,. \end{aligned}$$
(6.5)

In the above equations, \(\lambda :=f''(y)\) and \(\lambda _\Gamma :=f_{\Gamma }''(y_{\Gamma })\). Moreover, (6.2)–(6.3) hold for every \(v\in V\), while (6.4)–(6.5) are satisfied for every \((v,v_{\Gamma })\in {\fancyscript{V}}\). Furthermore, \(\xi (0)=0\) and

$$\begin{aligned} \int _{\Omega }(p+q)(T) \, v+ \int _{\Gamma }q_{\Gamma }(T) \, v_{\Gamma }= \int _{\Omega }b_{\Omega }\bigl ( y(T) - z_{\Omega }\bigr ) v+ \int _{\Gamma }b_{\Gamma }\bigl ( y_{\Gamma }(T) - z_{\Gamma }\bigr ) v_{\Gamma } \end{aligned}$$
(6.6)

for every \((v,v_{\Gamma })\in {\fancyscript{V}}\). We choose \(v=p\) in (6.2), \(v=\eta \) in (6.3), \((v,v_{\Gamma })=(q,q_{\Gamma })\) in (6.4) and \((v,v_{\Gamma })=-(\xi ,\xi _{\Gamma })\) in (6.5). Then, by integrating over \((0,T)\) all the equalities we obtain, we have

$$\begin{aligned}&\int _{Q}\partial _{t}\xi \, p+ \int _{Q}\nabla \eta \cdot \nabla p = 0\\&\int _{Q}q \, \eta = \int _{Q}\nabla p \cdot \nabla \eta \\&\int _{Q}\partial _{t}\xi \, q+ \int _{\Sigma }\partial _{t}\xi _{\Gamma }\, q_{\Gamma }+ \int _{Q}\nabla \xi \cdot \nabla q+ \int _{\Sigma }\nabla _{\Gamma }\xi _{\Gamma }\cdot \nabla _{\Gamma }q_{\Gamma }\qquad \\&\quad + \int _{Q}\lambda \, \xi \, q+ \int _{\Sigma }\bigl ( \lambda _\Gamma \, \xi _{\Gamma }- h_{\Gamma }\bigr ) \, q_{\Gamma }= \int _{Q}\eta q\\&\int _{Q}\partial _{t}\bigl ( p + q \bigr ) \, \xi - \int _{Q}\nabla q \cdot \nabla \xi - \int _{Q}\lambda \, q \, \xi \\&\quad + \int _{\Sigma }\partial _{t}q_{\Gamma }\, \xi _{\Gamma }- \int _{\Sigma }\nabla _{\Gamma }q_{\Gamma }\cdot \nabla _{\Gamma }\xi _{\Gamma }- \int _{\Sigma }\lambda _\Gamma \, q_{\Gamma }\, \xi _{\Gamma }\\&\quad = - \int _{Q}b_{Q}\bigl ( y - z_{Q}\bigr ) \xi - \int _{\Sigma }b_{\Sigma }\bigl ( y_{\Gamma }- z_{\Sigma }\bigr ) \xi _{\Gamma }\,. \end{aligned}$$

At this point, we add the above equalities to each other and just simplify. We obtain

$$\begin{aligned}&\int _{Q}\partial _{t}\xi \, (p+q)+ \int _{Q}\partial _{t}\bigl ( p + q \bigr ) \, \xi + \int _{\Sigma }\partial _{t}\xi _{\Gamma }\, q_{\Gamma }+ \int _{\Sigma }\partial _{t}q_{\Gamma }\, \xi _{\Gamma }- \int _{\Sigma }h_{\Gamma }\, q_{\Gamma }\\&\quad = - \int _{Q}b_{Q}\bigl ( y - z_{Q}\bigr ) \xi - \int _{\Sigma }b_{\Sigma }\bigl ( y_{\Gamma }- z_{\Sigma }\bigr ) \xi _{\Gamma }\,. \end{aligned}$$

By accounting for the Cauchy condition \(\xi (0)=0\), we can write an equivalent form as follows

$$\begin{aligned}&\int _{\Omega }(p+q)(T) \, \xi (T)+ \int _{\Gamma }q_{\Gamma }(T) \, \xi _{\Gamma }(T)\\&\quad = \int _{\Sigma }h_{\Gamma }\, q_{\Gamma }- \int _{Q}b_{Q}\bigl ( y - z_{Q}\bigr ) \xi - \int _{\Sigma }b_{\Sigma }\bigl ( y_{\Gamma }- z_{\Sigma }\bigr ) \xi _{\Gamma }\,. \end{aligned}$$

At this point, we choose \((v,v_{\Gamma })=(\xi (T),\xi _{\Gamma }(T))\) in (6.6) and get

$$\begin{aligned}&\int _{\Omega }(p+q)(T) \, \xi (T)+ \int _{\Gamma }q_{\Gamma }(T) \, \xi _{\Gamma }(T)\\&\quad = \int _{\Omega }b_{\Omega }\bigl ( y(T) - z_{\Omega }\bigr ) \xi (T)+ \int _{\Gamma }b_{\Gamma }\bigl ( y_{\Gamma }(T) - z_{\Gamma }\bigr ) \xi _{\Gamma }(T).\\ \end{aligned}$$

By comparison, we conclude that (6.1) holds. This completes the proof of Theorem 2.6. \(\square \)