[petsc-users] Inhomogeneous laplacian

Jed Brown jedbrown at mcs.anl.gov
Fri Nov 29 12:20:30 CST 2013


"iwaddington ." <iwaddington at gmail.com> 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).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131129/2b83d416/attachment.pgp>


More information about the petsc-users mailing list