clear;
clc;
format long g;
L = 0.6;
W = 0.6;
A = L*W;
d = 0.032;
rho = 1.225;
u = 5;
Ambient_Temp = 30;
Water_Temp = 40;
RH = 40;
Water_FlowRate = 6;
Water_FlowRate = Water_FlowRate/3600;
abs = (6.112 * exp((17.67 * Ambient_Temp)/(Ambient_Temp + 243.5)) * RH * 2.1674)/((Ambient_Temp+273.15)) * (1/1000);
ma = rho * u * W * d;
Kel = 273.15;
patm = 101325;
delX = 0.01;
max_iters = 1/delX;
cpv = 1864;
cpa = 1005;
cpl = 4182;
ifgw = 2500 * 1000;
a1 = -5800.2206;
a2 = 1.3914993;
a3 = -0.048640239;
a4 = 0.41764768 * 10^-4;
a5 = -0.14452093 * 10^-7;
a6 = 6.5459673;
w_g = 1:max_iters;
T_g = 1:max_iters;
T_l = 1:max_iters;
ml = 1:max_iters;
ig = 1:max_iters;
psat = 1:max_iters;
iv = 1:max_iters;
w_int = 1:max_iters;
h = 1:max_iters;
Lef = 1:max_iters;
cpg = 1:max_iters;
k = 1:max_iters;
w_g(1) = abs/rho;
T_g(1) = Ambient_Temp + Kel;
T_l(1) = Water_Temp + Kel;
ml(1) = Water_FlowRate;
ig(1) = (cpa)*(T_g(1) - Kel) + (w_g(1) * (ifgw + (cpv * (T_g(1) - Kel))));
va = ((0.009392 * T_l(1)) - 1.237) * 10^-5;
Dh = (2 * W * d)/(W + d);
Re = (u * Dh)/ va;
Pr = (-0.0002697 * T_l(1)) + 0.81;
n = 0.4;
lambda = 0.027;
psat(1) = exp((a1/T_l(1)) + (a2) + (a3 * T_l(1)) + (a4 * (T_l(1))^2) + (a5 * (T_l(1))^3) + (a6 * log(T_l(1))));
iv(1) = ifgw + cpv*(T_l(1) - Kel);
w_int(1) = (0.622 * psat(1))/(patm-psat(1));
if (T_l(1) < T_g(1))
n = 0.3;
end
h(1) = 0.023*(Re^0.8)*(Pr^n)*(lambda/Dh);
Lef(1) = ((0.865)^(2/3))*(((w_int(1) + 0.622)/(w_g(1) + 0.622) - 1)/(log((w_int(1) + 0.622)/(w_g(1) + 0.622))));
cpg(1) = cpa + w_g(1) * cpv;
k(1) = h(1)/(cpg(1) * Lef(1));
for ctr = 2:max_iters
c = ctr - 1;
ki1 = k(c);
wint1 = w_int(c);
wg1 = w_g(c);
Tl1 = T_l(c);
Tg1 = T_g(c);
iv1 = iv(c);
h1 = h(c);
ml1 = ml(c);
ig1 = ig(c);
pd = wint1 - wg1;
td = Tl1 - Tg1;
j1 = delX * (-1 * ki1 * A * pd);
k1 = delX * (ki1 * A * pd / ma);
l1 = delX * ((h1 * A * td / ma) + (iv1 * ki1 * A * pd / ma));
o1 = delX * ((A / (ml1 * cpl)) * ((ki1 * pd * (cpl*(Tl1 - Kel) - iv1)) - (h1 * td)));
ml2 = ml1 + (j1/2);
wg2 = wg1 + (k1/2);
ig2 = ig1 + (l1/2);
Tl2 = Tl1 + (o1/2);
va = ((0.009392 * Tl2) - 1.237) * 10^-5;
Re = (u * Dh)/ va;
Pr = (-0.0002697 * Tl2) + 0.81;
psat2 = exp((a1/Tl2) + (a2) + (a3 * Tl2) + (a4 * (Tl2)^2) + (a5 * (Tl2)^3) + (a6 * log(Tl2)));
iv2 = ifgw + cpv*(Tl2 - Kel);
wint2 = (0.622 * psat2)/(patm-psat2);
Tg2 = ((ig2 - (wg2*ifgw))/(cpa + wg2*cpv)) + Kel;
if (Tl2 < Tg2)
n = 0.3;
end
h2 = 0.023*(Re^0.8)*(Pr^n)*(lambda/Dh);
Lef2 = ((0.865)^(2/3))*(((wint2 + 0.622)/(wg2 + 0.622) - 1)/(log((wint2 + 0.622)/(wg2 + 0.622))));
cpg2 = cpa + wg2 * cpv;
ki2 = h2/(cpg2 * Lef2);
pd2 = wint2-wg2;
td2 = Tl2-Tg2;
j2 = delX * (-1 * ki2 * A * pd2);
k2 = delX * (ki2 * A * pd2 / ma);
l2 = delX * ((h2 * A * td2 / ma) + (iv2 * ki2 * A * pd2 / ma));
o2 = delX * ((A / ml2 / cpl) * (ki2 * pd2 * (cpl*(Tl2-Kel) - iv2) - (h2 * td2)));
ml3 = ml1 + (j2/2);
wg3 = wg1 + (k2/2);
ig3 = ig1 + (l2/2);
Tl3 = Tl1 + (o2/2);
va = ((0.009392 * Tl3) - 1.237) * 10^-5;
Re = (u * Dh)/ va;
Pr = (-0.0002697 * Tl3) + 0.81;
psat3 = exp((a1/Tl3) + (a2) + (a3 * Tl3) + (a4 * (Tl3)^2) + (a5 * (Tl3)^3) + (a6 * log(Tl3)));
iv3 = ifgw + cpv*(Tl3 - Kel);
wint3 = (0.622 * psat3)/(patm-psat3);
Tg3 = ((ig3 - (wg3*ifgw))/(cpa + wg3*cpv)) + Kel;
if (Tl3 < Tg3)
n = 0.3;
end
h3 = 0.023*(Re^0.8)*(Pr^n)*(lambda/Dh);
Lef3 = ((0.865)^(2/3))*(((wint3 + 0.622)/(wg3 + 0.622) - 1)/(log((wint3 + 0.622)/(wg3 + 0.622))));
cpg3 = cpa + wg3 * cpv;
ki3 = h3/(cpg3 * Lef3);
pd3 = wint3-wg3;
td3 = Tl3-Tg3;
j3 = delX * (-1 * ki3 * A * pd3);
k3 = delX * (ki3 * A * pd3 / ma);
l3 = delX * ((h3 * A * td3 / ma) + (iv3 * ki3 * A * pd3 / ma));
o3 = delX * ((A / ml3 / cpl) * (ki3 * pd3 * (cpl*(Tl3-Kel) - iv3) - (h3 * td3)));
ml4 = ml1 + (j3/2);
wg4 = wg1 + (k3/2);
ig4 = ig1 + (l3/2);
Tl4 = Tl1 + (o3/2);
va = ((0.009392 * Tl4) - 1.237) * 10^-5;
Re = (u * Dh)/ va;
Pr = (-0.0002697 * Tl4) + 0.81;
psat4 = exp((a1/Tl4) + (a2) + (a3 * Tl4) + (a4 * (Tl4)^2) + (a5 * (Tl4)^3) + (a6 * log(Tl4)));
iv4 = ifgw + cpv*(Tl4 - Kel);
wint4 = (0.622 * psat4)/(patm-psat4);
Tg4 = ((ig4 - (wg4*ifgw))/(cpa + wg4*cpv)) + Kel;
if (Tl4 < Tg4)
n = 0.3;
end
h4 = 0.023*(Re^0.8)*(Pr^n)*(lambda/Dh);
Lef4 = ((0.865)^(2/3))*(((wint4 + 0.622)/(wg4 + 0.622) - 1)/(log((wint4 + 0.622)/(wg4 + 0.622))));
cpg4 = cpa + wg4 * cpv;
ki4 = h4/(cpg4 * Lef4);
pd4 = wint4-wg4;
td4 = Tl4-Tg4;
j4 = delX * (-1 * ki4 * A * pd4);
k4 = delX * (ki4 * A * pd4 / ma);
l4 = delX * ((h4 * A * td4 / ma) + (iv4 * ki4 * A * pd4 / ma));
o4 = delX * ((A / ml4 / cpl) * (ki4 * pd4 * (cpl*(Tl4-Kel) - iv4) - (h4 * td)));
ml(ctr) = ml(c) + ((j1 + 2 * j2 + 2 * j3 + j4)/6);
w_g(ctr) = w_g(c) + ((k1 + 2 * k2 + 2 * k3 + k4)/6);
ig(ctr) = ig(c) + ((l1 + 2 * l2 + 2 * l3 + l4)/6);
T_l(ctr) = T_l(c) + ((o1 + 2 * o2 + 2 * o3 + o4)/6);
if (Tl1 <= 0) || (Tl2 <= 0) || (Tl3 <= 0) || (Tl4 <= 0)
disp("ERROR!");
disp("1 : " + wint1 + " psat : " + psat(c) + " Tl : " + Tl1 + " o value : " + o1 + " TL : " + Tl1);
disp("2 : " + wint2 + " psat : " + psat2 + " Tl : " + Tl2 + " o value : " + o2 + " TL : " + Tl2);
disp("3 : " + wint3 + " psat : " + psat3 + " Tl : " + Tl3 + " o value : " + o3 + " TL : " + Tl3);
disp("4 : " + wint4 + " psat : " + psat4 + " Tl : " + Tl4 + " o value : " + o4 + " TL : " + Tl4);
disp(ctr);
break;
end
T_g(ctr) = ((ig(ctr) - (w_g(ctr)*ifgw))/(cpa + w_g(ctr)*cpv)) + Kel;
va = ((0.009392 * T_l(ctr)) - 1.237) * 10^-5;
Re = (u * Dh)/ va;
Pr = (-0.0002697 * T_l(ctr)) + 0.81;
psat(ctr) = exp((a1/T_l(ctr)) + (a2) + (a3 * T_l(ctr)) + (a4 * (T_l(ctr))^2) + (a5 * (T_l(ctr))^3) + (a6 * log(T_l(ctr))));
iv(ctr) = ifgw + cpv*(T_l(ctr) - Kel);
w_int(ctr) = (0.622 * psat(ctr))/(patm-psat(ctr));
if (T_l(ctr) < T_g(ctr))
n = 0.3;
end
h(ctr) = 0.023*(Re^0.8)*(Pr^n)*(lambda/Dh);
Lef(ctr) = ((0.865)^(2/3))*(((w_int(ctr) + 0.622)/(w_g(ctr) + 0.622) - 1)/(log((w_int(ctr) + 0.622)/(w_g(ctr) + 0.622))));
cpg(ctr) = cpa + w_g(ctr) * cpv;
k(ctr) = h(ctr)/(cpg(ctr) * Lef(ctr));
end
L_array = L/max_iters:L/max_iters:L;
t_w = 1/10000;
t = L/ma;
diff = ml(1) - ml(end);
evap = diff * 3600;
dw = w_int - w_g;
O_AH = w_g(end)* 1.225;
O_Tg = T_g(end) - Kel;
O_RH = (1000 * O_AH * (273.15 + O_Tg)) / (6.112 * exp((17.67 * O_Tg)/(O_Tg + 243.5)) * 2.1674);
disp("Output RH is : " + O_RH + "%");
Best Answer