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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Issue with While loop

DJF
16-Pearl
16-Pearl

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!

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:DJF)

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
LucMeekes
23-Emerald III
(To:DJF)

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

Werner_E
25-Diamond I
(To:DJF)

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

DJF
16-Pearl
16-Pearl
(To:Werner_E)

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.

Announcements

Top Tags