<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Variable]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=171&amp;type=atom" />
	<updated>2013-03-21T16:57:06Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=171</id>
		<entry>
			<title type="html"><![CDATA[Re: Variable]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=665#p665" />
			<content type="html"><![CDATA[<p>Hi -</p><p>It would help to have more of the code. By that I mean, for example, the declaration -</p><p>real mw(nc), Tc(nc), Pc(nc), mf(nc), AF(nc)</p><p>is puzzling to me. If it occurs in the main program, then &quot;nc&quot; must be a parameter value, but I don&#039;t see it. Or is it dynamic ? If the declaration is in a subroutine, then it would help to see where &quot;nc&quot; is coming from. From what you&#039;ve posted, I cannot trace the sizes of arrays, etc. to see if something is getting clobbered.</p><p>Regards</p>]]></content>
			<author>
				<name><![CDATA[petesun]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=460</uri>
			</author>
			<updated>2013-03-21T16:57:06Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=665#p665</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Variable]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=659#p659" />
			<content type="html"><![CDATA[<p>Nemat,</p><p>One thing I find curious is that after your test:</p><div class="codebox"><pre><code>if(comp(k).eq.com(i))then</code></pre></div><p>you immediately follow it with:</p><div class="codebox"><pre><code>comp(k)=com(i)</code></pre></div><p>Since you already checked if they are equal, this assignment is redundant.&nbsp; Nothing else is jumping out at me at the moment.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2013-03-21T10:31:11Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=659#p659</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Variable]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=653#p653" />
			<content type="html"><![CDATA[<p>Thanks all you guys,</p><p>Actually I have found the problem, but in a very crazy way that you may not believe. I only changed the name of PAF(), PPAF() and ncomp to AF(), AAF() and nc , respectively. That’s it. But, I have found another crazy problem. However, regarding to your questions just let me to explain more about the variables, arrays and the program.</p><p>All&nbsp; com(), comp(),&nbsp; mmw(),&nbsp; TTc(), PPc(), AAF(), mw(), Tc(), Pc(), mf(), AF() are arrays, this is their declaration:</p><p>character(len=15) com(16), comp(nc)<br />real mft, mmw(16), MWg, TTc(16), PPc(16), AAF(16) <br />real mw(nc), Tc(nc), Pc(nc), mf(nc), AF(nc)</p><p>The program has been designed to read some components from a data file, and then compares with the entered ones. If the components are equal the program should pick up the rest of information related to that component and write them in a new file for the rest of program.</p><p>These are the components should be compared.<br />comp(1)=&#039;N2&#039;<br />comp(2)=&#039;CH4&#039;<br />comp(3)=&#039;C2H6&#039;<br />comp(4)=&#039;C3H8&#039;<br />comp(5)=&#039;i-C4H10&#039;<br />comp(6)=&#039;n-C4H10&#039;<br />comp(7)=&#039;i-C5H12&#039;<br />comp(8)=&#039;n-C5H12&#039;<br />comp(9)=&#039;C6H14&#039;<br />comp(10)=&#039;C7+&#039;</p><p>And this is the ‘do loop’ for that execuation.<br />do k=1, nc<br />&nbsp; &nbsp; do i=1, 16<br />&nbsp; &nbsp; &nbsp; &nbsp; if(comp(k).eq.com(i))then<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; comp(k)=com(i)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mw(k)=mmw(i)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MWg=MWg+mf(k)*mw(k)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;!MWg: lbm/lbm.mol<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mft=mft+mf(k)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tc(k)=TTc(i)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pc(k)=PPc(i)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AF(k)=AAF(i)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; write (50, &#039;(A15, A, 5(f15.3,A), f15.3)&#039;) comp(k),&#039;,&#039;,mf(k),&#039;,&#039;,mw(k),&#039;,&#039;,mf(k)*mw(k),&#039;,&#039;,Tc(k),&#039;,&#039;,Pc(k),&#039;,&#039;,AF(k)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(comp(k).eq.&#039;N2&#039;)yn2=mf(k)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(comp(k).eq.&#039;CO2&#039;)yco=mf(k)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(comp(k).eq.&#039;H2S&#039;)yh2s=mf(k)<br />&nbsp; &nbsp; &nbsp; &nbsp; endif<br />&nbsp; &nbsp; enddo<br />enddo</p><p>However, the program do not bring back the component ‘CH4’ and it also bring ‘E=H6’ instead of ‘C2H6’. But, for the rest of components, there is not any problem.</p><p>Therefore, I would appreciate if give me some suggestions regarding this problem.</p><p>Regards,<br />Nemat</p>]]></content>
			<author>
				<name><![CDATA[Curtin183]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3405</uri>
			</author>
			<updated>2013-03-20T03:18:51Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=653#p653</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Variable]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=647#p647" />
			<content type="html"><![CDATA[<p>Please confirm that<br />&nbsp; &nbsp;mw()&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp;Tc()<br />&nbsp; &nbsp;Pc()<br />&nbsp; &nbsp;PPAF()<br />..are array variables, not functions.</p><p>Please tell us which of,<br />&nbsp; &nbsp;com()<br />&nbsp; &nbsp;mmw()<br />&nbsp; &nbsp;mf()&nbsp; &nbsp; <br />&nbsp; &nbsp;TTc()<br />&nbsp; &nbsp;PPc()<br />&nbsp; &nbsp;PAF()<br />&nbsp; &nbsp;comp()<br />..are array variables, and which are functions.</p><p>Please show the type declarations for them all of the above.<br />For those which are functions, please show us the function coding.<br />--- <br />John</p>]]></content>
			<author>
				<name><![CDATA[JohnWasilewski]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=102</uri>
			</author>
			<updated>2013-03-19T11:38:38Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=647#p647</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Variable]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=646#p646" />
			<content type="html"><![CDATA[<p>As the &#039;ncomp&#039; variable is not used inside the loop, it certainly comes from an array which has an &quot;out-of-bounds&quot; problem with its index.</p><p>It is difficult to find in C (except using &#039;valgrind&#039; under linux). Fortunaltely, Fortran good compilers generally gives an option which allow to find the error. In our case (GNU gfortran), add the &#039;-fbounds-check&#039; to the compiler flags : it leads to a run-time error giving you the exact line of your program where the &quot;out-of-bounds&quot; problem occur (assuming you are using the DEBUG mode).</p><p>Regards,<br />Edouard</p>]]></content>
			<author>
				<name><![CDATA[ecanot]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3380</uri>
			</author>
			<updated>2013-03-19T09:53:19Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=646#p646</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Variable]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=645#p645" />
			<content type="html"><![CDATA[<p>Hi Everyone,<br />I am writing some codes, but I have found very strange problem with that. </p><p>On the following &quot;do loop&quot; which is a part of my program, ncomp=10 before the execution of &quot;do loop&quot;. While, the value changes to 1041999331 just after finishing the execution of that, which make a big problem for the rest of program.&nbsp; </p><p>do k=1, ncomp<br />&nbsp; &nbsp; do i=1, 16<br />&nbsp; &nbsp; &nbsp; &nbsp; if(comp(k).eq.com(i))then<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mw(k)=mmw(i)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MWg=MWg+mf(k)*mw(k)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tc(k)=TTc(i)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pc(k)=PPc(i)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PAF(k)=PPAF(i)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(comp(k).eq.&#039;N2&#039;)yn2=mf(k)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(comp(k).eq.&#039;CO2&#039;)yco=mf(k)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(comp(k).eq.&#039;H2S&#039;)yh2s=mf(k)<br />&nbsp; &nbsp; &nbsp; &nbsp; endif<br />&nbsp; &nbsp; enddo<br />enddo </p><p>So, I appreciate if someone could help me to over this problem.</p><p>Regards,<br />Nemat</p>]]></content>
			<author>
				<name><![CDATA[Curtin183]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3405</uri>
			</author>
			<updated>2013-03-19T08:19:51Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=645#p645</id>
		</entry>
</feed>
