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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

problems with function referring to itself inconsistently

SeñorDesign
1-Newbie

problems with function referring to itself inconsistently

Hello, I am working on my senor design project, and I am trying to solve a system of equations using solve block in MathCAD prime. It contains constraints which refer to functions and known values defined above the block. The system of equations is made of linear species balances and non-linear kinetic and energy balances. I cannot figure out why it won't work. Can anyone help?

Note: I cannot post the file as it would be in breach of the rules regarding the project. But I would be willing to give examples of the types of equations I am using, and how I am using them.

8 REPLIES 8

So, moments after making the last post I noticed a multiplication sign missing before some parentheses. The syntax issues are now solved, but now I am having trouble coming up with guess values which solve the system. Any tips out there?

MikeArmstrong
5-Regular Member
(To:SeñorDesign)

The syntax issues are now solved, but now I am having trouble coming up with guess values which solve the system. Any tips out there?

Can you elaborate or post an example of the problem?

Mike

http://communities.ptc.com/servlet/JiveServlet/showImage/2-149416-2532/bar_anim.gif

This is tough, because I am not allowed to discuss the problem with anyone. However, general questions regarding things such as MathCAD are allowed. So I guess I will refine my previous question. If a solve block is used to solve a system of equations containing 12 unknowns with 10 linear equations and 2 non-linear equations. With one of the non-linear equations being of 3rd order and the other of first order. If this system is properly modeled, and the guesses are in the correct order of magnitude, should MathCAD be able to find a solution?

Or in short, for this system how close does the guess have to be (rough estimates are perfectly fine) for MathCAD prime to solve it?

I apologize for my ambiguity, but I can't think of any examples like this without having a different version of it solved for me.

MikeArmstrong
5-Regular Member
(To:SeñorDesign)

If a solve block is used to solve a system of equations containing 12 unknowns with 10 linear equations and 2 non-linear equations.

Solve blocks require an equation for each unknown, so you would require 12 equations to find 12 unknowns.

and the guesses are in the correct order of magnitude, should MathCAD be able to find a solution?

The guesses can be in any order and Mathcad should be able to find a solution.

Or in short, for this system how close does the guess have to be (rough estimates are perfectly fine) for MathCAD prime to solve it?

Your guesses have to be relatively close - When I say relatively take that as a pinch of salt. I hardly ever think about the guess values unless an error returns. As a check I sometimes use the Minerr function. Minerr differs from Find or Minimize in that, if the chosen algorithm fails to converge, whatever answer found on the last allowable iteration is returned, even if it doesn't meet the convergence criteria. Basically if Minerr doesn't yield a result you know you have set the solve block up wrong.

Mike

http://communities.ptc.com/servlet/JiveServlet/showImage/2-149416-2532/bar_anim.gif

If a solve block is used to solve a system of equations containing 12 unknowns with 10 linear equations and 2 non-linear equations. With one of the non-linear equations being of 3rd order and the other of first order. If this system is properly modeled, and the guesses are in the correct order of magnitude, should MathCAD be able to find a solution?

If the guesses are close enough, and "correct order of magnitude" may not be, and a solution exists, which it may not, Mathcad will find it.

Or in short, for this system how close does the guess have to be (rough estimates are perfectly fine) for MathCAD prime to solve it?

That is totally dependent on the equations. In some cases "close enough" might be a very long way away. Other cases may be pathological, and if the guesses are not very close then you will get either the wrong solution or no solution.

If only two of the equation are non-linear try to create approximations for them that are linear (they only need to be first order approximations, and only in the region of interest). Solve the 12 linear equations, which can be done without guess values (assuming a solution exists), and use the solution as guess values for the solve block.

As Mike suggests, you can also change Find to Minerr. Minerr will return the best solution it can find (in a least squares sense), even if it does not satisfy your equations exactly.

Thanks for the help guys. While I still have not found a reasonable answer, I at least know it isn't a degree of freedom issue now. As the values minerr produces fail to meet many of the constraints imposed on feed values, I think the issue may be in how I calculated my energy balance. Seeing as how this is the only equation I derived myself. And here I was hoping that I would never have to read my thermo book again...

Again, thanks for the help. It is greatly appreciated!

MikeArmstrong
5-Regular Member
(To:SeñorDesign)

It's a shame to leave the thread there.

Thanks for the help guys. While I still have not found a reasonable answer, I at least know it isn't a degree of freedom issue now. As the values minerr produces fail to meet many of the constraints imposed on feed values.

So did find work?

Mike

http://communities.ptc.com/servlet/JiveServlet/showImage/2-149416-2532/bar_anim.gif

No, I couldn't get it to work out. I have discovered, as expected, some flaws in my energy balance equations. I am trying to correct for them now, but it's pretty tough to get accurate thermo calculations without good thermo data which I have found to be hard to find.I am trying to find the Peng Robinson BiP's for brevity and because they define my system well. I am still missing some with those being the most non-ideal combinations. I am hoping that those will solve my convergence problem however.

I am kind of at a loss for what to do now though. I fear that looking for the BiP's might be fruitless, but I don't see a way around it. At least not in a way that allows for me to avoid writing 400 equations which pull the composition variables through the UNIQUAC correlations that I do have access to.

Top Tags