Lump

Top  Previous  Next

{  LUMP.PDE  }

{

    This example illustrates use of the LUMP function.

 

    LUMP(f) is syntactically like SAVE(f), in that it stores a representation of its argument for later use.

 

    LUMP(f) differs from SAVE(f) in that it saves an averaged value in each mesh cell, and returns the same

    value for any position within the cell.

 

}

title 'LUMP test'

 

select

    contourgrid=200

 

Variables

    u

 

definitions

    k = 2

    u0 = 1+x**2+y**2

    s = u0 - 4*k

    lumps = lump(s)                { Used as a definition }

 

Initial values

    u = 1

 

equations

    u - div(K*grad(u))  = s

 

boundaries

    Region 1

       start(-1,-1)

              value(u)=u0

       line to (1,-1) to (1,1) to (-1,1) to close

 

monitors

    contour(u)

 

plots

    grid(x,y)

    contour(u)

    contour(s)

    contour(lump(s))                { used directly }

    contour(lumps)

 

end