[petsc-users] PETSC for singular system
Stefano Zampini
stefano.zampini at gmail.com
Mon Jan 14 07:31:04 CST 2019
If you want to use factorizations, then you have to make sure that you
preallocate at least one entry (the diagonal one) for each empty row, and
put a one there. The solution will be equivalent (modulo nullspace)
Il giorno lun 14 gen 2019 alle ore 16:27 Matthew Knepley via petsc-users <
petsc-users at mcs.anl.gov> ha scritto:
> On Mon, Jan 14, 2019 at 7:55 AM Yaxiong Chen <chen2018 at purdue.edu> wrote:
>
>> So must I figure out the index of the zero columns and row to get the
>> null space first, And then I remove it to generator Cholesky or LU
>> preconditionor?Is this case, should the nontrivial null space be (1,0,0,0)?
>>
>
> No
>
> 1) If you have a consistent rhs, then CG works as is. However, you should
> put it in in case your preconditioner introduces nullspace components.
>
> 2) Factorization will NEVER work on singular systems, unless you use SVD,
> which is only for very small systems.
>
> Thanks,
>
> Matt
>
>
>> Thanks
>> Get Outlook for iOS <https://aka.ms/o0ukef>
>> _____________________________
>> From: Matthew Knepley <knepley at gmail.com>
>> Sent: Monday, January 14, 2019 2:00 AM
>> Subject: Re: [petsc-users] PETSC for singular system
>> To: Yaxiong Chen <chen2018 at purdue.edu>, PETSc <petsc-maint at mcs.anl.gov>
>>
>>
>> On Sun, Jan 13, 2019 at 6:59 PM Yaxiong Chen <chen2018 at purdue.edu> wrote:
>>
>>> Hello Matthew,
>>>
>>>
>>> Does this mean in PETSC , CG is not suitable for semi positive definite
>>> system?
>>>
>>
>> No, it means factorization is not. CG is fine.
>>
>> Matt
>>
>>
>>> My system is equivalent to a SPD system with arbitrary extra rows and
>>> columns of zeros. I expect the same iteration process will lead to xT=(0,1,1,1)
>>> with initial guess 0, since the rows of 0 will not influence the
>>> corresponding solution. Is this possible to be realized with CG in PETSC?
>>>
>>>
>>> Thanks
>>>
>>>
>>> Yaxiong Chen,
>>>
>>> Ph.D. Student
>>>
>>> School of Mechanical Engineering, 3171
>>>
>>> 585 Purdue Mall
>>>
>>> West Lafayette, IN 47907
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------
>>> *From:* Matthew Knepley <knepley at gmail.com>
>>> *Sent:* Friday, January 11, 2019 2:30 PM
>>> *To:* Yaxiong Chen
>>> *Cc:* PETSc
>>> *Subject:* Re: [petsc-users] PETSC for singular system
>>>
>>> On Fri, Jan 11, 2019 at 10:04 AM Yaxiong Chen via petsc-users <
>>> petsc-users at mcs.anl.gov> wrote:
>>>
>>> Hello,
>>>
>>>
>>> I am trying to use PETSC to solve a singular system like the following.
>>>
>>> .
>>>
>>> This equals inserting rows and columns at arbitrary place(Actually I
>>> even don't know whether it is singular or not. Sometimes some degree of
>>> freedom x_i may not participate in the global matrix)
>>>
>>>
>>> I searched some discussion online and tried to remove the nullspace with
>>> the following code:
>>>
>>> call KSPCreate(PETSC_COMM_WORLD,ksp,ierr)
>>> call KSPSetOperators(ksp,Amat,Amat,ierr)
>>> call KSPSetFromOptions(ksp,ierr)
>>> call KSPSetType(ksp, KSPCG,ierr)
>>> call MatNullSpaceCreate( PETSC_COMM_WORLD, PETSC_TRUE, 0,
>>> dummyVecs, nullspace, ierr)
>>> call MatSetNullSpace(Amat,nullspace,ierr)
>>> call MatNullSpaceDestroy(nullspace,ierr)
>>> call KSPSolve(ksp,bvec,xvec,ierr)
>>>
>>> But it still gives me some error saying Zero pivot in LU factorization.
>>> I am just wondering how MatSetNullSpace() can handle this?
>>>
>>>
>>> If you give the nullspace, the Kryloc method will work. However, you
>>> still cannot use factorization. So
>>>
>>> 1) -ksp_type gmres -pc_type jacobi will solve your system
>>>
>>> 2) -ksp_type gmres -pc_type svd will solve your system
>>>
>>> Saying anything more general than that is really not possible.
>>>
>>> Thanks,
>>>
>>> Matt
>>>
>>>
>>> Thanks
>>>
>>> Yaxiong Chen,
>>>
>>> School of Mechanical Engineering, 3171
>>>
>>> 585 Purdue Mall
>>>
>>> West Lafayette, IN 47907
>>>
>>>
>>>
>>>
>>>
>>> --
>>> 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/>
>>>
>>
>>
>> --
>> 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/>
>>
>>
>>
>
> --
> 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/>
>
--
Stefano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190114/65a0781e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 2573 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190114/65a0781e/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 3538 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190114/65a0781e/attachment-0003.png>
More information about the petsc-users
mailing list