[petsc-users] VecConcatenate in petsc4py

Jed Brown jed at jedbrown.org
Thu Jun 9 16:36:47 CDT 2022


You don't want to create a new vector here, but read from (and write to) multiple parts of the same vector. You can use PETSc interfaces for subvectors, or do it with NumPy slices (perhaps more natural and ergonomic, depending on how your code is written). 

Armand Touminet via petsc-users <petsc-users at mcs.anl.gov> writes:

> Dear Petsc team,
>
> I'm trying to implement PDE constrained optimization using TAO from the petsc4py interface.
> Since my problem has multiple parameter fields to optimize, I need to combine them into a single Vec object to supply to TAO. I've found the VecConcatenate in the C documentation, which appears to do exactly what I need, however this function does not seem to exist in the python interface (or at least I was unable to find it).
> Is there an other easy way to combine vectors from python?
>
> Thanks for your help,
>
> Armand Touminet


More information about the petsc-users mailing list