two_spheres

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > 3D_domains >

two_spheres

Previous pageReturn to chapter overviewNext page

{ TWO_SPHERES.PDE

 

 This problem constructs two spheres inside a box.  The centers of the spheres lie  

 on a single z-plane, which simplifies the domain construction.

 

 The domain consists of three layers.

   layer 1 is the space below the spheres

   layer 2 contains the sphere bodies, and is of zero thickness outside the spheres

   layer 3 is the space above the spheres

 The sphere interiors are Void, and are thus excluded from analysis. They could just as

 well be filled with material if one wanted to model the insides.

 The bounding surfaces of layer 2 are specified as a default, over-ridden by regional

 expressions within the (X,Y) extent of each sphere.

 

 See TWOZ_PLANAR.PDE, TWOZ_DIRECT.PDE, TWOZ_EXPORT.PDE and TWOZ_IMPORT.PDE

 for methods of treating spheres with centers on differing Z coordinates.

 

}  

 

title 'Two Spheres in 3D'  

 

coordinates  

   cartesian3  

 

variables  

   u  

 

definitions  

   K = 1           { dielectric constant of box filler (vacuum?) }  

   box = 1         { bounding box size }  

 

   R1 = 0.25       { sphere 1 radius, center and voltage}  

   x1 = -0.5  

   y1 = -0.5  

   V1 = -1  

 

   R2 = 0.4       { sphere 2 radius, center and voltage}  

   x2 = 0.2  

   y2 = 0.2  

   V2 = 2    

 

  { sphere shape functions }  

   sphere1_shape = SPHERE ((x1,y1,0),R1)  

   sphere2_shape = SPHERE ((x2,y2,0),R2)  

 

  { default position of layer 2 surfaces }  

   zbottom = 0  

   ztop = 0  

 

equations  

   U: div(K*grad(u))  = 0  

 

extrusion  

  surface "box_bottom"  z=-box  

  surface "sphere_bottoms"  z = zbottom  

  surface "sphere_tops"  z = ztop  

  surface "box_top" z=box  

 

boundaries  

    surface "box_bottom" natural(u) = 0   {insulating boundaries top and bottom }  

    surface "box_top" natural(u) = 0  

 

    Region 1   { The bounding box }  

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

 

  limited region 2   { sphere 1 }  

      mesh_spacing = R1/5         { force a dense mesh on the sphere }  

       zbottom = -sphere1_shape   { shape of surface 2 in sphere 1}  

       ztop = sphere1_shape       { shape of surface 3 in sphere 1}  

      layer 2 void  

      surface 2 value(u)=V1       { specify sphere1 voltage on top and bottom }  

      surface 3 value(u)=V1  

      start  (x1+R1,y1)  

          arc(center=x1,y1) angle=360  

 

  limited region 3   { sphere 2 }  

      mesh_spacing = R2/5         { force a dense mesh on the sphere }  

       zbottom = -sphere2_shape   { shape of surface 2 in sphere 2}  

       ztop = sphere2_shape       { shape of surface 3 in sphere 2}  

      layer 2 void  

      surface 2 value(u)=V2       { specify sphere2 voltage on top and bottom }  

      surface 3 value(u)=V2  

      start  (x2+R2,y2)  

          arc(center=x2,y2) angle=360  

 

plots  

  grid(x,y,z)  

  grid(x,z) on y=y1   as "Grid on Y-cut at sphere 1 center"  

  contour(u) on y=y1 as "Solution on Y-cut at sphere 1 center"  

  grid(x,z) on y=y2   as "Grid on Y-cut at sphere 2 center"  

  contour(u) on y=y2 as "Solution on Y-cut at sphere 2 center"  

  { sqrt(2) is needed to plot true distance along diagonal: }  

  grid(x*sqrt(2),z) on x-y=0 as "Grid on x=y diagonal"    

  contour(u) on x-y=0 as "Solution on x=y diagonal"  

 

end