I have initialized ts = PETSc.TS().create()
and attempt to solve with some initial distribution with ts.setSolution(u)
and get a type error.
It seems as though it would like the type Vec
but is getting passed as a _DMDA_Vec_array
.
The setup goes as follows:
- create
dmda = PETSc.DMDA().create(<...>)
- create a global vector
x = dmda.createGlobalVec()
- get our IC vector:
ic = dmda.getVecArray(x)
- fill IC vector
- attempt
ts.setSolution(ic)
but it doesn't like thatic
is a_DMDA_Vec_array
object
So far I have found two things:
ic = dmda.getVecArray(x)
is doing what it is supposed to do--create a_DMDA_Vec_array
object- in regular PETSc, the equivalent would be to use the function
DMDAVecGetArray()
and then once you've filled the values, you run the functionDMDAVecRestoreArray()
to convert the_DMDA_Vec_array
object back to a usableVec
object forts
.
What is the equivalent protocol/workflow in Python for _DMDA_Vec_array
to Vec
type?