필터 지우기
필터 지우기

How to make goal seek with 3 unknown varible that interconnected each other?

조회 수: 1 (최근 30일)
Hai, i want to search the output of Tb_of and Tb_hf in every iteration, but we just know both of the input value and the input value had a different enter region. to search that value in excel i have 3 stopping criteria, the first one is when absolute value of deltaTb_of is no more than 10^-5, second is when the value of Tb_hf iteration comes to more than input value of Tb_hf, and the third is when the last iteration value of Tb_hf more or less 10^-5 from Tb_hf input value or absolute deltaTB_hf is no more than 10^-5. as far as i wrote the code, i have some problem, the bigger problem is guessing value and iteration of Tb_hf never come to a convergence value so iteration for delta Tb_of and delta Tb_hf never reach the condition.
here is my calculation sheet in excel
and here is my iteration code now
while abs(deltaTb_hf)>=10^-5 %Stopping criterion of calculation
Tb_of_0=Tin_of; %Declare initial bulk temperature of organic fluid is equal to inlet temperature of organic fluid
DB(1,1)=L0; %Record value of initial length
DB(1,3)=Tb_of_0; %Record value of inlet temperature of organic refrigerant
DB(1,7)=(refpropm('H','T',(Tin_of+273.15),'P',pressure.*1000,refrigerant))/1000; %Record value of initial enthalpy of organic fluid
i=1; %Iteration 0
Tb_hf_0= Tb_hf_0+deltaTb_hf; %Iteration for outlet bulk temperature of hot fluid
DB(1,17)=Tb_hf_0; %Record value of outlet temperature of hot fluid
i=2; %Re-declare calculation
Tb_hf_i=Tb_hf_0+deltaTb_hf; %Declare bulk temperature of hot fluid for start column iteration
while Tb_hf_i<=Tin_hf %Column iteration
Lnew=Lnew+Delta_L; %Total Length
deltaTb_of=1; %Starting criteria to enter row iteration
Tb_of_i=DB((i-1),3)+deltaTb_of; %Starting criteria to enter row iteration
if i==2
cp_hf_i=1.8363+(0.00392.*Tb_hf_i)-((1.5.*(10^-6)).*(Tb_hf_i^2)); %Starting heat capacity at constant pressure of hot fluid to enter row iteration
end
while absolute(deltaTb_of) >= 10^-5 %Row iteration
Tb_of_i=Tb_of_i+(deltaTb_of/2); %Correction for bulk temperature of organic fluid
Tf_of_i=273.15+((DB((i-1),3)+Tb_of_i)/2); %Calculate film temperature of organic fluid in a segment in K
h_of_i=(refpropm('H','T',(Tb_of_i+273.15),'P',pressure.*1000,refrigerant))/1000; %Enthalpy of organic fluid in a segment
Qdot_i=mdot_of.*(h_of_i-DB((i-1),7)); %Heat rate generate from organic fluid
Tb_hf_i=Tb_hf_i+(Qdot_i/(cp_hf_i.*mdot_hf)); %Bulk temperature of hot fluid in a segment
Tf_hf_i=(DB((i-1),17)+Tb_hf_i)/2; %Calculate film temperature of hot fluid in a segment in oC
%Physical properties of organic fluid from REFPROP
rho_of_i=refpropm('D','T',Tf_of_i,'P',pressure.*1000,refrigerant); %Density of organic fluid in a segment
k_of_i=refpropm('L','T',Tf_of_i,'P',pressure.*1000,refrigerant).*1000; %Thermal conductivity of organic fluid in a segment
nu_of_i=refpropm('$','T',Tf_of_i,'P',pressure.*1000,refrigerant); %Kinematic viscosity of organic fluid in a segment
Pr_of_i=refpropm('^','T',Tf_of_i,'P',pressure.*1000,refrigerant); %Prandtl number of organic fluid in a segment
%Physiscal properties of hot fluid from formulae
cp_hf_i=1.8363+(0.00392.*Tf_hf_i)-((1.5.*(10^-6)).*(Tf_hf_i^2)); %heat capacity at constant pressure of hot fluid in a segment
rho_hf_i=870.297-(0.684497.*Tf_hf_i)+(5.18441*(10^-5).*(Tf_hf_i^2))-(1.0695.*(10^-6).*(Tf_hf_i^3)); %Density of hot fluid in a segment
k_hf_i=0.1265-(0.000123.*Tf_hf_i)-(9.161.*(10^-8).*(Tf_hf_i^2)); %Thermal conductivity of hot fluid in a segment
nu_hf_i=exp((645.13/(Tf_hf_i+117.8))-2.662); %Kinematic viscosity of hot fluid in a segment
%Calculation for organic fluid parameter
vm_of_i=mdot_of/(rho_of_i.*A_ft); %Mean velocity of organic fluid in a segment
Re_of_i=(vm_of_i.*di.*10^4)/nu_of_i; %Reynold number of organic fluid in a segment
Nu_db_of_i=0.023.*(Re_of_i^0.8).*(Pr_of_i^0.4); %Nusselt number based on Dittus-Boelter of organic fluid in a segment
hc_of_i=(Nu_db_of_i.*k_of_i.*(10^-3))/di; %Heat transfer coefficient of convection of organic fluid in a segment
%Calculation for hot fluid parameter
vm_hf_i=mdot_hf/(A_an.*rho_hf_i); %Mean velocity of hot fluid in a segment
Re_hf_i=(vm_hf_i.*((Di+do)/2)/nu_hf_i).*(10^6); %Reynold number of hot fluid in a segment
alfa_hf_i=(k_hf_i/(rho_hf_i.*cp_hf_i.*(10^3))).*(10^6); %Thermal diffusivity of hot fluid in a segment
Pr_hf_i=nu_hf_i/alfa_hf_i; %Prandtl number of hot fluid in a segment
Nu_db_hf_i=0.023.*(Re_hf_i^0.8).*(Pr_hf_i^0.4); %Nusselt number based on Dittus-Boelter of hot fluid in a segment
hc_hf_i=(Nu_db_hf_i.*k_hf_i)/((Di+do)/2); %Heat transfer coefficient of convection of hot fluid in a segment
%Calculation for heat transfer between both fluids
Ln_T_i=log((DB((i-1),17)-DB((i-1),3))/(Tb_hf_i-Tb_of_i)); %Natural logarithmic bulk temperature in a segment
UAs_i=1/((1/(hc_of_i.*A_si_i))+(1/(hc_hf_i.*A_so_i))+((log(do/di))/(2.*pi.*k.*Delta_L))); %Overall heat transfer coefficient in a cylinder
%Check error
Tb_of_pivot_i=DB((i-1),3)+(Tb_hf_i-DB((i-1),17))+(((10^3).*Qdot_i/UAs_i).*Ln_T_i); %The first guess bulk temeperature of organic fluid in a segment that synchronize with bulk temperature of hot fluid in a segment
deltaTb_of=Tb_of_i-Tb_of_pivot_i; %Convergence check for bulk temperature of organic fluid in a segment
if abs(deltaTb_of) <= 10^-5
%Moving data
DB(i,1)=Lnew; %Length to column 1
DB(i,3)=Tb_of_i; %Bulk temperature of organic fluid to column 3
DB(i,4)=Tf_of_i; %Film temperature of organic fluid to column 4
DB(i,5)=rho_of_i; %Density of organic fluid to column 5
DB(i,6)=nu_of_i; %Kinematic viscosity of organic fluid to column 6
DB(i,7)=h_of_i; %Enthalpy of organic fluid to column 7
DB(i,8)=k_of_i; %Thermal conductivity of organic fluid to column 8
DB(i,9)=Pr_of_i; %Prandtl number of organic fluid to column 9
DB(i,10)=vm_of_i; %Mean temperature of organic fluid to column 10
DB(i,11)=Re_of_i; %Reynold number of organic fluid to column 11
DB(i,12)=Nu_db_of_i; %Nusselt number of organic fluid to column 12
DB(i,13)=hc_of_i; %Heat transfer coefficient of convection of organic fluid to column 13
DB(i,15)=Qdot_i; %Heat rate generate from organic fluid to column 15
DB(i,17)=Tb_hf_i; %Bulk temperature of hot fluid to column 17
DB(i,18)=Tf_hf_i; %Film temperature of hot fluid to column 18
DB(i,19)=cp_hf_i; %Heat capacity of hot fluid to column 19
DB(i,20)=rho_hf_i; %Density of hot fluid to column 20
DB(i,21)=nu_hf_i; %Kinematic viscosity of hot fluid to column 21
DB(i,22)=k_hf_i; %Thermal conductivity of hot fluid to column 22
DB(i,23)=alfa_hf_i; %Thermal diffusivity of hot fluid to column 23
DB(i,24)=Pr_hf_i; %Prandtl number of hot fluid to column 24
DB(i,25)=vm_hf_i; %Mean temperature of hot fluid to column 25
DB(i,26)=Re_hf_i; %Reynold number of hot fluid to column 26
DB(i,27)=Nu_db_hf_i; %Nusselt number of hot fluid to column 27
DB(i,28)=hc_hf_i; %Heat transfer coefficient of convection of hot fluid to column 28
DB(i,30)=UAs_i; %Overall heat transfer coefficient in a cylinder to column 30
DB(i,31)=Ln_T_i; %Natural logarithmic bulk temperature to column 31
DB(i,33)=deltaTb_of; %Error checking in row iteration to column 33
end
end
i=i+1; %New row iteration
Tb_hf_i=DB((i-1),17); %Stopping criteria for column iteration
end
deltaTb_hf=(Tin_hf-Tb_hf_i)/2; %stopping criteria
if abs(deltaTb_hf)>=10^-5
Lnew=0;
end
end

답변 (0개)

카테고리

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

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by