[petsc-users] ksp/dmmg laplace examples

Barry Smith bsmith at mcs.anl.gov
Wed Jul 28 13:51:11 CDT 2010


  Darach,

    Jed's answer is essentially complete, I'll just expand on it a little in case it is not completely clear and because I like to hear myself type.

    The diagonal scaling we choose is completely dictated by the fact that we want to use geometric multigrid as our solver. For geometric multigrid to work well the coarse grid corrections need to be (approximate) PROJECTIONS of the error onto the coarser grid space. They cannot be 10 times the projection or 1/2 times a projection, this means the scaling is important. When one uses the Galerkin finite element methods the coarse grid space is actually a subspace of the fine grid space so the coarse grid correction is automatically a projection of the error. With finite differences this need not be the case (it depends on how you scale the matrix). Thus in our examples that use finite differences (we have finite difference examples because they are easy to write and understand) we use a scaling that MATCHES the scaling one would get if one used Galerkin finite elements. 

  For example, in 1d finite elements gives you \integral grad u * grad v = \integral v * f where the integrals are over (for example) piecewise linear finite element basis functions. Now grad a basis function is order 1/h so the left hand side scaling is h * 1/h * 1/h = 1/h the scaling on the right hand side is h (since the support of each basis function is of size h). For 3d finite elements again grad a basis function is 1/h but now the integral is over are region of size h*h*h so the left hand side scaling is h*h*h* 1/h * 1/h and the right side scaling is h*h*h.  This gives the basic scaling of the matrix. Now to do the scaling of the rows of the matrix that correspond to Dirichlet boundary conditions we scale them in the same way as the other diagonals of the matrix.

   Barry



On Jul 28, 2010, at 10:27 AM, Jed Brown wrote:

> On Wed, 28 Jul 2010 13:08:59 +0100, Darach Golden <darach at tchpc.tcd.ie> wrote:
>> In each of the examples above, the linear system to be solved seems to
>> contain entries for the total number of nodes (including boundary
>> nodes), with rows associated with boundary nodes containing values on
>> the diagonal only (in the Dirichlet case).  Is this correct?
> 
> Yes.  For simple problems, especially on unstructured grids these nodes
> can be eleminated, but they are usually left in for structured grids or
> for hybrid conditions or conditions that change over time.
> 
>> It's these diagonal matrix values that are confusing me:
> 
> Note that you can scale this any way you like and you will get the same
> solution.  The problem is volume weighted (somewhat important for
> geometric multigrid, happens automatically with FEM) and the boundary
> conditions are scaled to produce similar diagonal entrios to nearby
> nodes.  To explain the exact values, note that Laplace produces diagonal
> entries of magnitude
> 
>  2 d h^d \sum_{i=1}^d 1/h_d^2
> 
> in d dimensions.  See src/snes/examples/tutorials/ex48.c for a nonlinear
> vector problem in a finite element context.
> 
> Jed



More information about the petsc-users mailing list