[petsc-dev] About the problem of Lagrange multiplier
Barry Smith
bsmith at petsc.dev
Fri Apr 8 10:04:00 CDT 2022
How can Q be non-square? U has n entries so presumably K is n by n. Q has the same number of rows as K and from your definition of Q containing a_1 .... a_n entries per row Q has n columns. So Q is also n by n. If this is the case then it appears you have the same number of Lagrange multipliers as u so you can simply create a DMDA with twice as many degrees of freedom on each vertex, on each vertex the first half of the degrees of freedom are u and the second half lambda. Note that this means the u and lambda (and hence the matrix entries also) are interlaced between u and lambda, but this is fine; it is only a convenience for human eyes that we like to write all the u before all the lambda; any representation in the computer is fine.
Barry
> On Apr 8, 2022, at 1:34 AM, 高亚贺 <gaoyahe at buaa.edu.cn> wrote:
>
> Dear Mr./Ms.,
>
>
>
> In fact, I want to solve a discretized equation like this
>
> <1649395840117.png>
>
>
> where K, U=[u1 u2 …un]T and F are fields sit on the vertices, and can easily be created by ‘DMCreateMatrix’ or ‘DMCreateGlobalVector’. λ is the Lagrange multiplier vector. The augmented Q (non-square) is the constraint coefficient matrix and has the form as
>
> <1649395860765.png>
>
>
> The Q is employed here to satisfy the following constraints
>
> <1649395881836.png>
>
>
>
> So how to build the entire system in-place in one big matrix (Kλ)? Could you give me more specific suggestions on this problem?
>
>
>
> Thank you very much!
>
>
>
> Best regards,
>
> Yahe
>
>
>
>
> -----原始邮件-----
> 发件人:"Barry Smith" <bsmith at petsc.dev>
> 发送时间:2022-04-07 23:10:20 (星期四)
> 收件人: "Matthew Knepley" <knepley at gmail.com>
> 抄送: "高亚贺" <gaoyahe at buaa.edu.cn>, PETSc <petsc-users at mcs.anl.gov>
> 主题: Re: [petsc-users] question
>
>
> DMStag may also be useful for your needs (and far simpler to use than DMPLEX) depending on where your Lagrange multipliers live. Note that regardless you should not need to be copying entire large submatrices around into bigger matrices; you can build the entire system in-place in one big matrix. MatNest is also a possibility depending on exactly what you are doing.
>
> If you explain what your Lagrange multipliers are (the constraints) we may be able to make more specific suggestions.
>
> Barry
>
>
>
>
>> On Apr 7, 2022, at 8:26 AM, Matthew Knepley <knepley at gmail.com <mailto:knepley at gmail.com>> wrote:
>>
>> On Thu, Apr 7, 2022 at 8:16 AM 高亚贺 via petsc-users <petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>> wrote:
>>
>> Dear Mr./Ms.,
>>
>>
>>
>> I have used ‘DMCreateMatrix’ to create a matrix K, and also the ‘DMCreateGlobalVector’ to create two vectors U (to be solved) and F (right-hand side), i.e. KU=F. Now, I want to add some complex constraints to this system through lagrangian multiplier method, and the constraint matrix is Q. The KU=F transforms to
>>
>> <1649328463919.png>
>>
>> How to create Kλ, and how to effectively copy values K and Q to Kλ? Does the newly created Kλ and Fλ still have an advantage of DMDA? Or do you have any other good suggestions for this kind of problem?
>>
>>
>> DMDA can only really handle collocated discretizations, meaning all fields sit on the vertices. If you can discretize your problem this way, then just give it two fields and assemble K_\lambda as normal. If not, then you might look at DMPlex which supports a wider range of discretizations.
>>
>> Thanks,
>>
>> Matt
>>
>> Thank you very much!
>>
>>
>>
>> Best regards,
>>
>> A PETSc user
>>
>>
>>
>> --
>> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
>
> <About the problem of Lagrange multiplier.docx>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20220408/a4e8f075/attachment-0001.html>
More information about the petsc-dev
mailing list