[petsc-users] petsc-users Digest, Vol 45, Issue 33

coco at dmi.unict.it coco at dmi.unict.it
Fri Sep 14 10:18:14 CDT 2012


Thank you! I solved my problems using your suggestion and I found the  
bug in my code.

Best regards,
Armando


> Message: 5
> Date: Tue, 11 Sep 2012 18:43:50 -0500
> From: Barry Smith <bsmith at mcs.anl.gov>
> To: PETSc users list <petsc-users at mcs.anl.gov>
> Subject: Re: [petsc-users] interpolation function in multigrid
> Message-ID: <E5801048-2299-46A0-AF78-CD1B811D1BC2 at mcs.anl.gov>
> Content-Type: text/plain; charset=iso-8859-1
>
>
> On Sep 11, 2012, at 5:11 PM, coco at dmi.unict.it wrote:
>
>> Dear all,
>>
>> I am using the multigrid as preconditioner, and I got in a trouble  
>> with the interpolation function. In practice, I defined a user  
>> interpolation function:
>>
>> PetscErrorCode UserMultAddInterpolation(Mat mat,Vec x,Vec v2, Vec y);
>>
>> and I noticed that the vectors v2 and y are zero in input, while I  
>> am expected that they are the solution computed in the smooth down  
>> process at the same level. In detail, given the following source  
>> code of the petsc file mg.c :
>>
>> ierr =  
>> KSPSolve(mglevels->smoothd,mglevels->b,mglevels->x);CHKERRQ(ierr);   
>> /* pre-smooth */
>> [...]
>>    while (cycles--) {
>>      ierr = PCMGMCycle_Private(pc,mglevelsin-1,reason);CHKERRQ(ierr);
>>    }
>> [...]
>>    ierr =  
>> MatInterpolateAdd(mglevels->interpolate,mgc->x,mglevels->x,mglevels->x);CHKERRQ(ierr);
>>
>> I observed that mglevels->x is a vector which contains the correct  
>> values after the KSPSolve calling for the pre-smooth step, but it  
>> is a zero vector when given in input to the MatInterpolateAdd  
>> routine.
>> I would like to debug the mg.c code, for instance accessing the  
>> single values of the vector mglevels->x and figuring out where they  
>> are zeroed out between the KSPSolve and MatInterpolateAdd callings.  
>> Would you have some suggestion for this debugging?
>
>    You can call VecView(mglevels->x,0) directly in the debugger (for  
> a small problem) I would start by simply calling it right after the  
> KSPSolve() then right before the MatInterpolateAdd() if the second  
> is zero but the first ok then run with two levels and break in the  
> inner PCMGMCycle_Private() and print the same thing there (remember  
> the value of mglevels changes.
>
>    Good luck,
>
>    Barry
>
>>
>> Thank you for the collaboration.
>> Best regards,
>> Armando
>>
>
>
>
> ------------------------------
>
> _______________________________________________
> petsc-users mailing list
> petsc-users at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/petsc-users
>
>
> End of petsc-users Digest, Vol 45, Issue 33
> *******************************************



More information about the petsc-users mailing list