mesh_density

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Mesh_Control >

mesh_density

Previous pageReturn to chapter overviewNext page

{ MESH_DENSITY.PDE  

 

  This example demonstrates the use of the MESH_DENSITY parameter to

  control mesh density.

 

  A global density function is defined as a Gaussian distribution returning

  1 cell-per-unit density at the center, rising to 54.6 cell-per-unit density

  at the corners.

 

  This global distribution is overridden by a regional definition of 50 cell-per-unit

  density in a central region.

 

}  

 

title 'Cell Size Control'  

 

variables  

   u  

 

definitions  

   k = 1  

   u0 = 1-x^2-y^2  

   s = 2*3/4+5*2/4  

  mesh_density = exp(2*(x^2+y^2))  

   box = 0.1  

 

equations  

   u : div(K*grad(u)) +s = 0  

 

boundaries  

  Region 1  

      start(-1,-1)  

          value(u)=u0  

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

  Region 2  

      mesh_density = 50  

      start(-box,-box)  

      line to (box,-box) to (box,box) to (-box,box) to close  

 

plots  

  grid(x,y)  

  contour(u)  

 

end