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

## Need help with multivariable iterative loops  2-Guest

## Need help with multivariable iterative loops

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.

1 ACCEPTED SOLUTION

Accepted Solutions  24-Ruby V
(To:Math1)

One problem are the square brackets around the number 1111 in the definition of p.p. Square brackets create a matrix/vector - in your case a 1x1 matrix and this matrix cannot be compared to a number as you do when you write "if R<1". Hence the error message you show in the picture only.

5 REPLIES 5  24-Ruby III
(To:Math1)

Fest step   23-Emerald I
(To:Math1)

See if the attached file helps, and read up on solve blocks as functions.  File is Prime 4.0 Express.  2-Guest
(To:Fred_Kohlhepp)

Thanks, I appreciate the research you put in. And the Prime 4.0 Express file was able to open on my class computer, which I tihnk is using Prime 4.0  24-Ruby V
(To:Math1)

One problem are the square brackets around the number 1111 in the definition of p.p. Square brackets create a matrix/vector - in your case a 1x1 matrix and this matrix cannot be compared to a number as you do when you write "if R<1". Hence the error message you show in the picture only.  2-Guest
(To:Werner_E)

The brackets were the main problem. Things went more smoothly after this. Thanks a lot. 