3d_cylspec

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > 3D_domains >

3d_cylspec

Previous pageReturn to chapter overviewNext page

{  3D_CYLSPEC.PDE

   This problem considers the construction of a cylindrical domain in 3D.

}

 

title '3D Cylinder Generator'

 

coordinates

   cartesian3

 

variables

   u

 

definitions

   K = 0.1                     { thermal conductivity }

   R0 = 1                     { radius of the cylinder }

   Heat = 1                   { total heat generation }

   theta = 45                 { axis direction in degrees }

   c = cos(theta degrees)     { direction cosines of the axis direction }

   s = sin(theta degrees)      

   axis = vector(c,s)         { the axis direction vector }

   len = 3                     { cylinder length }

   x0 = -(len/2)*c             { beginning point of the cylinder axis }

   y0 = -(len/2)*s

   zoff = 10                   { a z-direction offset for the entire figure }

 

  { the cylinder function constructs the top surface of a cylinder with azis

     along z=0.5. The positive and negative values of this surface will be

     separated by a distance of one unit at the diameter. }

   zs = cylinder((x0,y0,0.5), (x0+len*c,y0+len*s, 0.5), R0)      

 

   flux = -k*grad(u)       { heat flux vector }

 

equations

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

 

extrusion

  surface z = zoff-zs         { the bottom half-surface }

  surface z = zoff+zs         { the top half-surface }

 

boundaries

    surface 1 value(u) = 0     { fixed value on cylinder surfaces }

    surface 2 value(u) = 0

    region 1

      start  (x0,y0)  

      value(u)=0             { fixed value on sides and end planes }

      line to (x0+R0*c,y0-R0*s)

            to (x0+len*c+R0*c,y0+len*s-R0*s)

            to (x0+len*c-R0*c,y0+len*s+R0*s)

            to (x0-R0*c,y0+R0*s)

            to close

 

definitions

   s2 = sqrt(2)

 

plots

    grid(x,y,z)

    grid(y*s2,z) on x+y=s2

    contour(u) on x=0 as "U on X=0"

    contour(u) on x-y=0 as "U on vertical plane through cylinder axis"

    contour(u) on x+y=s2 as "U on plane normal to axis"

    vector(flux-DOT(flux,axis)*flux) on x=0 as "Flux in X=0 plane"

    contour(DOT(flux,axis)) on x+y=s2 as "Flux normal to cross-axis plane"

    contour(DOT(flux,axis)) on x+y=s2 zoom(0.6,11,0.3,0.3) as "Flux normal to cross-axis plane"

    contour(magnitude(flux)) on x+y=s2 as "Total flux in cross-axis plane"

    glsurface(magnitude(flux)) on x+y=s2 as "Total flux in cross-axis plane"

    contour(magnitude(flux)) on y=0 as "Total flux in Y=0 plane"

    glcontour(magnitude(flux)) as "Total flux on surface"
 
end