Dear Nek Community,
I am trying to generate helical pipe mesh using the helix example with a straight pipe mesh (mesh can be obtained from KTH-Nek5000 Github). Things work fine when setting with the default amp and pitch value.
I would like to simulate a helical pipe with large amp and smaller pitch values but using amp=3 with pitch=1, the pipe become a flat helical (see the attached figure).
Looking forward for some insights.
Thank in advance.
Kind regards.
Code:
!Helix
c Geometry modification for helical pipe
diam = 1.0
amp = 3.0 !coil distance
pitch = 1.0 !ZLENGTH
z0 = 0.
z1 = pitch
call rescale_x (zm1,z0,z1)
one = 1.
pi = 4.*atan(one)
dtdz = 2.*pi/pitch
rad = diam/2.
radm = -rad
call rescale_x (xm1,radm,rad)
call rescale_x (ym1,radm,rad)
n = nx1*ny1*nz1*nelv
call copy(ox,xm1,n)
call copy(oy,ym1,n)
call copy(oz,zm1,n)
c account for elliptic shape, and induce offset
a2pi = 2*pi*amp
gamm = atan2(pitch,a2pi)
dpd = 1./cos(gamm) ! D' / D (eccentricity of ellipse)
do i=1,n ! preset offset twist
x = xm1(i,1,1,1)
y = ym1(i,1,1,1)
z = zm1(i,1,1,1)
th = -dtdz*z
c = cos(th)
s = sin(th)
xm1(i,1,1,1) = c*x - s*y
ym1(i,1,1,1) = s*x + c*y
enddo
call cadd ( xm1, amp, n ) ! offset center
c call cmult( ym1, dpd, n )
do i=1,n ! make helix
x = xm1(i,1,1,1)
y = ym1(i,1,1,1)
z = zm1(i,1,1,1)
th = dtdz*z
c = cos(th)
s = sin(th)
xm1(i,1,1,1) = c*x - s*y
ym1(i,1,1,1) = s*x + c*y
enddo
param(59) = 1. ! All elements deformed
ifxyo = .true.
return
end