"Alletto, John M" <[email protected]> writes: > I have a 3D Laplacian program that I wrote in matlab that I would like to > transition to PETSc. > > In my current program I have an inner cube which utilizes a 27 point uniform > stencil > surrounded by an outer cubical which uses a smaller stencil on a variable > grid. > > I require the inner cubical to contain accurate results and do not care if > error accumulates in the outer regions.
This is not how elliptic PDEs work. In general, you need accuracy throughout the domain to have an accurate solution in a desired area. Depending on the coefficients and forcing function, you might get away with adaptive resolution, but you can't naively lay down a fine mesh/accurate discretization in the target area and expect to get an accurate solution. Now if you had, for example, isotropic coefficients in most of the domain, but anisotropic tensor-valued coefficients in a region, you could use a stencil that is (necessarily) 27-point in the anisotropic region and reduces to 7-point elsewhere. For that, you could preallocate a matrix with the exact number of nonzeros that will be needed, though I recommend starting with the 27-point case and only optimize later if it will provide a clear benefit.
pgpgdP8tJye4B.pgp
Description: PGP signature
