[petsc-users] grid sequencing & DMComposite

Gideon Simpson gideon.simpson at gmail.com
Fri Sep 11 08:15:54 CDT 2015


Ok, so here’s some behavior I don’t understand.  I am working with a DMComposite structure, and I do the following,

    SNESComputeFunction(snes,U_refine,r);
    SNESGetDM(snes, &dm_refine);

    DMCompositeGetLocalVectors(dm_refine, &rp, &rQ);
    DMCompositeScatter(dm_refine, r, rp, rQ);
      
    VecNorm(r, NORM_2, &r_norm);
    VecNorm(rp, NORM_2, &rp_norm);
    VecNorm(rQ, NORM_2, &rQ_norm);

    VecGetSize(r,&r_size);
    VecGetSize(rp, &rp_size);
    VecGetSize(rQ, &rQ_size);

    DMCompositeRestoreLocalVectors(dm_refine, &rp, &rQ);
    VecDestroy(&r);

    PetscPrintf(PETSC_COMM_WORLD," ||r|| = %g, %i entries\n",r_norm,r_size);
    PetscPrintf(PETSC_COMM_WORLD," ||rp|| = %g, %i entries\n",rp_norm,rp_size);
    PetscPrintf(PETSC_COMM_WORLD," ||rQ|| = %g, %i entries\n",rQ_norm,rQ_size);

and my output is:

 ||r|| = 225.31, 7999 entries
 ||rp|| = 140.021, 3 entries
 ||rQ|| = 176.56, 8004 entries


The arithmetic, is off, no?

-gideon

> On Sep 10, 2015, at 5:28 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
> 
>  SNESGetDM()  this will return not the original DM you set but the refined one.
> 
>> On Sep 10, 2015, at 3:47 PM, Gideon Simpson <gideon.simpson at gmail.com> wrote:
>> 
>> I’m using a DMCompsosite along with grid sequencing and here’s what I’m trying to accomplish.  After running the SNES solve, I’d like to evaluate the residual on the refined grid, on each piece of the DMComposite.  How do I get a DM for the refined grid which I can then use with DMCompositeGetLocalVectors in order to get each piece of the problem?  Or is there a better way?
>> 
>> -gideon
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150911/f365c03e/attachment.html>


More information about the petsc-users mailing list