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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

6-Contributor

## Getting error 'This value must be scalar'

Hi

Attached is a calc Im working on. Everything seems OK until I try to enter a value for epsilon/D and then the program keeps popping that it must be a scalar value. Progressively I wish to use the value of Epsilon/D and then calculate Cf. Here also the program keeps saying Cf is not defined. Kindly assist.

Regards

Shastry

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:sshastry)

The reason for the error message is that you have typed square brackets and thus had created 1x1 matrices.

Use normal parentheses throughout!

Not sure what you mean with your second question. Do you want to define a function for C.f dependent on epsilon?

Or are you trying something like this:

21 REPLIES 21
24-Ruby V
(To:sshastry)

The reason for the error message is that you have typed square brackets and thus had created 1x1 matrices.

Use normal parentheses throughout!

Not sure what you mean with your second question. Do you want to define a function for C.f dependent on epsilon?

Or are you trying something like this:

6-Contributor
(To:Werner_E)

Werner,

THank you for your reply. Its very helpful. One question. You have used the solve feature. How do you activate this. I don't see it on the GUI of Prime 4. Whats the meaning of float,6. Why 6? Please enlighten me.

Regards

Shastry.

6-Contributor
(To:sshastry)

Hi

Further to my previous query, I eventually wish to write out an equation for Cf which is dependant on epsilon/D and as epsilon/D keeps varying the program should automatically calculate Cf. How can I achieve this.

Shastry

24-Ruby V
(To:sshastry)

The "solve" command is one of the many symbolic commands. They are not available if you are using the free Prime Express version.

Otherwise you find the symbolics command on the Math ribbon - "Operators and Symbols" - "Symbolics"

The symbolics will give you exact results (1/3 and not 0.3333333333 as an example) but if any number involved contains a decimal point, it switches in some sort of numerical mode with default 20 significant digits.

The "float,6" modifier changes precison to just 6 significant digits. The 6 is an arbitrary number chosen by me and was done just to avoid a long result. But using "float" in numeric calculations can be dangerous as it does not only affect the displayed result but the whole calclulation.

As you are looking for numeric results only, using numeric methods like a solve block with "find" or the "root" command might be the better choice.

Unfortunately its still unclear to me which equation you want to solve finally or in which way Cf is dependent on the ratio epsilon/D. If you give the full details here I am sure we can quickly show you how to setup and define the necessary function.

Its simply done like: Get_Cf(ratio):= 0.39*(1+2*ratio) (assuming that this is the equation)

After that you may evaluate like Cf:=Get_Cf(0.4) to assign Cf the appropriate value for ratio eps/D=0,4.

Of course you can name the function anything you like and the argument must not be "ratio" but can be a varible name looking similar to "epsilon/D".

Look at the attached Prime 4 sheet for an example

6-Contributor
(To:Werner_E)

6-Contributor
(To:Werner_E)

Werner

I have prime 4. So I have the symbolics feature. However, when I click on the arrow it doesn't quite come out the way you have used it. Don't know why.

I want to manually read off e/D from a graph in a book and then feed it into the equation to arrive at Cf. e/d therefore needs to be defined as a variable. Even if I don't define it as a variable and Im prepared for a work around wherein I manually go and type it in the program keeps telling me that Cf is undefined when I try to use the solve function. My file is attached.

Shastry

24-Ruby V
(To:sshastry)

Is it this what you are looking for?

Prime 4 file attached

EDIT: Maybe you are not aware of that to input an equation you have to use the big fat boolean equal sign. YOu can get it somewhere from the menu (Operators - Comparison) or by the keyboard shortcut "Ctrl =" (or "Ctrl +" on my German keyboard).

23-Emerald I
(To:Werner_E)

Since I'm retired, with a lot of time on my hands I looked up IS 875 part 3.  I'm not sure I've found the latest version, but this problem (like the very similar pipe flow friction factor) isn't this simple.

Cf is going to be a function of e/D and Reynolds Number.  Or, given the range of Reynolds Numbers calculated and the assumed epsilon/D Cf either becomes a constant or a function of Reynolds Number:

6-Contributor
(To:Fred_Kohlhepp)

Hi

Yes it is fairly simple as humans. But my knowledge of Mathcad is limited and so its taking time for me to understand. Your extract from the code is correct. The latest version (which is attached) also has the same chart. Im finding it difficult to get the program to understand epsilon/D as a variable.

23-Emerald I
(To:sshastry)

@sshastry wrote:

Hi

Yes it is fairly simple as humans. But my knowledge of Mathcad is limited and so its taking time for me to understand. Your extract from the code is correct. The latest version (which is attached) also has the same chart. Im finding it difficult to get the program to understand epsilon/D as a variable.

The easiest way would be to write Cf as a function of two variables:

23-Emerald III
(To:sshastry)

Since it is not common practice to have a variable with a name containing an operator, it is not easy to define such a variable. But it can be done:

Success!

Luc

6-Contributor
(To:Werner_E)

Hi

I have an issue with units in this model. THe extract from the code is also attached. THe value of pz and therefore pd should be in N/sq.m. However the program insists that this should be in m^2/s^2. Why? How do I correct this. Please help.

Sriprakash

6-Contributor
(To:sshastry)

Hi

My Mathcad file is also attached.

SP

23-Emerald III
(To:sshastry)

Simple.

Your pd is a multiplication of Ka, Kc, Kd and pz.

pz has unit m^2/s^2.

All K's have (value and) unit 1, the result of multiplication necessarily has the same unit as pz, m^2/s^2.

So how did pz get a unit of m^2/s^2 ? It's because it is a multiplication of a velocity squared and a constant (0.6, no units!). Velocity squared is m^2/s^2. Mathcad Prime works with units, but only (fortunately) exactly as you tell it to. If you want correct units in your results, you HAVE to apply correct units to your input.

I don't have the ISO at hand, but suspect that the cause might be with that value of 0.6.

Read this https://www.hearne.software/getattachment/78c6fe25-a1d8-4448-8b62-378a01a353f4/Examples-Tutorials-3-Is-a-Magic-Number.aspx carefully and use it's advice to get better doumented calculations.

Success!
Luc

6-Contributor
(To:LucMeekes)

Luc

I tried meddling with the units, by multiplying the equation with 1 N* s^4/m^5. By doing this I got close to what I want. However, why does it still show kg per sq.m instead of N/sq.m. Any idea?

Regards

Shastry

23-Emerald III
(To:sshastry)

You should not 'meddle with the units' but ONLY apply the correct units to all your variables and constants.

In your case: the unit of 0.6 (mass density of air) should be kg/m^3 (according to IS 875). If you follow up the recommendations of the article I suggested you to read, you could define a constant d.air:=0.6 kg/m^3 (for the thin Indian air) and put that in the formula for pz instead of (just) 0.6. That should give you the correct unit for pz.

Success!
Luc

6-Contributor
(To:Werner_E)

Hi

I have modified this file based on the various inputs obtained on this forum. Now that I have almost come to the end of the calc, I want to write a step wherein I wish to state that if the value of Cf is less than 0.5 then the Cf should be equal to 0.5 and if it is greater than 0.5 then the greater value can be used as it is. How do I write such a command. My file is attached.

23-Emerald III
(To:sshastry)

Quite simple, with a statement like:

Cf := if(Cf<0.5 , 0.5 , Cf)

The function if(<condition>,<result if TRUE>, <result if FALSE>) is a standard function in Prime.

Note that if Cf is a vector, you may have to vectorize the expression. (Look up the vectorization operator in the operators panel, its the one on the bottom-right.)

Attached is a Prime4 file

Success!
Luc

24-Ruby V
(To:sshastry)

An alternative to Lucs suggestion is using the  "max" function.

You may follow the calculation of cf by

cf:=max(cf, 0.5)

23-Emerald III
(To:sshastry)

As Werner explained, square brackets are used for vectors.

You can make your calculation more compact and less error prone (not needing to retype every calculation for each element) by using vectors.

Prime knows units. Where possible (in this case it is), make use of that.

{Note that using units on z.0.3 will run you into trouble, because a unit other than 1, to the power 0.0706 is something Prime cannot deal with.}

Prime 4 sheet attached.

Success!
Luc

6-Contributor
(To:LucMeekes)

Hi

Many thanks for your assistance and enlightening me on the features that I can use to simplify my calculations.

Sriprakash

Announcements
Top Tags