[petsc-users] Adding vectors of different dimension

Matthew Knepley knepley at gmail.com
Tue Jul 17 06:00:57 CDT 2012


On Tue, Jul 17, 2012 at 4:31 AM, TAY wee-beng <zonexo at gmail.com> wrote:

> Hi,
>
> I have 3 vectors of different dimension, create using 2 DM
> (da_dof1,da_dof2), with dof = 1 and 2.
>
> They are declared as:
>
> Vec u,v,duv
>
> call DMCreateLocalVector(da_dof1,u,**ierr)
>
> call DMCreateLocalVector(da_dof1,v,**ierr)
>
> call DMCreateLocalVector(da_dof2,**duv,ierr)
>
> How can I add duv to u and v to get new values for u,v?
>

You can split duv into single component vectors:
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecStrideScatter.html

   Matt


> I'm currently using DMDAVecGetArrayF90 and DMDAVecRestoreArrayF90 to
> access the arrays.
>
> Thanks
>
> --
> Yours sincerely,
>
> TAY wee-beng
>
>


-- 
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/20120717/9eda6375/attachment.html>


More information about the petsc-users mailing list