0

I will try to describe my problem, but there are some specific questions in the end.

I am having some trouble solving a turbomachinery problem in Matlab. The goal is to calculate the efficiency of a turbine with known physical measurements and operating conditions. To do this I am using the equations given in a scientific paper: http://www.sciencedirect.com/science/article/pii/S0196890409003124

The problem in my case is that, to know the efficiency I need the exit gas parameters (temperature pressure velocity...) which in turn depend on the efficiency. I primarily solved this problem in a software called EES (engineering equation solver) where equations may be written in what ever order and the program groups them and solves them automatically. I switched to Matlab due to restrictions in the program which wouldn't allow me to expand the problem.

In matlab I started by writing all the equations as a function in a solvable order, except for two exit parameters which are needed to solve the problem. The two exit parameters were set as input to the function. I used two fundamental equations (conservation of mass and the calculated losses) as output where the correct solution would set these equations to zero. I then tried to solve this with fsolve.

This didn't really work out, and I could not find a solution. Now I am instead giving matlab all the equations of the problem (27), and try to solve them in a similar way. This is not working well either. ("No solution found. fsolve stopped because the last step was ineffective").

Among the equations there is some logic and if-statements, and I am also using a fluid parameter library as a com-server in order to get parameters of the gas at varying pressure and temperature. Neither of these allow input from -inf to +inf, and there might also be some discontinuities... and I guess this may be a reason to my problems.

So, I guess this is not the typical programming question. I don't know how much help the code itself would be. If you have any ideas of an approach to this problem it would be of much help! I have some specific questions as well though:

  1. Is it possible to somehow send a parameter to fsolve telling it that some of the equations is out of bounds? (The com-server sends an error message in this case, but I don't know how to use it automatically.)

  2. Is it possible to give a range to fsolve, similar to fzero?

  3. The result-vector from the function, which I am trying to set to a zero-vector has results from very varying equations and therefore values that vary a lot. Error tolerance is very varying as well between the equations. Is there some smart way of dealing with this? I have just divided the result from less exact equations to reduce the value.

sashkello
  • 17,306
  • 24
  • 81
  • 109
  • 3
    This really is not a good question for SO. You have many issues, that really are best dealt with in a consulting mode. And its not really a programming question anyway. –  May 31 '12 at 13:27
  • 1. Yes, discontinuities will kill fsolve. –  May 31 '12 at 13:28
  • 2. No, you cannot give fsolve a range. –  May 31 '12 at 13:28
  • 3. Poor scaling will cause you misery in ANY optimization problem, with virtually any solver. –  May 31 '12 at 13:29
  • 4. And I have no idea what it is you are asking to do when you want to send a message to fsolve that an equation is out of bounds, but you can't really do anything like that with fsolve anyway. –  May 31 '12 at 13:31
  • Thank you for your answer(s). I am mostly asking to see if there may be an alternative approach which I have missed. Is there any way of improving the scaling? My way of dividing feels a bit low-tech. And regarding the error from the com-server, even if the input is out of bounds, I receive an output (8888e3) along with the error message. I guess I could put in some break if this number occurs. – user1428279 May 31 '12 at 14:24

1 Answers1

0
  1. You can write the equations as minimization problem and then add "Soft" punishment for the case you don't want to happen or just use Non Linear Least Squares with constraints.
  2. No, leave fsolve() aside. Use minimization solvers.
  3. Yes. Use Non Linear Least Squares.
Royi
  • 4,640
  • 6
  • 46
  • 64