Navigation:  Sample Problems > usage > 3D_domains >

3d_cylspec

Print this Topic 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

plots

    grid(x,y,z)  png(3072,1)

    grid(x,z) on y=0

    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=0 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=0 as "Flux normal to X=0 plane"

    contour(magnitude(flux)) on x=0 as "Total flux in X=0 plane"

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

end

 


Page url: index.html?usage_3d_domains_3d_cylspec.html