<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — reading data from a file]]></title>
		<link>http://forums.approximatrix.com/viewtopic.php?id=289</link>
		<atom:link href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=289&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in reading data from a file.]]></description>
		<lastBuildDate>Tue, 10 Dec 2013 12:42:50 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: reading data from a file]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1170#p1170</link>
			<description><![CDATA[<p>I think your problem is your choice of unit 5 for your input file.&nbsp; Unit 5 normally refers to standard input, and Simply Fortran&#039;s compiler does not support reassignment of this unit.&nbsp; I would guess that if you change <em>in_unit=21</em> everything should work properly.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Tue, 10 Dec 2013 12:42:50 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1170#p1170</guid>
		</item>
		<item>
			<title><![CDATA[reading data from a file]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=1169#p1169</link>
			<description><![CDATA[<p>I can write to an output file, but i can&#039;t seem to read from a data file:</p><p>program helloworld<br />integer i <br />integer, parameter :: out_unit=20<br />integer, parameter :: in_unit=5</p><br /><p>real m<br />i=1<br />t=0.0<br />x=0.0<br />v=0.0<br />del=.000005<br />a=0.0<br />p0=1.013*10**7<br />patm=1.013*10**6<br />vol0=2.0*10**3<br />area=7.98<br />m=38.6<br />topen=.01<br />open(unit=out_unit,file=&quot;results.txt&quot;,action=&quot;write&quot;,status=&quot;replace&quot;)<br />open(unit=in_unit,file=&quot;data1.txt&quot;,action=&quot;read&quot;)<br />read(in_unit,*),p0<br />read(in_unit,*),vol0<br />read(in_unit,*),m<br />read(in_unit,*),area<br />read(in_unit,*),topen<br />print *, &quot;p0&quot;,p0,&quot; dynes/cm**2&quot;<br />print *, &quot;vol0&quot;,vol0,&quot; cm**3&quot;<br />print *, &quot;mass&quot;,m,&quot; gm&quot;<br />print *, &quot;area&quot;,area,&quot; cm**2&quot;<br />print *, &quot;Time to open valve&quot;,topen,&quot;sec&quot;<br />print *, &quot;&nbsp; &nbsp;Time(sec)&nbsp; &nbsp; &nbsp; &nbsp; Distance (m)&nbsp; &nbsp;Velocity (m/sec)&nbsp; &nbsp; P/P0&quot;<br />20 if (x.lt.100.0) then<br />&nbsp; &nbsp; if (t.lt.topen) then<br />&nbsp; &nbsp; p1=(p0-patm)*( 3.0*(t/topen)**2-2.0*(t/topen)**3)<br />&nbsp; &nbsp; else<br />&nbsp; &nbsp; p1=p0-patm<br />&nbsp; &nbsp; endif<br />&nbsp; &nbsp; p=(p1)*(vol0/(vol0+area*x))<br />&nbsp; &nbsp; a=p*area/m<br />&nbsp; &nbsp; v=v+a*del<br />&nbsp; &nbsp; x=x+v*del<br />&nbsp; &nbsp; i=i+1<br />&nbsp; &nbsp; t=t+del<br />&nbsp; &nbsp; if (i.eq.101) then<br />&nbsp; &nbsp; i=1<br />&nbsp; &nbsp; Print *, t,x/100.0,v/100.0,p/p0<br />&nbsp; &nbsp; write(out_unit,*) t,x/100.0,v/100.0,p/p0<br />&nbsp; &nbsp; endif<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if (i.ne.101) then<br />&nbsp; &nbsp; goto 20<br />&nbsp; &nbsp; <br />&nbsp; &nbsp;endif</p><p>else<br />&nbsp; &nbsp; </p><p>30 print *, &quot;1 meter barrel length reached&quot;<br />print *, &quot;&nbsp; &nbsp;Time (sec)&nbsp; &nbsp; &nbsp; &nbsp; Distance (m)&nbsp; &nbsp;Velocity (m/sec)&nbsp; &nbsp; P/P0&quot;<br />print *, t,x/100.0,v/100.,p/p0,i<br />&nbsp; &nbsp; endif&nbsp; <br /> close(out_unit)<br /> close(in_unit)<br />end program helloworld</p>]]></description>
			<author><![CDATA[null@example.com (maddoccanis)]]></author>
			<pubDate>Tue, 10 Dec 2013 01:05:30 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=1169#p1169</guid>
		</item>
	</channel>
</rss>
