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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Iteration process issues

TW_9638511
5-Regular Member

Iteration process issues

Dear mathcad'ers,

 

I really need help.

 

I am trying to make an iteration process for an airlift reactor. The iteration procedure can be found in the word document, together with the mathcad file, below. However, I Mathcad isn't able to find the previous value of an parameter. How can I solve this?

 

Thanks for your expertise and help.

 

Tim

2 REPLIES 2
ppal
17-Peridot
(To:TW_9638511)

muser_0-1637703522182.png

 

LucMeekes
23-Emerald III
(To:TW_9638511)

Your iteration goes from i:=0 to 3000. Only if i==0 (really IS zero), do you set values for vector elements of H.L, r.B, d.B etc.

So only r.B[0 is defined....

When i==1 it's not a problem, because r.b[i-1 = r.B[0 and that one is defined.

But the next round, when i==2, your routine tries to access r.B[1 which was never set. Prime doesn't like that.

 

I guess you're not done with implementing the iteration, considering there's a lot of empty space in the program below the assignment of P.B[i

Implementing that may remedy the situation; I guess you'll want to add an assignment to r.B[i in the Else section....

 

Other advice:

I would put all the initial assignments (those in the 'if i=0' section) to above the the For loop. Then you have to change the i's to 0's, or the very first assignment is: i<-0. Now you can let the for loop start at 1 (not at 0) and don't need the if statement.

I see you are using units, but keep them separate from your values. Prime can actually work with units tied to variables, but you have to use them consequently then. This may cause challenges if your equations are not physically based, but empirical where units may not balance.

There's a value 9.81 in one of the expressions. Note that g is a predefined constant (with units) and you can use it.

Type on an empty spot

g=

and you'll see what happens.

 

Success!
Luc

 

Top Tags