Program not calculating correct value in output file

12 visualizaciones (últimos 30 días)
Joseph Edelman
Joseph Edelman el 22 de Jun. de 2020
Comentada: Mhd Jam el 23 de En. de 2021
I have a written script designed to calculate flow distribution in a 3-loop pipe network using the Hardy-cross method. In the output file I've created, the correction factors for each loop correctly converge to zero after a certain amount of iterations, and the flow distributions appear to be very close to the true values; however, the absolute maximum difference in flow rate from one iteration to the next appears to be incorrect. The maximum difference from one iteration to the next should approach zero, just as the correction factors are, yet instead the maximum difference appears to converge to approximately 2.29. This doesn't make sense, since one can observe in the output file that at the final iterations the maximum difference should be much smaller than what is displayed. I've looked over the code extensively, and can't seem to figure out where I've made an error. Any help would be greatly appreciated. Below I've attached a photo of a portion of the output file, as well as the program itself.
  1 comentario
Mhd Jam
Mhd Jam el 23 de En. de 2021
Dear Joseph,
Could you solve the issue? if so, would you please share it with us?
Thank you!

Iniciar sesión para comentar.

Respuestas (1)

Robert U
Robert U el 22 de Jun. de 2020
Hi Joseph Edelman,
it seems as if line 52 produces complex numbers for HF. In consequence the values of DELQ are complex as well while you only write the real part. Therefore, you do not compare values of same types. My first guess would be you have to rethink brackets. The operator precedence might not work as you intend it.
Kind regards,
Robert
  1 comentario
Joseph Edelman
Joseph Edelman el 22 de Jun. de 2020
Thank you for the help! I'll see if I can do something about that.

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by