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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

MathCad is solving incorrectly?

NovaStark
3-Visitor

MathCad is solving incorrectly?

I am re-creating the appendix C of calculations to size a flare system, however I can't seem to get MathCad to correctly solve for my variable. I've swapped out units and values but I still don't get the correct answer.

I have uploaded the output from MathCad

However, the answer I am supposed to get is d=0.468 m. Not too sure how to make mathcad only give me the positive answer though.

1 ACCEPTED SOLUTION

Accepted Solutions

As Valery already pointed out that formula in your Appendix is not quite clean concerning units. The example given there is calculated dimensionless, as Valery has done.

I would correct the fact, that Ma2 has no unit by assigning the constant 3.23*10^(-5) the appropriate unit. I'm not sure about units of Z and esp. M !??

The reason you are not getting the answer you expect is, that qm and P2 are not using basic SI units. You may compensate by multiplying qm by 3600 (kg/s --> kg/hr) and dividing P2 through 1000 (Pa --> kPa). That way you have at a formula with a constant of 116.28 you may use with data of any units (as long as your worksheets units are set to SI units in preferences).

To get only the positive solution you would normally use the modifier "assume, d>0", but the symbolic engine does not know anything about units at all. Thats the reason you see kPa, m etc. in the symbolic result - the symbolic engine sees them as unknown variables. Because of that I had to use "assume, ALL>0" to make it work.

Hope it helps.

Flare1.png

BTW, is there a specific reason you are appending the literal subscript point to the names of all variables which do not use subscripts ("Z." instead of "Z", etc.)?

View solution in original post

32 REPLIES 32

Sorry, we need the Mathcad sheet not only the picture!

nas0k
7-Bedrock
(To:NovaStark)

Are you missing DEL H in your calculation? You have it defined but not used.

Norm

I think you are using dimensional variables in an equation that already has a conversion unit.

See the attached.

Message was edited by: Harvey Hensley, corrected the formula but the results are as before

In the worksheet I attached in the reply above, I stated that k=1.4 for ideal gas. I should have said that k=1.4 for diatomic gas.

However, it appears that the problem has assumed k=1.

Please note that if you use the basic equation, not an equation that has assumed certain units and has hidden the gas law constant, you will get the correct answer.

What I see is a correct Mathcdad evaluation.

Why do expect somoethings else?

You will get better response if you attach the worksheet. You don't expect us to type in all that values, don't you?

I am re-creating the appendix C

????????? appendix of WHAT?

However, the answer I am supposed to get is d=0.468 m.

Sure not with the formula you have typed in the screensot, check it against the books

Not too sure how to make mathcad only give me the positive answer though.

What do you mean by that? You have neither used a solve block nor the symbolic solve. You have typed in the vector which gives you the negative result as one of its two elements yourself!?

Ah sorry there, I was in a hurry and thought I was doing something wrong that could be easily seen from a screencap.

I was using API-521 for flare sizing calculation and using the values they gave. I attached the page in question.

I was not too sure how to correct the fact that Ma2 would have no units as it is mach number so I thought I'd have to multiply by the other units I inputted.

I will look more into the symbolic solve and solve block things, I only have a sort of basic understanding of mathcad. Essentially what I'd normally do it solve it as I did and then just copy the formula. I was not sure if there was a way to solve for 'd' such it would only give the positive value and not show the vector with the two solutions.

I hope it help you - see please the picture and download the attached sheet.

Flare Sizing Calculation.png

I apologize for seeming a bit dense here, but in order for me to get the correct output of 468 mm, I need to make every unit in the formula dimensionless? Shouldn't the formula already have its units corrected in this case?

And the relatative molecular mass would not be dimensionless as I would assume it is calculating the ratio of the molecular mass of the fluid divided some standard molecular mass of some fluid?

Even if the units I used are not in the exact SI units but in derived SI units, does mathcad automatically convert everything to the same base set of units or does it just calculate given the parameters and whatever units they are in?

Garrett,

A formula such as you have used has assumed a certain set of units, not always a set that is true to a standard such as SI. Therefore, the writeup should also define what units are to be used with each variable. So when the formula calls for a length, for example, in inches, you must supply the number of inches. If you have defined the length, L, with units, say SI units, then to get the length in the value of inches, you divide by the unit you wish, L/in. The result is now dimensionless (i.e. has no unit attached), and it is the correct number to use for the formula. This is the procedure that Valery used.

So to answer one of your questions, yes Mathcad converts everything to the base set of units that it has been told to use or to SI by default if you haven't switched the base units. Even though you may have defined the variable in the correct units for the formula, Mathcad converts it to the base unit. In the example I used above, L would be in m for SI set. If you put just L in the formula, the answer would not be correct.

Regarding the relative molecular mass, it appears that it really means the molecular weight of the gas, not a ratio of molecular weights to a standard gas. I say that because everything works fine if M is assigned a unit of gm/mol.

Formulas such as the one you are using were developed to make things easier for the user by combining conversion constants into one constant. I don't like them because as this example shows, they may have also used simplifying assumptions. When you see a formula such as this, it would be a good idea to check it with a more basic derivation such as the one I presented earlier. You will also understand the fundamental physics or engineering much better.

In the worksheet I provided earlier, I left out Z because it was 1. To be correct, the formula should be as shown below:

relief.png

Thanks, Harvey, for the excellent explanation.

I think it will be very good to write an article and put it here and in some journal about the topic - What it is physical, empirical and pseudo empirical formulas and how we can work with it in Mathcad with units.

Let do it! I have a lot of examples!

I think we just did, and it will probably be difficult to find a journal that will publish an article of this nature. If you can find a jounal, go for it!

Garrett Ramjattan wrote:

I was using API-521 for flare sizing calculation and using the values they gave.

Send please this picture to authors of API 521Pressure Relieving and Depressuring

SiUnits.png

They authors are confused, and other confused!

Now for example we have not same problems in the The International Association for the Properties of Water and Steam (http://www.iapws.org/)

We publish not only a pdf document (formulations) but Mathcad sheet too

See please one example - http://www.iapws.org/relguide/ThCond.htm

And I believe that I am using the latest version of that code.

SiUnits.png

As Valery already pointed out that formula in your Appendix is not quite clean concerning units. The example given there is calculated dimensionless, as Valery has done.

I would correct the fact, that Ma2 has no unit by assigning the constant 3.23*10^(-5) the appropriate unit. I'm not sure about units of Z and esp. M !??

The reason you are not getting the answer you expect is, that qm and P2 are not using basic SI units. You may compensate by multiplying qm by 3600 (kg/s --> kg/hr) and dividing P2 through 1000 (Pa --> kPa). That way you have at a formula with a constant of 116.28 you may use with data of any units (as long as your worksheets units are set to SI units in preferences).

To get only the positive solution you would normally use the modifier "assume, d>0", but the symbolic engine does not know anything about units at all. Thats the reason you see kPa, m etc. in the symbolic result - the symbolic engine sees them as unknown variables. Because of that I had to use "assume, ALL>0" to make it work.

Hope it helps.

Flare1.png

BTW, is there a specific reason you are appending the literal subscript point to the names of all variables which do not use subscripts ("Z." instead of "Z", etc.)?

Do you know that Ma (Mach Number) and Z (compress. factor) are not dimensionless values!

In Mathcad MM and in Mathcad Prime Minister Ma + Z= error message. As Re + Nu = error message, e+pi = error message etc

Valery Ochkov schrieb:

Do you know that Ma (Mach Number) and Z (compress. factor) are not dimensionless values!

No, but I was suspicious, as I had written I am not sure about the units of the two.

I guess Harvey had put it right for us though and according to him Z seems to be dimensionless.

Ma has unit (m/s)/(m/s) (velocity1/velocity2) nad we cannot simplify it to 1.

Othes example.

Thermal conductivity has unit (W m) / (m^2 K) and we can not simplify it to W/(m K)!

But this is very Debatable!

Looks like I am missing the point 😞

But this is very Debatable!

That could be the reason for 😉

Werner Exinger wrote:

As Valery already pointed out that formula in your Appendix is not quite clean concerning units. The example given there is calculated dimensionless, as Valery has done.

I would correct the fact, that Ma2 has no unit by assigning the constant 3.23*10^(-5) the appropriate unit. I'm not sure about units of Z and esp. M !??

From what I've read Z and M are to have no units.

Werner Exinger wrote:

The reason you are not getting the answer you expect is, that qm and P2 are not using basic SI units. You may compensate by multiplying qm by 3600 (kg/s --> kg/hr) and dividing P2 through 1000 (Pa --> kPa). That way you have at a formula with a constant of 116.28 you may use with data of any units (as long as your worksheets units are set to SI units in preferences).

It is already set as SI units. Ah so my error was the 3.23e-5 factor should actually be 116.28 (and whatever units). Then for any similar formula in the rest of the calculation, I will need to correct their factors.

Werner Exinger wrote:

To get only the positive solution you would normally use the modifier "assume, d>0", but the symbolic engine does not know anything about units at all. Thats the reason you see kPa, m etc. in the symbolic result - the symbolic engine sees them as unknown variables. Because of that I had to use "assume, ALL>0" to make it work.

Thanks man, it might be easier for me to just copy the formulas as if I put those things in my reports, my supervisors will not understand what all that is.

Werner Exinger wrote:

BTW, is there a specific reason you are appending the literal subscript point to the names of all variables which do not use subscripts ("Z." instead of "Z", etc.)?

Force of habt, in MatchCad 14, I might use K as a variable and end up getting an error without realizing that MathCad has K as a predefined unit. So by defaukt whenever I input any variable I put the subscript '.' so that I can run through the typing quicker than have to go back and correct/change the variables.

You should read Harveys explanations and look at the worksheet he posted earlier. I think he solved "the puzzle" and provided an excellent explanation.

The adding of those units to the constant were not satisfactory anyway.

According to the keywords for solve - you can hide the keywords and/or even can hide the LHS of those symbolic evaluations and if you prefer you can let the arrow and/or assignment operator appear as equal sign. Maybe thats adequate. Otherwise you loose the dynamic and changes of values at the top are not reflected by the results after the static evaluation.

Thank you all. This was quite an eye opener! Seems I will need to understand these formulas a bit more before inputting them into MathCad. They will work if doing it by hand surely, but may require some modification wrt units in MathCad.

Also now agrees that for relative molecular mass , they meant molecular mass as they later calculaed vapor volume flow rate as:

q = (45360/3600)(22.4/46.1)(422/273) = 9.46 m^3/s

and I believe the 22.4 is the value for volume at STP, of 22.4 m^3/kmole

Garrett Ramjattan wrote:

Thank you all.

and I believe the 22.4 is the value for volume at STP, of 22.4 m^3/kmole

You welcome!

22.4 is L/mole - one mole of an ideal gas need 22.4 liter - I remember it from school

Garrett,

Some experimentation with simple variables regarding units would probably help you too. One good way to experiment is by defining new units. Please see the attached file for an example.

We've all been through this, so forge on. It's worth it in the end!

Thanks man, I'll check it out.

Garrett,

I feel that Harvey gave the right answer, not me!

Well both of you gave me correct answers, I just chose yours because of the unit conversion factor thing as that corrected the result immediately. Harvey also did resolve my problem but in a different manner.

(side note: this reply system is a bit confusing at times!)

Garrett Ramjattan wrote:

Well both of you gave me correct answers...

One joke

Khwaja friend came to consult him about the case. He told him everything and at the end said, "Well? Am I wrong?" Hodge said: "You are right, my friend, you are right." The next day, who knew nothing about it as the enemy came to Hodge. And he also, wanting to determine what will end litigation, told him the case, of course, biased, in the light of its own advantage. "Well, Hodge, what would you say? Am I not right?" - He asked Hodja. And he Hodja answered, "Sure, sure, you're right."

Hodja's wife accidentally listened to his conversation with the litigants, and seeing that Khoja said both right, it planned to embarrass him and said: "Effendi, yesterday was at your neighbor Korkut, he explained to you the business, you tell him that he was right. Then came Sanjar his opponent, you and told him that he was right. How? Kazi you and I for so many years, his wife Kazi. Would be right at the same time and the plaintiff and the defendant? "Hodge said quietly, "Yes, it is, my wife, and you are also right.

I know this is probably "beating a dead horse" but I would like to point out the differences between the three methods given. My motivation has nothing to do with who is right and who gets credit.

The method Werner provided developed a new conversion constant that is specific to the SI system, as he said. If a user changes the base system, then a new constant will be needed. Coming up with new constants increases the chance of error and makes the worksheet less universal.

The methods Valery and I used will work regardless of the base units. Valery's method (dividing each variable by the specified unit) is the best way to conform to the original equation. Also, this is the best way to use empirical equations which could be using a mixture of unit systems. This method means that the constants in the equation do not need changing. That could be desirable if you have to show adherence to a code.

My approach (showing the fundamental equation), is useful if you desire to show the the full equation with all constants and variables (e.g. Rg, k). However, it too could increase the chance of error if you don't "get it right". In your case, we had a known answer for checking the result.

In the long run, Valery's method is best for quick use of a published equation. If you are developing a procedure which would benefit from full explanation of all equations, then converting the equation to the fundamental form would be a better choice. In the case in question, this approach also made the equation more general by not assuming k=1.

Top Tags