How can I solve my iteration problem

8 visualizaciones (últimos 30 días)
Caner
Caner el 9 de Ag. de 2014
Respondida: Yifeng Tang el 16 de Jun. de 2022
Hello everybody,
I have an m-file that calculates pressure drop and enthalpy profile along the capillary tube. Capillary tube is not adiabatic, I considered cap tube - suction line heat exchanger. Code uses finite-volume-method. Code calls refpropm function simultaneously to gain refrigerant state values. I know the inlet condtions and calculate outlet conditions of control volume and goes on.
Mainly, I have 2 equations that gives pressure drop and enthalpy change for every control volume. Outlet specific volume is common unknown of those equations. So, here is my iteration:
-- I guess i+1. specific volume -- Calculate pressure drop and enthalpy change, then find i+1. pressure and enthalpy -- Call refpropm function and take the specific volume according to calculated i+1. pressure and enthalpy -- Check the specific volume that is guessed and taken from refprop -- give a tolerance, 1e-7 etc. -- if the difference of guessed and taken values is lower than tolerance, exit the iteration and go for next control volume -- if convergence didnt catch, set specific volume to the one before and continue iteration.
It looks simple but at one point, pressure drop goes to infinity. It is not an unknown situation, actually. If the flow chokes, pressure drop goes to infinity. But this is not the same case. My iteration goes crazy literally. Iteration works for many cells. For example 14000 control volume. But after that it doesnt converge. I looked at refrigerant state properties to check if there is a critical state of refrigerant but it looks the error is about calculation, I mean mathematical problem not a physical property problem.
Is there any suggestion? I spent too much time and couldnt solve the problem. This is the only obstacle that effects my calculation.
Thanks in advance,
  2 comentarios
Caner
Caner el 9 de Ag. de 2014
Editada: Caner el 9 de Ag. de 2014
vh_l(i+1) = vh_l(i);
amax = 1e+6;
for a = 1:amax
ent_c(i+1)=ent_c(i)-(G_c^2*((vh_l(i+1))^2-(vh_l(i))^2))/2;
delta_P(i)=-delta_z*f_tp(i)*G_c^2*vh_l(i)/(2*d_c)-G_c^2*(vh_l(i+1)-vh_l(i));
P_c(i+1) = P_c(i) + delta_P(i)*10^-3;
if P_c(i+1)<P_s
break
end
D_l_y(i+1)=refpropm('D','P',P_c(i+1),'H',ent_c(i+1),'isobutan');
vh_l_y(i+1)=1/D_l_y(i+1);
if abs(vh_l_y(i+1)-vh_l(i+1))<(1e-14)
vh_l(i+1)=vh_l_y(i+1);
break
else
vh_l(i+1)=vh_l_y(i+1);
continue
end
end

Iniciar sesión para comentar.

Respuestas (1)

Yifeng Tang
Yifeng Tang el 16 de Jun. de 2022
By galancing the equations you have in the iteration, looks like this is a highly nonlinear problem. The simple "replacement" iteration strategy (the line before "break") may not be numerically efficient or effective at all. Consider trying a gradient-based approach (https://en.wikipedia.org/wiki/Gradient_descent).

Categorías

Más información sobre Fluid Dynamics 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