[petsc-users] grid sequencing & DMComposite
Matthew Knepley
knepley at gmail.com
Fri Sep 11 08:36:01 CDT 2015
On Fri, Sep 11, 2015 at 8:15 AM, Gideon Simpson <gideon.simpson at gmail.com>
wrote:
> 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?
>
I think you want Global vectors for this, not Local vectors.
Matt
> -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
>
>
>
>
--
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-users/attachments/20150911/bc42082e/attachment-0001.html>
More information about the petsc-users
mailing list