Creating a new vector based on a already distributed set of Vecs

Matthew Knepley knepley at gmail.com
Sun Mar 23 15:33:02 CDT 2008


2008/3/23 Vijay S. Mahadevan <vijay.m at gmail.com>:
> There is more than 1 vector involved, with different data and layout
>  dependent on the physics and mesh. Since the different Vec objects in
>  systems have their own layout, I do not want to modify them or recreate
>  them. I just want to create an interface vector so that I can pass it on to
>  SNESSolve without having the hassle of synchronizing the individual vectors
>  in each system.
>
>  I am writing a multi-physics code and this global vector concept could be
>  applied to the global nonlinear residual and the global solution vector. It
>  doesn't make sense to recreate an entirely new vector and synchronizing
>  these at every call to the residual. And there lies my motivation. But if
>  you see an alternative way to approach this, I would be glad to hear it !

You would like a single Vec which is the concatenation of a set of distributed
Vecs. I think this is needless economizing. If you are solving systems, the
memory involved in the Mat, PC, and KSP will swamp one vector. I would get
the code working first. Then if you really need this memory savings, you can
extract the pointer from the global vector and use it to create several smaller
vectors. However, as I said, I think it is unnecessary.

  Matt

>  Sorry if I wasn't too clear before.
>  -----Original Message-----
>  From: owner-petsc-users at mcs.anl.gov [mailto:owner-petsc-users at mcs.anl.gov]
>  On Behalf Of Matthew Knepley
>  Sent: Sunday, March 23, 2008 3:13 PM
>  To: petsc-users at mcs.anl.gov
>  Subject: Re: Creating a new vector based on a already distributed set of
>  Vecs
>
>  2008/3/23 Vijay S. Mahadevan <vijay.m at gmail.com>:
>  > Hi all,
>  >
>  >  I am sure the subject line wasn't too explanatory and so here goes.
>  >
>  >  I have a system which already has a Vec object created and distributed on
>  >  many processors based on domain decomposition. I could have several such
>  >  systems, each with a solution vector and a residual vector pertaining to
>  its
>  >  physics.
>  >
>  >  Now, can I create a global vector which would just be pointers to the
>  >  already existing vectors but from PETSc's point of view, appears to be a
>  >  globally valid, (and possibly weirdly) distributed vector. Such an option
>  >  will save the memory needed for the global vector and eliminates errors
>  as
>  >  to synchronization of the solution, residuals for the systems.
>
>  I do not understand what you want. If you want a vector with the same
>  layout,
>  use VecDuplicate(). If you want the same data, just use the Vec itself.
>
>   Thanks,
>
>     Matt
>
>  >  I was reading the documentation and found the PetscMap data structure.
>  But I
>  >  am not entirely sure if this is what I am looking for.
>  >
>  >  I hope that makes sense. I would appreciate any help you can provide to
>  >  point me in the right direction.
>  >
>  >  Cheers,
>  >  Vijay
>  >
>  >  No virus found in this outgoing message.
>  >  Checked by AVG.
>  >  Version: 7.5.519 / Virus Database: 269.21.8/1339 - Release Date:
>  3/22/2008
>  >  4:43 PM
>  >
>  >
>  >
>
>
>
>  --
>  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
>
>  No virus found in this incoming message.
>
>
> Checked by AVG.
>  Version: 7.5.519 / Virus Database: 269.21.8/1339 - Release Date: 3/22/2008
>  4:43 PM
>
>
>  No virus found in this outgoing message.
>  Checked by AVG.
>  Version: 7.5.519 / Virus Database: 269.21.8/1339 - Release Date: 3/22/2008
>  4:43 PM
>
>
>



-- 
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




More information about the petsc-users mailing list