Page 1 of 1

Looping problem

Posted: Wed Jul 10, 2019 12:56 pm
by Nadhita.C
Hi all,

I'm modelling the liquid-liquid binary phase diagram for water-butanol. The temperature is input as a loop. The problem I faced is that all the result (x - component composition) for every temperature is exactly the same even though I clear the result (option clear=[variable]) before starting the new temperature calculation. When I excluded the loop from the model and manually change the temperature the result is what I expected.

I attached the loop file (binary05) and no loop file (binary373) where the temperature was input at 373 K.

Any suggestion for the problem?

Re: Looping problem

Posted: Thu Jul 11, 2019 8:00 am
by Renger
Hi
Your change in T is reflected in WW, however, you do not initialize it again in the loop, so you should add this line in the loop

Code: Select all

loop(ttt,
	...
	T=Tnew(ttt);
	WW(mk,k) = exp(-((ap(mk,k)/T)+bp(mk,k)+(cp(mk,k)*T)));
       ....
)

Cheers

Renger

Enjoy modeling even more: The lazy eoconomist