<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Dear Neks,</p>
<p><br>
</p>
<p>I have been looking at the mesh-morphing for a bend pipe recently. I found the thread
<a id="LPlnk588114" href="https://lists.mcs.anl.gov/mailman/htdig/nek5000-users/2011-June/001398.html">
https://lists.mcs.anl.gov/mailman/htdig/nek5000-users/2011-June/001398.html</a> on how to bend a straight pipe. The code worked perfectly for bending a straight pipe into a 90 degree bend shape. The problem is I need to bend my pipe at certain section, say
I have a pipe with total length of 10 and I want to bend it in the second half, i.e. from 5-10. However, when I tried to do it in this way, the error of 'Vanishing Jacobian near Xth node of element XX' appeared and the simulation couldn't start. I can't see
why it doesn't work.<br>
</p>
<p><br>
</p>
<p>Below is the code I'm using to bend the pipe (from 5-10) into a 90 degree bend. Hope someone could help me on this. Any suggestion would be appreciated. Thank you very much in advance.</p>
<p><br>
</p>
<p>Kind regards,<br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
Tony<br>
<br>
<br>
c-----------------------------------------------------------------------<br>
subroutine usrdat2() ! This routine to modify mesh coordinates<br>
include 'SIZE'<br>
include 'TOTAL'<br>
<br>
n = nx1*ny1*nz1*nelv<br>
<br>
c First, rotate x into axial position<br>
do i=1,n<br>
x_original = xm1(i,1,1,1)<br>
y_original = ym1(i,1,1,1)<br>
z_original = zm1(i,1,1,1)<br>
<br>
xm1(i,1,1,1) = z_original<br>
ym1(i,1,1,1) = y_original<br>
zm1(i,1,1,1) = -x_original<br>
enddo<br>
<br>
c Second, bend pipe into 90 degree bend<br>
<br>
xmin = glmin(xm1,n)<br>
xmax = glmax(xm1,n)<br>
ymin = glmin(ym1,n)<br>
ymax = glmax(ym1,n)<br>
if (nid==0) print *,xmin,xmax,ymin,ymax !which are 0, 10, -1, 1<br>
rad0 = 0.5*(ymax-ymin) ! Radius of initial pipe<br>
rad1 = 1.0 ! Radius of new pipe<br>
radm = 2.0 ! Major radius of torus<br>
<br>
do i=1,n<br>
x = xm1(i,1,1,1)<br>
y = ym1(i,1,1,1)<br>
<br>
if (x .gt. 5.0e0) then<br>
theta = 0.5*pi*(x-5.0e0)/(xmax-5.0e0)<br>
rad = radm + 2.0e0*rad1*(y-ymin)/(ymax-ymin)<br>
<br>
ym1(i,1,1,1) = rad*cos(theta)<br>
xm1(i,1,1,1) = rad*sin(theta)+5.0e0<br>
end if<br>
<br>
end do<br>
<br>
return<br>
end<br>
</div>
</div>
</div>
</body>
</html>