[petsc-users] several DAs with different dofs

Juha Jäykkä juhaj at iki.fi
Thu Nov 7 16:10:42 CST 2013


>   Just create another DA with a different dof argument and then use the
> DMGetGlobalVector() to get an empty vector and fill it up as needed with
> the data[][][] style

Thanks for the idea! Will that be guaranteed to have the same layout? I would 
not want to end up with one DA split to 4 MPI ranks along some axis and the 
other DA split to 3: then I would not have the right data.

This also has another disadvantage: I end up using a LOT more memory than I 
actually need: all the DA structures that get allocated before I create any 
vectors, would get allocated mostly for nothing because I will never create a 
local vector out of it and never do any MPI calls with it.

Bottom line: if the answer to my question above is "yes", I would still prefer 
a way which consumes less memory if there is an easy one. 

Cheers,
Juha

> 
>    Barry
> 
> On Nov 7, 2013, at 3:35 PM, Juha Jäykkä <juhaj at iki.fi> wrote:
> > Hi list!
> > 
> > I am thinking of pre-computing and storing some values that are used often
> > during a single TS iteration. I thought I'd create another vector from my
> > DA stick those values there: that would be the cleanest solution.
> > However, the dof of the DA is not big enough to hold all my pre-computed
> > values!
> > 
> > Any suggestions how to do this?
> > 
> > Unless I miss something obvious, here are my "requirements". I do not need
> > the data across iterations. but I'd rather not realloc it every time
> > either. The data need no ghosts (the data are just local values of some
> > functions of my variables, so any ghosts needed are the ghosts of the
> > variables). I would value a data[][][]-style indexing for simplicity (of
> > code). And finally, I would value the possibility of saving these for
> > inspection under some circumstances in the same format as the main data
> > (i.e. VecView).
> > 
> > Cheers,
> > Juha
-- 
		 -----------------------------------------------
		| Juha Jäykkä, juhaj at iki.fi			|
		| http://koti.kapsi.fi/~juhaj/			|
		 -----------------------------------------------



More information about the petsc-users mailing list