cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with While loop

SOLVED
Highlighted
DJF
Alexandrite

Issue with While loop

I'm probably doing something silly, but I can't seem to find it.  I set up a while loop but it always finishes on the 2nd iteration, when I know fully well it hasn't converged.  Prime 4.0 attached.

2019-02-10_11-43-11.jpg

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Issue with While loop

As you can see in the attached Screenshot, the values after the first and second iteration are identical, so the iteration stops as demanded.

But after further iterations the two matrices differ again.

You may want to check the initial values of matrix P

View solution in original post

3 REPLIES 3

Re: Issue with While loop

I suppose Mdiv and Ndiv are properly defined...

 

Why do you keep summing the error in the inner loop? I should assume it would suffice to assign just abs to Error, not to add it.

 

Check your labels! You have two 'Error's, one is a 'variable', the other is an 'automatic'.

 

Success!
Luc

Re: Issue with While loop

As you can see in the attached Screenshot, the values after the first and second iteration are identical, so the iteration stops as demanded.

But after further iterations the two matrices differ again.

You may want to check the initial values of matrix P

View solution in original post

Re: Issue with While loop

Yep, that's it.  Eta doesn't change the first time through since it's using old temperatures.  So the next pressure calculation doesn't change.  

 

Just need to move the eta calculation down in the list and she works.  

 

Thanks.