<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>Hi Neks,</p>
<p><br>
</p>
<p>I'm currently working on improving my two-way coupling set up for my Lagrangian Particle Tracker which I'm developing as part of my PhD.<br>
<br>
To do this I require to know the coordinates of the corners of each cell (the space around a mesh gridpoint), in order to determine whether a particle is contained in that cell. </p>
<p><br>
</p>
<p>I am having trouble doing this for the entire mesh, and I think it's something to do with the parallel processing. My approach is as follows:</p>
<p><br>
</p>
<p>---------------------------------------------------<br>
</p>
<p><br>
</p>
<p></p>
<div><span style="font-family: Consolas, monospace;">if(TWOWAYON.EQ.1) then</span></div>
<div><span style="font-family: Consolas, monospace;"> do e = 1, nelv</span></div>
<div><span style="font-family: Consolas, monospace;"> ieg = lglel(e)</span></div>
<div><span style="font-family: Consolas, monospace;"> write(*,*) 'IEG:',e</span></div>
<div><span style="font-family: Consolas, monospace;"> write(*,*) 'nelv:',nelv</span></div>
<div><span style="font-family: Consolas, monospace;"> write(*,*) 'nelt:',nelt</span></div>
<div><span style="font-family: Consolas, monospace;"> do i = 1, nx1*nelx</span></div>
<div><span style="font-family: Consolas, monospace;"> do j = 1, ny1*nely</span></div>
<div><span style="font-family: Consolas, monospace;"> do k = 1, nz1*nelz</span></div>
<div><span style="font-family: Consolas, monospace;">c write(*,*) 'X:',i,'Y:',j,'Z:',k</span></div>
<div><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-family: Consolas, monospace;"> if(i.GE.2) then</span></div>
<div><span style="font-family: Consolas, monospace;"> xmc(i,j,k,e) = xm1(i,j,k,e) - </span></div>
<div><span style="font-family: Consolas, monospace;"> $ (xm1(i,j,k,e)-xm1(i-1,j,k,e))*0.5D0</span></div>
<div><span style="font-family: Consolas, monospace;"> else</span></div>
<div><span style="font-family: Consolas, monospace;"> xmc(i,j,k,e) = xm1(i,j,k,e)</span></div>
<div><span style="font-family: Consolas, monospace;"> endif</span></div>
<div><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-family: Consolas, monospace;"> if(i.LE.7) then</span></div>
<div><span style="font-family: Consolas, monospace;"> xxc(i,j,k,e) = xm1(i,j,k,e) +</span></div>
<div><span style="font-family: Consolas, monospace;"> $ (xm1(i+1,j,k,e)-xm1(i,j,k,e))*0.5D0</span></div>
<div><span style="font-family: Consolas, monospace;"> else</span></div>
<div><span style="font-family: Consolas, monospace;"> xxc(i,j,k,e) = xm1(i,j,k,e)</span></div>
<div><span style="font-family: Consolas, monospace;"> endif</span></div>
<div><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-family: Consolas, monospace;"> if(j.GE.2) then</span></div>
<div><span style="font-family: Consolas, monospace;"> ymc(i,j,k,e) = ym1(i,j,k,e) - </span></div>
<div><span style="font-family: Consolas, monospace;"> $ (ym1(i,j,k,e)-ym1(i,j-1,k,e))*0.5D0</span></div>
<div><span style="font-family: Consolas, monospace;"> else</span></div>
<div><span style="font-family: Consolas, monospace;"> ymc(i,j,k,e) = ym1(i,j,k,e)</span></div>
<div><span style="font-family: Consolas, monospace;"> endif</span></div>
<div><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-family: Consolas, monospace;"> if(j.LE.7) then</span></div>
<div><span style="font-family: Consolas, monospace;"> yxc(i,j,k,e) = ym1(i,j,k,e) +</span></div>
<div><span style="font-family: Consolas, monospace;"> $ (ym1(i,j+1,k,e)-ym1(i,j,k,e))*0.5D0</span></div>
<div><span style="font-family: Consolas, monospace;"> else</span></div>
<div><span style="font-family: Consolas, monospace;"> yxc(i,j,k,e) = ym1(i,j,k,e)</span></div>
<div><span style="font-family: Consolas, monospace;"> endif</span></div>
<div><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-family: Consolas, monospace;"> if(k.GE.2) then</span></div>
<div><span style="font-family: Consolas, monospace;"> zmc(i,j,k,e) = zm1(i,j,k,e) - </span></div>
<div><span style="font-family: Consolas, monospace;"> $ (zm1(i,j,k,e)-zm1(i,j,k-1,e))*0.5D0</span></div>
<div><span style="font-family: Consolas, monospace;"> else</span></div>
<div><span style="font-family: Consolas, monospace;"> zmc(i,j,k,e) = zm1(i,j,k,e)</span></div>
<div><span style="font-family: Consolas, monospace;"> endif</span></div>
<div><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-family: Consolas, monospace;"> if(k.LE.7) then</span></div>
<div><span style="font-family: Consolas, monospace;"> zxc(i,j,k,e) = zm1(i,j,k,e) +</span></div>
<div><span style="font-family: Consolas, monospace;"> $ (zm1(i,j,k+1,e)-zm1(i,j,k,e))*0.5D0</span></div>
<div><span style="font-family: Consolas, monospace;"> else</span></div>
<div><span style="font-family: Consolas, monospace;"> zxc(i,j,k,e) = zm1(i,j,k,e)</span></div>
<div><span style="font-family: Consolas, monospace;"> endif</span></div>
<div><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-family: Consolas, monospace;"> vol(i,j,k,e) =</span></div>
<div><span style="font-family: Consolas, monospace;"> $ (xxc(i,j,k,e) - xmc(i,j,k,e))</span></div>
<div><span style="font-family: Consolas, monospace;"> $ *(yxc(i,j,k,e) - ymc(i,j,k,e))</span></div>
<div><span style="font-family: Consolas, monospace;"> $ *(zxc(i,j,k,e) - zmc(i,j,k,e))</span></div>
<div><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-family: Consolas, monospace;">c write(*,*) 'Xmin: ', xmc(i,j,k,e) </span></div>
<div><span style="font-family: Consolas, monospace;">c write(*,*) 'Xmax: ', xxc(i,j,k,e)</span></div>
<div><span style="font-family: Consolas, monospace;">c write(*,*) 'Ymin: ', ymc(i,j,k,e) </span></div>
<div><span style="font-family: Consolas, monospace;">c write(*,*) 'Ymax: ', yxc(i,j,k,e) </span></div>
<div><span style="font-family: Consolas, monospace;">c write(*,*) 'Zmin: ', zmc(i,j,k,e) </span></div>
<div><span style="font-family: Consolas, monospace;">c write(*,*) 'Zmax: ', zxc(i,j,k,e)</span></div>
<div><span style="font-family: Consolas, monospace;">c write(*,*) 'VOL : ', vol(i,j,k,e) </span></div>
<div><span style="font-family: Consolas, monospace;"> enddo</span></div>
<div><span style="font-family: Consolas, monospace;"> enddo</span></div>
<div><span style="font-family: Consolas, monospace;"> enddo</span></div>
<div><span style="font-family: Consolas, monospace;"> enddo</span></div>
<div><span style="font-family: Consolas, monospace;"> endif</span></div>
<div><br>
</div>
-----------------------------------<br>
<p></p>
<p><br>
</p>
<p>Now if I sum up the volume using: tvol = glsum(vol,n), I get a weird volume that only seems to represent one element (ish).<br>
</p>
<p><br>
</p>
<p>If you can see where I'm going wrong I'd greatly appreciate it.<br>
</p>
<p><br>
</p>
<p>Thanks,<br>
</p>
<p><br>
</p>
<p>Lee Mortimer<br>
</p>
<p>University of Leeds<br>
</p>
</div>
</body>
</html>