[petsc-users] KSPBuildResidual
Barry Smith
bsmith at mcs.anl.gov
Sat Dec 26 15:19:35 CST 2009
No, the 2 norm of the residual comes out automatically from the
GMRES algorithm. To use a different norm would require explicitly
computing the residual (expensive) then computing the norm of that.
Barry
On Dec 23, 2009, at 10:11 AM, jarunan at ascomp.ch wrote:
>
> Thanks for the suggestion.
>
> Can I change residual norm from Norm 2 to infinity norm?
>
>
> Regards,
> Jarunan
>
>
>
> Quoting Barry Smith <bsmith at mcs.anl.gov>:
>
>>
>> If you want to use the true residual norm then use GMRES with right
>> preconditioning. KSPSetPreconditionerSide()
>>
>> Barry
>>
>> On Dec 23, 2009, at 5:01 AM, jarunan at ascomp.ch wrote:
>>
>>>
>>> Dear Petsc-Team
>>>
>>> I am using KSPBuildResidual() to calculate true residual and use
>>> it as convergence criteria. It means the program will call
>>> KSPBuildResidual every iteration. I choose GMRES as a solver but
>>> I read in manual, it is written that this command is expensive
>>> for GMRES and some other solvers.
>>>
>>> Is it also expensive for BICGSTAB?
>>> Is there other possibility to calculate true residual without
>>> calling KSPBuildResidual() or KSPBuildSolution() ?
>>>
>>> Best regards,
>>> Jarunan
>>>
>>>
>>> Quoting Rob Ellis <Robert.G.Ellis at Shaw.ca>:
>>>
>>>> Hi Dave,
>>>>
>>>> Thanks! That's what I needed to know.
>>>>
>>>> Cheers,
>>>>
>>>> Rob
>>>>
>>>>
>>>>
>>>> From: petsc-users-bounces at mcs.anl.gov
>>>> [mailto:petsc-users-bounces at mcs.anl.gov] On Behalf Of Dave May
>>>> Sent: Tuesday, December 22, 2009 10:13 AM
>>>> To: PETSc users list
>>>> Subject: Re: [petsc-users] Two ways to set Vec values?
>>>>
>>>>
>>>>
>>>> Hey Rob
>>>> If you are sure that you only want to insert values locally into
>>>> x, then
>>>> option 1 will be faster.
>>>> Option 2 will communicate values if the inserted values live on
>>>> another
>>>> processor. If you don't need to send any data, use Option 1.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Dec 22, 2009 at 7:04 PM, Rob Ellis
>>>> <Robert.G.Ellis at shaw.ca> wrote:
>>>>
>>>> Hi Petsc'ers
>>>>
>>>> Can someone please let me know if I can set MPI vector values
>>>> using either
>>>> of the following methods? I wish to set the values of 'x' from
>>>> the values in
>>>> 'work'. Both methods operate correctly, but I would like to know
>>>> which is
>>>> more efficient, and/or recommended and why.
>>>>
>>>>
>>>> 1. GetArray/RestoreArray Method:
>>>>
>>>> call VecGetOwnershipRange(x,imin,imax,ierr)
>>>> call VecGetArray(x,x_local_v,x_local_i,ierr)
>>>> do i=imin,imax-1
>>>> x_local(i-imin)=work(i+1)
>>>> enddo
>>>> call VecRestoreArray(x,x_local_v,x_local_i,ierr)
>>>>
>>>>
>>>>
>>>> 2. SetValues/VecAssembly Method:
>>>>
>>>> call VecGetOwnershipRange(x,imin,imax,ierr)
>>>> nx_local = imax-imin
>>>> do i=imin,imax-1
>>>> icol(i-imin+1)=i
>>>> enddo
>>>> call VecSetValues(x,nx_local,icol,work(imin+1),INSERT_VALUES,ierr)
>>>> call VecAssemblyBegin(x,ierr)
>>>> call VecAssemblyEnd(x,ierr)
>>>>
>>>>
>>>> Method 1 is more compact and does not require the auxiliary
>>>> column number
>>>> vector, nor does it require the VecAssembly, however, it seems
>>>> to be what is
>>>> suggested by the examples. Also, is it recommended to use
>>>> VecGetArrayF90?
>>>>
>>>> Thanks for your help,
>>>> Cheers,
>>>> Rob
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Jarunan Panyasantisuk
>>> Development Engineer
>>> ASCOMP GmbH, Technoparkstr. 1
>>> CH-8005 Zurich, Switzerland
>>> Phone : +41 44 445 4072
>>> Fax : +41 44 445 4075
>>> E-mail: jarunan at ascomp.ch
>>> www.ascomp.ch
>>>
>>> Winter Training on TransAT: Zurich, 20 Feb. 2010.
>>> http://ascomp.ch/training.html
>
>
>
> --
> Jarunan Panyasantisuk
> Development Engineer
> ASCOMP GmbH, Technoparkstr. 1
> CH-8005 Zurich, Switzerland
> Phone : +41 44 445 4072
> Fax : +41 44 445 4075
> E-mail: jarunan at ascomp.ch
> www.ascomp.ch
>
> Winter Training on TransAT: Zurich, 20 Feb. 2010.
> http://ascomp.ch/training.html
More information about the petsc-users
mailing list