﻿ Sample Problems > Usage > 3D_domains > 3d_helix_layered

# 3d_helix_layered

Navigation:  Sample Problems > Usage > 3D_domains >

# 3d_helix_layered   { 3D_HELIX_LAYERED.PDE

This problem demonstrates the construction of a helix by layered half-turns.

Each half-turn of the helix is represented by two layers: a layer for the coil and

a separating layer for the gap.

The top and bottom surfaces of the helix are formed as spiral ribbons : z=twist*angle+offset.

The turns of the helix are divided into half-turn layers by spiral ribbons of opposite twist :

z=offset-cuttwist*angle.

The top surface of the lower half turn meets the bottom surface of the upper half turn

in the region where the cut ribbon crosses the helix.  Since these two surfaces must

be separated by a "layer", there must be an empty layer between each pair of half-turns

of the helix.  This layer exists only in the region of contact between the two half turns,

and in this region, the layer has zero thickness.

In this sample problem, we solve a heat conduction problem in the helix simply

for demonstration purposes.

See "3d_helix_wrapped.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 layered helix'

coordinates

cartesian3

variables

Tp

definitions

xwide = 1   { width of coil band }

zhigh = 1   { height of coil band }

zhaf = zhigh/2

pitch = 2*zhigh { z rise per turn }

x0 = 3     { center radius }

xin = x0-xwide/2       { inner radius }

xout = x0+xwide/2   { outer radius }

{ cut layers with reverse-helix. choose a steep cutpitch to avoid overlapping cut regions: }

cutpitch = 4*pitch         { z fall per turn of layer-cutting ribbon }

{ Compute the half-angle of the baseplane projection of the intersection between the

helix ribbon and the cut ribbon.  This determines the size of the Regions necessary

to describe the intersections. }

thetai = 2*pi*zhaf/(pitch+cutpitch)

ci = cos(thetai)

si = sin(thetai)

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

cuttwist = cutpitch/(2*pi)   {  "  }

{ measure angles from positive x-axis for right arcs and from negative x-axis for

left arcs, to avoid jumps in the atan2 function. NOTE: these definitions were

changed between v6 and v7 due to changes in the atan2 function itself. }

alphar = atan2(y,x)   ! angular position (-pi,pi) relative to positive x-axis

alphal = atan2(-y,-x) ! angular position (-pi,pi) relative to negative x-axis

{ calculate layer-cut surfaces for left and right arcs (relative to the arc center) }

rlo = -(1/4)*pitch - cuttwist*(alphar+pi/2)     ! floor value for right arc

rhi = (1/4)*pitch - cuttwist*(alphar-pi/2)     ! ceiling value for right arc

llo = -(1/4)*pitch - cuttwist*(alphal+pi/2)     ! floor value for left arc

lhi = (1/4)*pitch - cuttwist*(alphal-pi/2)     ! ceiling value for left arc

{Define functions to generate the  z position of turn n offset by h*zhaf : }

zr(n,h) = max(rlo, min(rhi, twist*alphar + h*zhaf)) + n*pitch

zl(n,h) = max(llo, min(lhi, twist*alphal + h*zhaf)) + n*pitch

{ Thermal source }

Q =   10*exp(-x^2-(y-x0)^2-(z-pitch/4)^2)

{ Thermal conductivity }

K = 1

initial values

Tp = 0.

equations

Tp:   div(k*grad(Tp)) + Q = 0

extrusion

surface z=zr(-2,-1)     { right arc bottom, turn -2 }

surface z=zr(-2,1)     { right arc top, turn -2 }

surface  z=zl(-3/2,-1) { left arc bottom, turn -2 }

surface  z=zl(-3/2,1)   {left arc top, turn -2 }

surface z=zr(-1,-1)     { right arc bottom, turn -1 }

surface z=zr(-1,1)     { right arc top, turn -1 }

surface  z=zl(-1/2,-1) { left arc bottom, turn -1 }

surface  z=zl(-1/2,1)   { left arc top, turn -1 }

surface z=zr(0,-1)     { right arc bottom, turn 0 }

surface z=zr(0,1)       { right arc top, turn 0 }

surface  z=zl(1/2,-1)   { left arc bottom, turn 0 }

surface  z=zl(1/2,1)   { left arc top, turn 0 }

surface  z=zr(1,-1)     { right arc bottom, turn 1 }

surface z=zr(1,1)       { right arc top, turn 1 }

surface  z=zl(3/2,-1)   { left arc bottom, turn 1 }

surface  z=zl(3/2,1)   { left arc top, turn 1 }

surface  z=zr(2,-1)     { right arc bottom, turn 2 }

surface z=zr(2,1)       { right arc top, turn 2 }

surface  z=zl(5/2,-1)   { left arc bottom, turn 2 }

surface  z=zl(5/2,1)   { left arc top, turn 2 }

boundaries

surface 1 value(Tp)=0

surface 20 value(Tp)=0

Limited Region 1   "lower cut "

layer 1                     {skip layer 2}

layer 3 layer 4 layer 5   {skip layer 6}

layer 7 layer 8 layer 9     {skip layer 10}

layer 11 layer 12 layer 13 {skip layer 14}

layer 15 layer 16 layer 17 {skip layer 18}

layer 19

start(-xout*si,-xout*ci)

arc(center=0,0) to(xout*si,-xout*ci)

line to (xin*si,-xin*ci)

arc(center=0,0) to(-xin*si,-xin*ci)

line to close

Limited Region 2     " right arc "

layer 1         {skip layers 2,3,4}

layer 5         {skip layers 6,7,8}

layer 9         {skip layers 10,11,12}

layer 13       {skip layers 14,15,16}

layer 17

start(xout*si,-xout*ci)

arc(center=0,0) to(xout*si,xout*ci)

line to (xin*si,xin*ci)

arc(center=0,0) to(xin*si,-xin*ci)

line to close

Limited Region 3     "upper cut "

layer 1 layer 2 layer 3     {skip layer 4}

layer 5 layer 6 layer 7   {skip layer 8}

layer 9 layer 10 layer 11 {skip layer 12}

layer 13 layer 14 layer 15{skip layer 16}

layer 17 layer 18 layer 19

start(xout*si,xout*ci)

arc(center=0,0) to(-xout*si,xout*ci)

line to (-xin*si,xin*ci)

arc(center=0,0) to(xin*si,xin*ci)

line to close

Limited Region 4     "left arc "

layer 3         {skip layers 4,5,6}

layer 7         {skip layers 8,9,10}

layer 11       {skip layers 12,13,14}

layer 15       {skip layers 16,17,18}

layer 19

start(-xout*si,xout*ci)

arc(center=0,0) to(-xout*si,-xout*ci)

line to (-xin*si,-xin*ci)

arc(center=0,0) to(-xin*si,xin*ci)

line to close

monitors

grid(x,y,z)

plots

grid(x,y,z) paintregions

grid(x,y,z) on regions 1,2,3 on layer 1   paintregions   as "first right arc"

grid(x,y,z) on regions 3,4,1 on layer 3   paintregions   as "first left arc"

grid(x,y,z) on regions 1,2,3,4 on layers 1,3 paintregions as "first full arc"

grid(x,z) on y=0

contour(Tp) on x=0 as "ZY Temp" painted

contour(Tp) on z=pitch/4 as "XY Temp" painted

end