Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
I'll start off by saying I'm new to MathCAD, and I'm pretty sure this is just a matter of discovering the proper syntax.
I am trying to solve a fluid flow problem where the flow splits through two paths, of different lengths and diameters.
My process goes like this:
The problem, I think, is that V2 shows up on multiple "levels" in my pressure drop equations.
If Pd2 is a function of V2, and a function of f2
and f2 is a function of R2
and R2 is a function of V2
How do I write this out? Pd2(V2,f2(R2(V2))):= ...
Do I have to spell out the whole chain every time I refer to f2?
Do insead have to replace f2 in my Pd2 equation with an expression that is only in terms of V2?
I attached the file for an easier read. Currently it doesn't tell me there is an error, which bugs me.
Thanks
Solved! Go to Solution.
You can create functions with arguments that are function names, but it's not what you want to do. Carry the name of the variable of interest through, not chains of function names.
You can create functions with arguments that are function names, but it's not what you want to do. Carry the name of the variable of interest through, not chains of function names.
The function you defined are actually all just dependend of the velocity V2.
If you change that accordingly, a solve block will work OK
See attached.
So I was too late 😉
I hadn't even realized that f1 and f2 would be the same function.
I get to slip one past you ocasionally
Thanks Richard, Werner,
I see that defining everything in terms of V2 solves the problem.
However, I tried to alter my original code, and it doesn't seem to solve.
Is there an issue with conducting the 'given' and 'solve' inside the text box region I have? I made sure they were both in "equation" format when i entered them.
Both of your solutions have the 'given' and 'solve' sections outside the original text box.
A side note, I don't see why f1 and f2 would be the same, since they are solved from different velocities V1 and V2. Regardless, I changed to one equation in the attached file just to match Richard's code example outside my text box, though it comes up with a different answer (zero).
I liked the idea of using one big text box to keep everything straight and in line with each other, but if it keeps me from being able to use some functionality then perhaps I'll deal with the loose equations.
Thanks Again
You are right, f1 and f2 are similar, but they differ as they use different Reynolds. You could use different functions f1 and f2 as in my previous post or (I think a bit more elegant) in the attached file.
Otherwise your solve block in the text box works correctly, so you don't have to put it outside.
EDIT: Ooops, wrong again. f1 and f2 also differ in ID1 vs ID2. The attached file has this corrected now
You are right. They are different. I obviously went throught it too quickly
It solves fine for me.
A side note, I don't see why f1 and f2 would be the same, since they are solved from different velocities V1 and V2.
The V2 used in te function defintion has nothig to do with the variable V2 in the worksheet. It's a formal parameter that shows where the function arguments should be substituted when the function is caled. For example
f(x):=sin(x) + x^2
y:=1.2
Answer:=f(y)
substtutes the value of y into the formula defined by f(x), giving
sin(1.2) +1.2^2
as the answer.
You're right.
It does solve fine.
The exact file I uploaded solves just fine now. I guess I'm going to have to restart MathCAD when I run into some of these issues to see if there is really any problem at all.
Thank you both!