3d_helix_wrapped

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > 3D_domains >

3d_helix_wrapped

Previous pageReturn to chapter overviewNext page

{ 3D_HELIX_WRAPPED.PDE

     

 This problem shows the use of the function definition facility of FlexPDE to  

 create a helix of square cross-section in 3D.

 

 The mesh generation facility of FlexPDE extrudes a 2D figure along a straight  

 path in Z, so that it is not possible to directly define a helical shape.

 

 However, by defining a coordinate transformation, we can build a straight rod  

 in 3D and interpret the coordinates in a rotating frame.

 

 Define the twisting coordinates by the transformation

   xt = x*cos(y/R);

   yt = x*sin(y/R);

   zt = z

 

 In this transformation, x and y are the coordinates FlexPDE believes it is working  

 with, and they are the coordinates that move with the twisting.

 xt and yt are the "lab coordinates" of the twisted figure.

 

 The chain rule gives

   dF/d(xt) = (dx/dxt)*(dF/dx)  + (dy/dxt)*(dF/dy) + (dz/dxt)*(dF/dz)

 with similar rules for yt and zt.

 Some tedious algebra gives

   dx/dxt = cos(y/R)   dy/dxt = -(R/x)*sin(y/R)    dz/dxt = 0

   dx/dyt = sin(y/R)   dy/dyt =  (R/x)*cos(y/R)    dz/dyt = 0

   dx/dzt = dy/dzt = 0    dz/dzt = 1

 

 These relations are defined in the definitions section, and used in the equations  

 section, perhaps nested as in the heat equation shown here.

 

 Notice that this formulation produces the upward motion by tilting the bar in  

 the un-twisted space and wrapping the resulting figure around a cylinder.

 

 We have added a cylindrical mounting pad at each end of the helix.

 

 See "3d_helix_layered.pde" for a different approach to constructing a helix.

 See "Usage/CAD_Import/helix_OBJimport.pde" for how to import a helix from an OBJ file.

}  

 

title '3D Helix - transformation with no shear'  

 

coordinates  

   cartesian3  

 

select  

 ngrid=160   { generate enough mesh cells to resolve the twist }  

 

variables  

   Tp  

 

definitions  

   zlong = 60  

   turns =   4  

   pitch = zlong/turns       { z rise per turn }  

 

   xwide = 4.5  

   zhigh = 4.5  

   Rc = 22 - xwide/2               { center radius }  

   alpha = y/Rc  

   zstub = 5*zhigh     { rod pieces at each end }  

   sturn = Rc*2*pi     { arc length per turn }  

   yolap = pi*Rc*zhigh/pitch  

 

   slong = turns*sturn { arc length of spring }  

   stot = slong + 2*sturn { add one turn at each end for rod }  

 

   xin = Rc-xwide/2  

   xout = Rc+xwide/2  

   xbore = Rc/2  

 

  { transformations }  

   rise = pitch/(2*pi)   { z-rise per radian }  

   c = cos(alpha)  

   s = sin(alpha)  

   xt = x*c  

   yt = x*s  

   zt = z-zlong/2  

 

  { functional definition of derivatives }  

   dxt(f) = c*dx(f) - s*(Rc/x)*dy(f)  

   dyt(f) = s*dx(f) + c*(Rc/x)*dy(f)  

   dzt(f) = dz(f)  

 

  { Thermal source }  

   Q = 10*exp(-(xt-Rc)^2-yt^2-zt^2)  

 

   z1 = -zstub  

   z2 = max( 0, min(zlong, pitch*y/sturn - zhigh/2))  

   z3 = max(0, min(zlong, pitch*y/sturn + zhigh/2))  

   z4 = zlong + zstub  

 

initial values  

   Tp = 0.  

 

equations  

  { the heat equation using transformed derivative operators }  

   Tp:    dxt(dxt(Tp)) + dyt(dyt(Tp)) + dzt(dzt(Tp)) + Q = 0  

 

extrusion z = z1, z2, z3, z4  

 

boundaries  

 

  Limited Region 1       { the spring }  

      layer 2  

      start(xin,yolap)  

      line to (xout,yolap)  

      line to (xout, slong-yolap)  

      line to (xin,slong-yolap)  

      line to close  

 

  Limited Region 2               { top rod overlap with coil }  

      surface 4     value(Tp)=0   {cold at the end of the rod }  

      layer 2 layer 3  

      start(xbore,slong-yolap)  

      line to (xout,slong-yolap) to (xout,slong+yolap) to (xbore,slong+yolap) to close  

 

  Limited Region 3               { top rod free of coil }  

      surface 4     value(Tp)=0   {cold at the end of the rod }  

      layer 2 layer 3  

      start(xbore,slong+yolap)  

      line to (xout,slong+yolap) to (xout,slong+sturn-yolap) to (xbore,slong+sturn-yolap)  

            to close  

 

  Limited Region 4               { bottom rod overlap with coil }  

      surface 1     value(Tp)=0   {cold at the end of the rod }  

      layer 1 layer 2  

      start(xbore,-yolap)  

      line to (xout,-yolap) to (xout,yolap) to (xbore,yolap) to close  

 

  Limited Region 5               { bottom rod free of coil }  

      surface 1     value(Tp)=0   {cold at the end of the rod }  

      layer 1 layer 2  

      start(xbore,-sturn+yolap)  

      line to (xout,-sturn+yolap) to (xout,-yolap) to (xbore,-yolap) to close  

 

monitors  

  grid(xt,yt,zt) paintregions     { the twisted shape }  

 

plots  

  grid(xt,yt,zt) paintregions     { the twisted shape again }  

 

  { In the following, recall that x is really radius, and y is really azimuthal distance.

       It is not possible at present to construct a cut in the "lab" coordinates. }  

  grid(x,z) on y=0  

  contour(Tp) on y=0 as "ZX Temp"  

  contour(Tp) on z=0 as "XY Temp"  

  elevation(Tp) from(Rc,0,0) to (Rc,slong,zlong) { centerline of coil }  

 

end