<div dir="ltr"><span style="font-size:12.800000190734863px">Hey Philipp,</span><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">Thanks this helps a lot! Couple of questions,</div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">1) So you are saying the interpolation can be done in userdat2 at the start? My forcing field does not change with time.</div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">2) So essentially you are saying the routine in red should be just, ffx = new_array(ix,iy,iz,iel) ? Does 'iel' by default designate the local index? Or do I have to declare 'iel' before?</div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">One of the problems I was having doing it this way is that I didn't get a flowfield when I tried to use more than one processor, that is, parallelizing it. However it returned me a flowfield when it was with just one processor. That is in series.</div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">I am uploading some files if you want to take a further look.</div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px"><a href="https://drive.google.com/drive/folders/1i_TUfUePTHK2He9hGyRoFcC_1emeJhXU?usp=sharing">https://drive.google.com/drive/folders/1i_TUfUePTHK2He9hGyRoFcC_1emeJhXU?usp=sharing</a><br></div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">Thanks,</div><div style="font-size:12.800000190734863px">Saikat</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><span style="background-color:rgb(255,255,255)"><font color="#444444" face="georgia, serif" size="2">Saikat Mukherjee,</font></span></div><div dir="ltr"><font color="#444444" face="georgia, serif" size="2">PhD Student,</font></div><div dir="ltr"><font color="#444444" face="georgia, serif" size="2">Paul Research Group - <a href="http://www.me.vt.edu/mpaul/" target="_blank">http://www.me.vt.edu/mpaul/</a><br></font><div><span style="background-color:rgb(255,255,255)"><font color="#444444" face="georgia, serif" size="2">Engineering Science and Mechanics,</font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#444444" face="georgia, serif" size="2">Virginia Tech.</font></span></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Mon, Jul 23, 2018 at 5:56 PM, Saikat Mukherjee <span dir="ltr"><<a href="mailto:msaikat6@vt.edu" target="_blank">msaikat6@vt.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hey Philipp,<div><br></div><div>Thanks this helps a lot! Couple of questions,</div><div><br></div><div>1) So you are saying the interpolation can be done in userdat2 at the start? My forcing field does not change with time.</div><div><br></div><div>2) So essentially you are saying the routine in red should be just, ffx = new_array(ix,iy,iz,iel) ? Does 'iel' by default designate the local index? Or do I have to declare 'iel' before?</div><div><br></div><div>One of the problems I was having doing it this way is that I didn't get a flowfield when I tried to use more than one processor, that is, parallelizing it. However it returned me a flowfield when it was with just one processor. That is in series.</div><div><br></div><div>I am uploading some files if you want to take a further look.</div><div><br></div><div><br></div><div>Thanks,</div><div>Saikat</div><div><div class="h5"><div class="gmail_extra"><br clear="all"><div><div class="m_-1597952095376286279gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Mon, Jul 23, 2018 at 3:54 PM, <span dir="ltr"><<a href="mailto:nek5000-users@lists.mcs.anl.gov" target="_blank">nek5000-users@lists.mcs.anl.<wbr>gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
- userdat2 looks ok. Just some comments: use real instead of double precision as we compile with -r8. Then you could define your parameter right in the beginning and just use that one, instead of hardcoded 651. But these are details, it should work, and just read and broadcast your data to all processors.<br>
<br>
- in userf: again, use real instead. Also, you might read the FD coordinates in userdat2 as well. You can do as you do, but that is most inefficient (reading every time step from every processor).<br>
<br>
- you do not need to reshape the array, you can just define my_array with the proper size in userf. (my_array(31,21)). In fact, you do not even need that as you can simply pass my_array to pwl_intepr_2d.<br>
<br>
- the whole interpolation can be done once in the beginning anyway, or do you change the forcing field as a function of time?<br>
<br>
- you do not need separate fo and new_array (see above)<br>
<br>
- then the red bit: You have now interpolated your forcing on the gll points. So ffx simply needs to be the entry of this forcing field at the current ix,iy,iz,e. No need for a loop over the (local) elements, and no need for local-to-global mapping. just take the local index iel. Everything is local, as your interpolation was local as well (i.e. only interpolated to those elements that a specific processor had because you used xm1 and ym1.<br>
<br>
Sorry if I am misunderstanding. It is not easy to debug code without a running case.<br>
<br>
Hope this helps,<br>
philipp<span><br>
<br>
On 2018-07-23 16:57, <a href="mailto:nek5000-users@lists.mcs.anl.gov" target="_blank">nek5000-users@lists.mcs.anl.go<wbr>v</a> wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
Hello,<br>
<br>
Following up on this question again. Would appreciate any input.<br>
<br>
Thanks,<br>
Saikat<br>
<br>
<br>
<br></span><span>
On Mon, Jul 16, 2018 at 10:17 AM, <<a href="mailto:nek5000-users@lists.mcs.anl.gov" target="_blank">nek5000-users@lists.mcs.anl.g<wbr>ov</a> <mailto:<a href="mailto:nek5000-users@lists.mcs.anl.gov" target="_blank">nek5000-users@lists.mc<wbr>s.anl.gov</a>>> wrote:<br>
<br>
Hey everyone,<br>
<br>
Just following up on this question. Could really use some suggestion.<br>
<br>
Thanks,<br>
Saikat<br>
<br>
Saikat Mukherjee,<br>
PhD Student,<br>
Paul Research Group - <a href="http://www.me.vt.edu/mpaul/" rel="noreferrer" target="_blank">http://www.me.vt.edu/mpaul/</a><br>
Engineering Science and Mechanics,<br>
Virginia Tech.<br>
<br>
On Wed, Jul 11, 2018 at 11:34 AM, Saikat Mukherjee <<a href="mailto:msaikat6@vt.edu" target="_blank">msaikat6@vt.edu</a><br></span><div><div class="m_-1597952095376286279h5">
<mailto:<a href="mailto:msaikat6@vt.edu" target="_blank">msaikat6@vt.edu</a>>> wrote:<br>
<br>
Hey All,<br>
<br>
I have been stuck in this problem for a while now but I think it<br>
should be simple and probably you can tell where I am going wrong.<br>
<br>
- So I have a forcing function on a finite difference X-Y grid,<br>
which I am reading in as a text file in the 'userdat2' subroutine.<br>
<br>
- I am then parallelizing it using a previous suggestion by<br>
Paul, here is a snippet of the routine.<br>
<br>
------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------<br>
<br>
subroutine usrdat2<br>
<br>
<br>
include 'SIZE'<br>
<br>
include 'TOTAL'<br>
<br>
double precision :: my_array(651)<br>
<br>
integer m<br>
<br>
common /myarray/ my_array<br>
<br>
<br>
parameter (my_array_size=651)<br>
<br>
<br>
real work(my_array_size)<br>
<br>
<br>
<br>
n = my_array_size<br>
<br>
<br>
call rzero(my_array,n)<br>
<br>
call rzero(work,n)<br>
<br>
<br>
if (nid.eq.0) then<br>
<br>
open (unit=49,file='fint41.txt')<br>
<br>
do k = 1,n<br>
<br>
read(49,*) my_array(k)<br>
<br>
enddo<br>
<br>
close(49)<br>
<br>
endif<br>
<br>
<br>
call gop(my_array,work,'+ ',n) ! Sum over all<br>
processors<br>
<br>
<br>
return<br>
<br>
end<br>
<br>
------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>---------------<br>
<br>
- Next I am interpolating this forcing function to the GLL grid<br>
points in the userf routine, by a piecewise linear interpolant,<br>
here's how,<br>
<br>
------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>----------------<br>
<br>
subroutine userf (ix,iy,iz,ieg)<br>
<br>
<br>
include 'SIZE'<br>
<br>
include 'TOTAL'<br>
<br>
include 'NEKUSE'<br>
<br>
EQUIVALENCE (prandtl,param(2))<br>
<br>
<br>
double precision :: my_array(651)<br>
<br>
double precision :: shaped_array(31,21)<br>
<br>
real new_array(nx1,ny1,nz1,nelv)<br>
<br>
double precision :: xin(21),yin(31)<br>
<br>
double precision :: xn(nx1*ny1*nelv),yn(nx1*ny1*ne<wbr>lv)<br>
<br>
double precision :: fo(nx1*ny1*nelv)<br>
<br>
integer i,j,k,l,p,q<br>
<br>
integer e,eg<br>
<br>
common /myarray/ my_array<br>
<br>
<br>
open(16,file='xin.txt')<br>
<br>
do p=1,21<br>
<br>
read(16,*) xin(p)<br>
<br>
end do<br>
<br>
close(16)<br>
<br>
<br>
open(12,file='yin.txt')<br>
<br>
do q=1,31<br>
<br>
read(12,*) yin(q)<br>
<br>
end do<br>
<br>
close(12)<br>
<br>
<br>
shaped_array = reshape(my_array,(/31,21/))<br>
<br>
<br>
do i=1,nx1*ny1*nelv<br>
<br>
xn(i) = xm1(i,1,1,1)<br>
<br>
yn(i) = ym1(i,1,1,1)<br>
<br>
end do<br>
<br>
call<br>
pwl_interp_2d(31,21,yin,xin,sh<wbr>aped_array,nx1*ny1*nelv,yn,xn,<wbr>fo)<br>
<br>
<br>
new_array=reshape(fo,(/nx1,n<wbr>y1,nz1,nelv/))<br>
<br>
<br>
do e=1,nelv<br>
<br>
eg = lglel(e)<br>
<br>
ffx = new_array(ix,iy,iz,eg)<br>
<br>
end do<br>
<br>
<br>
ffy = 0.0<br>
<br>
ffz = 0.0<br>
<br>
<br>
return<br>
<br>
end<br>
<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>---------------<br>
<br>
This is a test domain I made, with 6 elements. It seems to be<br>
working when I am using only 1 core, i.e., in series. In<br>
parallel, it seems to be giving me a different flowfield. My<br>
actual domain has 252 elements which I intend to parallelize<br>
with 48 cores. So would like to ask you how to proceed. I think<br>
I am close but I am slightly confused about part of the code<br>
that I have made red.<br>
<br>
When I am trying this in my actual domain, I get an error,<br>
"Segmentation fault occurred." I think the key here is<br>
parallelization and identifying the elements correctly which I<br>
am not sure I am doing right. Thanks for reading this lengthy<br>
email. Will be eager to hear from you.<br>
<br>
Thanks,<br>
Saikat<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
Nek5000-users mailing list<br></div></div>
<a href="mailto:Nek5000-users@lists.mcs.anl.gov" target="_blank">Nek5000-users@lists.mcs.anl.go<wbr>v</a> <mailto:<a href="mailto:Nek5000-users@lists.mcs.anl.gov" target="_blank">Nek5000-users@lists.mc<wbr>s.anl.gov</a>><br>
<a href="https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users" rel="noreferrer" target="_blank">https://lists.mcs.anl.gov/mail<wbr>man/listinfo/nek5000-users</a><br>
<<a href="https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users" rel="noreferrer" target="_blank">https://lists.mcs.anl.gov/mai<wbr>lman/listinfo/nek5000-users</a>><span><br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
Nek5000-users mailing list<br>
<a href="mailto:Nek5000-users@lists.mcs.anl.gov" target="_blank">Nek5000-users@lists.mcs.anl.go<wbr>v</a><br>
<a href="https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users" rel="noreferrer" target="_blank">https://lists.mcs.anl.gov/mail<wbr>man/listinfo/nek5000-users</a><br>
<br>
</span></blockquote><div class="m_-1597952095376286279HOEnZb"><div class="m_-1597952095376286279h5">
______________________________<wbr>_________________<br>
Nek5000-users mailing list<br>
<a href="mailto:Nek5000-users@lists.mcs.anl.gov" target="_blank">Nek5000-users@lists.mcs.anl.go<wbr>v</a><br>
<a href="https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users" rel="noreferrer" target="_blank">https://lists.mcs.anl.gov/mail<wbr>man/listinfo/nek5000-users</a><br>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>