[petsc-dev] PETSC application

David sheehan david.sheehanjr at gmail.com
Sun Mar 7 12:49:53 CST 2010


Thank you very much.

David

On Sun, Mar 7, 2010 at 12:42 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>
> http://www.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-dev/docs/manualpages/Mat/MatCreateShell.html#MatCreateShell
>
>   This allows you to create a Mat that can be passed to KSPSetOperators()
> that provides matrix-vector products (and possibly other operations) but
> does not explicitly store the nonzero entries of the matrix.  This is
> exactly what you need to use for the A.
>
>    Barry
>
>  On Mar 7, 2010, at 12:36 PM, David sheehan wrote:
>
>  Can you give me any more details about it? thanks.
>
> David
>
> On Sun, Mar 7, 2010 at 12:22 PM, Matthew Knepley <knepley at gmail.com>wrote:
>
>> On Sun, Mar 7, 2010 at 12:20 PM, David sheehan <david.sheehanjr at gmail.com
>> > wrote:
>>
>>> >I mean Ax =b doesn't have A in explicit form, but in expression
>>> A=B+C1+C2+...+Cn,
>>> >where B is main part of A in an explicit form, C1, C2,... and Cn are
>>> small portions
>>> >comparing with B and they don't have an explicit form. Thus I want  to
>>>  make a
>>> >preconditioner from B, then apply the preconditioner to Ax=b. Please
>>> tell me how I
>>> >can do by PETSC sentences for PETSC solver, thanks.
>>>
>>> >   call KSPSetOperators(ksp,A,B,......)
>>>
>>> However, A doesn't have an explicit matrix form, how to call
>>> call KSPSetOperators(ksp,A,B,......)
>>>
>>
>> Use MATSHELL for A.
>>
>>    Matt
>>
>>
>>> ?  thanks.
>>>
>>> Based on what I thought, once I got preconditioner of B, I am wondering
>>> if I can
>>> define a special matrix-vector multiplication for A=B+C1+C2+...+Cn from a
>>> PETSC
>>> sentence, such that it can do following
>>> 1) x1=B*x
>>> 2) x2=x1+ C1*x, where C1*x is a sequence of matrix-vector multiplications
>>> 3) x3= x2+C2*x,......
>>> .....
>>> 4) xn+1=xn+Cn*x,where Cn*x is a squence of matrix-vector multiplications
>>>
>>> Then select a KSP iterative method such as GMRES to use the above
>>> matrix-vector
>>> multiplication and preconditioner that I made from B.
>>>
>>> Could you please tell me if it is possible? if so (I hope), how can I do
>>> it ? thanks.
>>>
>>> David
>>>
>>> On Sun, Mar 7, 2010 at 11:12 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>>
>>>>
>>>>  On Mar 7, 2010, at 10:57 AM, David sheehan wrote:
>>>>
>>>>  >First, configure with Hypre .
>>>> You mean, configure for the installation of PETSC with hypre? thanks.
>>>>
>>>>    yes, add --download-hypre
>>>>
>>>>
>>>> >Then -pc_type hypre -pc_hypre_type boomeramg
>>>> You mean, without adding any information into code include, just compile
>>>> and link
>>>> the code, to get an excuteable file, e.g. "a.out", then
>>>> a.out -pc_type hypre -pc_hypre_type boomeramg
>>>> is it right? thanks.
>>>>
>>>>
>>>>    Yes,
>>>>
>>>>
>>>> >I cannot understand exactly what you mean. However, if you want to
>>>> create a PC
>>>> > based upon a >matrix which is not the system matrix A, you can specify
>>>> it in
>>>> > KSPSetOperators().
>>>>
>>>> I mean Ax =b doesn't have A in explicit form, but in expression
>>>> A=B+C1+C2+...+Cn,
>>>> where B is main part of A in an explicity form, C1, C2,... and Cn are
>>>> small portions
>>>> comparing with B and they don't have an explicit form. Thus I want  to
>>>>  make a
>>>> preconditioner from B, then apply the preconditioner to Ax=b. Please
>>>> tell me how I
>>>> can do by PETSC sentences for PETSC solver, thanks.
>>>>
>>>>
>>>>    call KSPSetOperators(ksp,A,B,......)
>>>>
>>>>    Barry
>>>>
>>>>
>>>>
>>>>
>>>> David
>>>>
>>>>
>>>> On Sun, Mar 7, 2010 at 12:32 AM, Matthew Knepley <knepley at gmail.com>wrote:
>>>>
>>>>> On Sat, Mar 6, 2010 at 11:49 PM, David sheehan <
>>>>> david.sheehanjr at gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>> I need your helps about PETSC as follows:
>>>>>> 1) how can I call boomerAMG of HYPRE through PETSC as a solver and a
>>>>>> preconditioner?
>>>>>>
>>>>>
>>>>> First, configure with Hypre . Then -pc_type hypre -pc_hypre_type
>>>>> boomeramg
>>>>>
>>>>>
>>>>>> 2) how can I make a precondioner  from B matrix,  but apply the
>>>>>> preconditioner to Ax=b in PETSC?
>>>>>> Thanks in advance.
>>>>>>
>>>>>
>>>>> I cannot understand exactly what you mean. However, if you want to
>>>>> create a PC based upon a matrix
>>>>> which is not the system matrix A, you can specify it in
>>>>> KSPSetOperators().
>>>>>
>>>>>   Matt
>>>>>
>>>>>
>>>>>> David
>>>>>>
>>>>> --
>>>>> 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
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>> 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
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100307/5f9e89a0/attachment.html>


More information about the petsc-dev mailing list