How can I improve convergence for my complex mathematical model?

  • Context: Graduate 
  • Thread starter Thread starter Redhunter
  • Start date Start date
  • Tags Tags
    Algorithm Convergence
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 2K views
Redhunter
Messages
2
Reaction score
0
I have a complex mathematical model (about 2000 lines of code) which calculates heat exchanger performance.
Using Q=UxAxLMTD I want to iterate the entering temperature until I find that the installed surface satisfies a target duty.

At present I
1 guess an entering temperature and from the duty calculate the leaving and mean temperature.
2 Calculate various fluid properties, Reynolds No, Prandtl No etc and so a U-value
3 Using the target duty, I calculate the required surface
4 I compare the required surface with the actual surface and make a correction factor
ie k x ((Required-Actual)/Actual)
where k is say 0.25
5 New entering temperature = previous entering temp x (1- correction)

after playing about with k I generally get convergence at between 5 and 40 iterations but sometimes I get oscillation about the solution.

The books I have seem to use first and second order derivatives but my process is too complex for that. Any simple solutions?
 
Physics news on Phys.org
If you get oscillations about the solution, and they take a long time to settle, simply averaging 2 successive iterations should make things converge faster.

For a more rigorous approach, be aware that numerical solutions tend to converge (approximately) geometrically to the answer. (This is true whether they oscillate about or approach exponentially the final answer.) You can use that fact and 3 successive iterations to "accelerate" the convergence:

Let x1, x2, and x3 be 3 successive iterations, and let xx be the actual solution. Since the iterations converge approximately geometrically:

(x2-xx)/(x1-xx) ≈ (x3-xx)/(x2-xx)

I.e., the error decreases by the same ratio with each iteration. Solving the above for xx gives

xx = (x1 x3 - x22) / (x1 - 2x2 + x3)

This, of course, is an approximation to the actual value, but it will be much closer than x1, x2, and x3 are.

Next, you can do another 3 iterations starting with xx, and repeat the process as needed.
 
I can see your logic but this does not seem to work. Supposing sucessive iterations were x1=99, x2=100, x3=101 then xx = -1/0

I also tried with some actual data. My first three iterations were 799,717,642 using my current method it converges at 577. The formula gives xx as -198 as these are duty in Kw a negative estimate is nonsense and could not be processed.
 
Redhunter said:
I can see your logic but this does not seem to work. Supposing sucessive iterations were x1=99, x2=100, x3=101 then xx = -1/0

I also tried with some actual data. My first three iterations were 799,717,642 using my current method it converges at 577. The formula gives xx as -198 as these are duty in Kw a negative estimate is nonsense and could not be processed.

Yes, I've found you do have to get more "in the neighborhood" of the answer before the geometric approximation is valid. Clearly this is not the case for the 99,100,101 example since the output is changing by the same amount each time.

How does the geometric formula do when your iterations get below 600 in your example? Or when they oscillate as you mentioned they sometimes do in Post #1?

Another comment: you mentioned a method using derivatives, but your process is too complicated to compute them. Could you estimate them numerically, i.e. change the input parameter by a small amount to estimate the derivative?

Regards,

Mark