Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
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
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