<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" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p></p>
<p>Dear Neks,</p>
<p><br>
</p>
<p>I am post processing my data using the subroutine "hpts" to extract field values at specific points.</p>
<p>I want to loop over many files and extract the field values for each file.</p>
<p>Therefore I want to rename the file "hpts.out" that is created everytime I call hpts.<br>
</p>
<p>This code snippet is in userchk, and is looks like this:<br>
</p>
<div>
<div> <br>
</div>
<div> do i=1,100<br>
<br>
write(fname,'(I0.5)') i<br>
fname='cav0.f'//trim(fname)<br>
<br>
call load_fld(fname)<br>
<br>
call hpts<br>
<br>
call nekgsync<br>
if(nid==0)then<br>
call rename('hpts.out',trim(fname)//'_hpts')<br>
endif<br>
call nekgsync<br>
<br>
enddo</div>
<div><br>
</div>
<div>My basename is "cav", so fname is "cav0.f00XXX" for XXX = 1, ..., 100.</div>
<div>The code is intended to rename hpts.out for a file <span>"cav0.f00XXX</span>" into<span> "cav0.f00XXX</span>_hpts".</div>
<div><br>
</div>
<div>However, this does not work.</div>
<div>I get only one file; "cav0.f00001_hpts".</div>
<div>When I open this file it contains the data from "cav0.f000100 - the last file that was opened in the loop!</div>
<div><br>
</div>
<div>This makes me wonder if hpts.out is properly closed after beeing written to?<br>
</div>
<div>And also, how can I change my code to make it work as I indended?</div>
<div><br>
</div>
<div>Best,</div>
<div><br>
</div>
<div>Johan<br>
</div>
<div><br>
<br>
</div>
<br>
</div>
<br>
<p></p>
</div>
</body>
</html>