Following my previous question and its answer, after some reading of the advised books, I'm still confused about how to get the derivative of the functional to find the best parameter of my reaction diffusion problem.

In short, I need to find the best (time independent, space dependent) parameters $D$ and $k$ which minimize the functional

$$ \mathcal{G}(u,D,k) = \int_{\Omega} (u(t=T_f)-u_f)^2 d\Omega + \int_{\Omega} (u(t=0)-u_i)^2 d\Omega + \frac{1}{2}\int_{\Omega} D^2 d\Omega + \frac{1}{2}\int_{\Omega} k^2 d\Omega $$

subject to $$ \partial_t{u} - \nabla \cdot (D\nabla{u}) - k u (1-u) = 0 $$ $$ u(t=0,x)=u_i \space \forall x$$ $$ u(t,x)=0 \space \forall x \in \Gamma $$ where $\Gamma$ is the border of $\Omega$

Using the adjoint method, I define the Lagrangian $\cal L$ as

$$ \mathcal{L} = \mathcal{G} - \int_t\int_\Omega{\lambda( \partial_t{u} - \nabla \cdot (D\nabla{u}) - k u (1-u)) d\Omega.dt }$$

So for exemple, in order to find the optimal equations according to the parameter $D$, my understanding is that I need to specify that $$ \frac{\mathcal{L}(u,D+\epsilon\tilde D,k) - \mathcal{L}(u,D,k)}{\epsilon}=0 \space\space \forall{\tilde D} $$

which gives me (considering $u$, $D$, $k$ and $\lambda$ as independent variables) $$ \int_\Omega{D \tilde D d\Omega} + \int_t\int_\Omega{\lambda \nabla \cdot (\tilde D \nabla u) d\Omega dt} = 0 \space \forall {\tilde D}$$

Using integration by parts, I get

$$ \int_\Omega{D \tilde D} d\Omega + \int_t\int_\Omega{\nabla (\lambda\tilde D\nabla u) d\Omega dt} - \int_t\int_\Omega{\tilde D\nabla u \nabla\lambda d\Omega dt }= 0 \space \forall {\tilde D}$$

and using the divergence theorem,

$$ \int_\Omega{D \tilde D} d\Omega + \int_t\oint_\Gamma{(\lambda\tilde D\nabla u) {\vec n} d\Gamma dt} - \int_t\int_\Omega{\tilde D \nabla u \nabla\lambda d\Omega dt }= 0 \space \forall {\tilde D}$$ the goal of these transformation being to factorize the expression with $\tilde D$ in order to get a relation between $D$, $k$, $\lambda$, $u$ and their derivatives.

However, with such an expression, while the $\tilde D$ is indeed factorized, the domains of each part of the equation are different (the first is time independent, the second is a surface integral and the third is volumetric), so I can't merge them together to get a unique equation like

$$ D + \lambda\nabla u - \nabla u\nabla\lambda =0 $$

I can eventually require each part to be 0 at the same time, but then

$$ \int_\Omega{D \tilde D} d\Omega= 0 \space \forall {\tilde D}$$

leads just to $D=0$ which is obviously wrong...

Any help would be very welcome...

  • $\begingroup$ what about the initial and boundary conditions for the primal PDE? you should first formulate your primal problem in full, then derive a well-posed adjoint problem (including space/time boundary terms) to make sure the cost function and the primal problem are compatible. once that is settled, move on to the derivation of the optimality (gradient) equations (for $k$ and $D$). $\endgroup$
    – GoHokies
    Dec 17, 2017 at 16:03
  • $\begingroup$ actually, the I.C. and B.C are simply, $u(t=0,x)=u_i$ and $u(x,t)=0 \forall x\in \Gamma$. So I can introduce these two conditions in the lagrangian by adding two more terms (and two more adjoint variables), but then I think the derivative $\partial_D{L}$ should be the same no ? Therefore I choosed not to specify it in my text in order to simplify my explanation. Do you mean that this is somehow related to my difficulties ? Is my problem due to incompatibility of my state equation with the cost function ? $\endgroup$
    – david guez
    Dec 17, 2017 at 17:04
  • 1
    $\begingroup$ there's no need for separate Lagrange multipliers (adjoint variables) for the boundary / initial conditions on the primal model, unless the latter are meant to be satisfied in some weak sense and/or depend on the parameters themselves. there shouldn't be any dual compatibility issues in your case. were you successful in deriving the complete adjoint problem? $\endgroup$
    – GoHokies
    Dec 19, 2017 at 18:35
  • $\begingroup$ No, to be honest I'm completely lost... if I don't need to add Lagrange multiplier for the B.C. and I.C, I don't catch where is the problem with my initial formulation (def of $\mathcal G$ in my question). Eventually adding a term to enforce the I.C. (I mean, adding $\int_{\Omega}(u(t=0)-u_i)^2$ to $\mathcal G$. But still, this doesn't add any explicit dependence on D, and therefore, I still calculate the derivative $\partial \mathcal L / \partial D$ as in my question, which I guess is wrong, just don't know why... $\endgroup$
    – david guez
    Dec 19, 2017 at 20:11
  • 1
    $\begingroup$ @davidguez, if you add a @ before the handle of a person that person would be notified $\endgroup$
    – nicoguaro
    Dec 19, 2017 at 21:22

1 Answer 1


You want to solve

$$ \arg \min_{D(x),k(x)} \mathcal{G}(u;D,k) := \frac{1}{2} \int_{\Omega} \left(u(t=T) - {\bar{u}}(T) \right)^2 d\Omega + \frac{1}{2}\int_{\Omega} D^2 d\Omega + \frac{1}{2}\int_{\Omega} k^2 d\Omega $$

subject to

\begin{align} \frac{\partial u}{\partial t} - \nabla \cdot (D \nabla{u}) - k u (1-u) &= 0 & \space \mathrm{on} \space \Omega \\ u(0,x) &= u_0 & \space \forall x \in \Omega \\ u(t,x) &= 0 & \space \forall x \in \Gamma := \partial \Omega. \end{align}

Let's define an inner product on $[0,T] \times \Omega$: $$ \left< v , w \right>_{[0,T] \times \Omega} := \int_{0}^{T} \int_\Omega v \space w \mathrm{d}\Omega \mathrm{d}t.$$

With this, the Lagrangian for the constrained problem reads $$ \mathcal{L}(u;\lambda;D,k) = \mathcal{G}(u;D,k) - \left< \lambda , \frac{\partial u}{\partial t} - \nabla \cdot (D \nabla{u}) - k u (1-u) \right>_{[0,T] \times \Omega} $$

We're now ready to write out the first order necessary conditions for a local minimum (the KKT system):

  1. The primal equation ${\cal L}_\lambda (u; \lambda; D,k)(\delta \lambda) = 0 \space \forall \space \delta \lambda$. This is nothing other than the "forward" PDE constraint.

  2. The adjoint (or dual) equation:

    $${\cal L}_u (u; \lambda; D,k)(\delta u) = 0 \space \forall \space \delta u. $$

  3. The gradient equations (the derivatives with respect to the control parameters $D$ and $k$):

\begin{align} {\cal L}_D (u; \lambda; D,k)(\delta D) &= 0 \space \forall \space \delta D \\ {\cal L}_k (u; \lambda; D,k)(\delta k) &= 0 \space \forall \space \delta k. \end{align}

Let's take the left-hand side of the adjoint equation:

\begin{align} {\cal L}_u (u; \lambda; D,k)(\delta u) &= \left( u(T,x) - {\bar{u}}(T,x) \right) \delta u(T,x) \\ & \underbrace{ - \int_{0}^{T} \int_\Omega \lambda \frac{\partial \delta u}{\partial t} \mathrm{d}\Omega \mathrm{d}t }_{\mathbf{A}} \space \underbrace{ + \int_{0}^{T} \int_\Omega \lambda \nabla \cdot (D \nabla u) \mathrm{d}\Omega \mathrm{d}t }_{\mathbf{B}} \space \underbrace{ + \int_{0}^{T} \int_\Omega \lambda k u (1-u) \mathrm{d}\Omega \mathrm{d}t }_{\mathbf{C}}. \end{align}

and look at each of the three integral terms in turn.

Integrating ($\mathbf{A}$) by parts, we get: $$ \mathbf{A} = - \int_\Omega \left. \left( \lambda \delta u \right) \right|_0^T \mathrm{d}\Omega + \int_{0}^{T} \int_\Omega \delta u \frac{\partial \lambda}{\partial t} \mathrm{d}\Omega \mathrm{d}t. $$

Similary for the second term, Green's second identity gives us $$ \require{cancel} \mathbf{B} = \int_{0}^{T} \int_\Gamma \lambda D (\nabla \delta u \cdot \vec{n}) \mathrm{d}\Gamma \mathrm{d}t - \cancelto{𝟶}{ \int_{0}^{T} \int_\Gamma \delta u D (\nabla \lambda \cdot \vec{n}) \mathrm{d}\Gamma \mathrm{d}t } + \int_{0}^{T} \int_\Omega \delta u \nabla \cdot (D \nabla \lambda) \mathrm{d}\Omega \mathrm{d}t, $$ where the second term vanishes because $\delta u(t,x) = 0$ on $\Gamma$.

Putting all the terms together, and requiring that all terms vanish for all $\delta u$, we arrive at the following adjoint problem:

\begin{align} \frac{\partial \lambda}{\partial t} + \nabla \cdot (D \nabla \lambda) + k(1-2u) & = 0 & \mathrm{on} \space \Omega \\ \lambda(T,x) &= u(T,x) - \bar{u}(T,x) & \forall x \in \Omega \\ \lambda(t,x) &= 0 & \forall x \in \Gamma, \space \forall t. \end{align}

Finally, on to the gradient equations. For $D$, this reads: $$ \int_\Omega D \delta D \mathrm{d}\Omega - \int_{0}^{T} \int_\Omega \lambda \nabla \cdot (\delta D \nabla u) \mathrm{d}\Omega \mathrm{d}t = 0, \space \forall \delta D. $$

Again, the integration by parts formula comes in handy here. After some algebra, this is what we're left with: $$ \int_\Omega \delta D D \mathrm{d}\Omega + \int_0^T \int_\Omega \delta D \left( \nabla u \cdot \nabla \lambda \right) = 0 \space \forall \space \delta D, $$

from which the equation for $D$ immediately follows:

$$ D(x) = \int_0^T \nabla u(x,t) \cdot \nabla \lambda(x,t)\mathrm{d}t. $$

The "correct" way to interpret this equation depends on the particular choice of function spaces for $u$, $\lambda$ and $D$. See this post for an example of why this is really important.

I'll let you derive a similar equation for $k$.

  • $\begingroup$ this whole derivation is rather informal - that is to say, you will have to define appropriate function spaces where the $u$, $D$, $k$ (and their boundary traces, etc.) "live", and make sure the procedure is mathematically rigorous. $\endgroup$
    – GoHokies
    Dec 22, 2017 at 10:33
  • 1
    $\begingroup$ I'm so thankful for the time you're spending to help me!!! Now (at least I feel) that's crystal clear... just had to integral the "D" part over time which I didn't even think to do :-( I really appreciate your help, really. $\endgroup$
    – david guez
    Dec 22, 2017 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.