# [petsc-users] What is the difference between these two approaches?

(Rebecca) Xuefei YUAN xy2102 at columbia.edu
Wed Feb 10 20:41:47 CST 2010

```Dear all,

FYI, a bug was found. But I am still working the analytic Jacobian for
DMComposite().

Thanks so much!

Rebecca

Quoting Jed Brown <jed at 59A2.org>:

> On Mon, 08 Feb 2010 16:13:53 -0500, "(Rebecca) Xuefei YUAN"
> <xy2102 at columbia.edu> wrote:
>> Dear all,
>>
>> I do have an PDE-constrained optimization problem:
>>
>> F1(phi(x,y),c) = L(phi(x,y)) + rho(s1(x,y),s2(x,y)) = 0 (1)
>> F2(phi(x,y),c) = int_{domain}(c*rho(s1(x,y),s2(x,y)) - 1.0)dxdy = 0 (2)
>>
>> where phi(x,y) is defined at each grid point and c is a scalar
>> parameter that satisfying the equation (2).
>
> Is c the only parameter you are optimizing?  What does your system look
> like in "minimize functional subject to PDE" form?
>
>> I have two pieces of codes to solve them by different approaches.
>>
>> The first approach is to use DMComposite() to manage unknowns and
>> solve F1&F2 at the same time, and it calls DMMGSolve() once.
>>
>> The second approach is to solve F1 with a guess c for some number(i.e.
>> 1) times of nonlinear and linear iteration, and then update c from F2.
>> Solve F1 again with updated c till some conditions satisfied, for
>> example,
>
> Perhaps the iteration has stagnated or found a different local minimum?
> Have you compared the objective functions?
>
>> d) the shortcoming of approach one is PETSc has not ready for assemble
>> a Jacobian for object DMComposite, so the second approach is able to
>> write an analytic Jacobian.
>
> Does DMCompositeGetMatrix() not work for you?
>
> Jed
>
>

--
(Rebecca) Xuefei YUAN
Department of Applied Physics and Applied Mathematics
Columbia University
Tel:917-399-8032
www.columbia.edu/~xy2102

```