Thanks Jed, so if I understood correctly in fact there is nothing to be done, since I was already recomputing the staggered values when passing from one node to its neighbour. And good Black Friday to you.
On Fri, Nov 29, 2013 at 4:20 PM, Jed Brown <[email protected]> wrote: > "iwaddington ." <[email protected]> writes: > > > Hi, I am trying to optimize a code that solves an inhomogeneous laplacian > > pde of the form : > > > > -div ( K(x) grad(u) ) = f 0 < x,y < 1 where K(x) is > a > > matrix that > > > > depends on the position > > > > I use finite differences and the values of "f" and "u" are cell > centered. > > > > The problem is the following, since each interface is common to two > cells, > > and I need the value of K on the interfaces, which is taken as an > harmonic > > mean, > > This is one choice, and not a perfect one. > > > I would like to compute these values only once, and then pass them as > > some user context to KSPSetComputeOperators, because I am using a > > dmda. Any ideas ? > > You can create a DMDA to hold those staggered coefficients. Note that > it may be faster to just recompute the staggered values from > cell-centered values, since it involves a bit less memory bandwidth, and > memory bandwidth is the main performance bottleneck for these things. > That also makes it easier to choose different flux definitions (e.g., > for unaligned anisotropy, you'll need at least a 9-point stencil). >
