save

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Misc >

save

Previous pageReturn to chapter overviewNext page

{ SAVE.PDE  

 

 This example illustrates use of the SAVE function.

 

 SAVE(F) computes the value of F at each mesh node, and returns interpolated

 values for any position within a cell.

 If  F is very expensive to compute, the use of SAVE can reduce the overall cost

 of a simulation.

 SAVE also hides the complexity of F from differentiation in forming the coupling

 matrix, and may therefore avoid numerical difficulties encountered in computing

 the derivatives of pathological functions.

 

}

title 'SAVE test'

select

   ngrid=20

   contourgrid=100 { use a very dense plot grid to show data structure }

Variables

   u,v

definitions

   k = 2

   u0 = 1+x^2+y^2

   s = cos(20*x)*cos(20*y)

   save_s = save(s)       { Used in a definition }

Initial values

   u = 1

equations

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

   V: v - div(K*grad(v))  = save_s

boundaries

  region 1

      start(-1,-1)

          value(u)=u0 value(v)=u0

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

  region 2

       k=4

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

plots

  grid(x,y)

  contour(u)

  contour(v)

  contour(s)

  contour(save_s)    

  elevation(s, save_s) from(-1,0) to (1,0)

end