Need help with multivariable iterative loops
- October 11, 2018
- 3 replies
- 3183 views
Hi, I am trying to do this workshop as shown in the attached picture. I am a new user to MathCAD and it needs to be done using MathCAD. It is an iterative calculation to find parameters related to the terminal velocity in a settling equation. In this case, the desired terminal velocity of the particle is known, I am trying to find what the associated diameter D for that velocity would be, given a certain particle density p_subp. Reynolds number is R, Drag coefficient is C, as defined by the equations in the picture. you can rearrange the velocity equation in terms of v or D as desired. The physics part is easy but I am having the following issues.
Since C is a piecewise function based on value of R, I have used if/else statements to determine value. However, MathCAD highlights the inequality Re<1 for C <-- if Re <1 and says "This value must be a scalar" This also comes up for the R<1000, R<200000 terms. Any fix for this?
If that can be fixed, it is part of a while loop I have shown in two alternate ways, either until v converges to a desired v (0.5m/s or I can show as the variable v_terminal), or by convergence of the drag coefficient C, which I have tried to compare to the last iteration via a dummy variable K, within 5% or 0.05. Since C, R, and D are all interdependent, I would appreciate any feedback on how I should set these loops up, or where to state a return v or return C or return D, etc.
This should be done for an range of particle densities from 800 to 8000kg/m3, as stated in the question. Further help on how to set this up as one smooth calc is appreciated. I was thinking of using a 10x1 matrix of arbitrary values 1001,1600....4000,7000,8000 kg/m3 (you will see below why I don't start at 800)
Lastly!!! I need to plot this as a function of particle diameters than be separated as a function of density. Note of course, that since the fluid density is 1000kg/m3, there is no possible diameter that can be separated for particle density of 800-1000kg/m3 range, so I would start the plot at somewhere above 1000kg/m3 where the scale makes sense (or I might have to figure out if Log scale is best to illustrate). Would appreciate any amount of help, ESPECIALLY for the C<-- R<1 error.
Hopefully, I've described the big picture problems. Please let me know if you think you can help within the next few days.
Much Obliged.

