필터 지우기
필터 지우기

How can I solve my iteration problem

조회 수: 3 (최근 30일)
Caner
Caner 2014년 8월 9일
답변: Yifeng Tang 2022년 6월 16일
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
Caner
Caner 2014년 8월 9일
편집: Caner 2014년 8월 9일
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

댓글을 달려면 로그인하십시오.

답변 (1개)

Yifeng Tang
Yifeng Tang 2022년 6월 16일
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).

카테고리

Help CenterFile Exchange에서 Fluid Dynamics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by