I am calculating membrane water flux using fsolve but MATLAB gave me a negative value of water flux (Jw) as follows. I don't know how to avoid these negative solution from non-linear equation so I would like to know how to solve it correctly
4 次查看(过去 30 天)
显示 更早的评论
Here are MATLAB codes I used to calculate
function [Jw,q]=jw_q_solve(Tf,Tp,P,B,Km,d,h)
%Jw, water flux [L.m^-2.h^-1]
%q, heat flux [kg.s-3]
%Tf, feed bulk temperature [K]
%Tp, permeate bulk temperature [K]
%B, permeability coefficient [kg m-2s-1Pa-1]
%Km, membrane heat transfer coefficient [W m-1K-1]
%P, hydraulic pressure [bar]
%d, membrane thickness [m]
%HEAT TRANSFER COEFFICIENTS
%hf, heat transfer coefficient for temperature polarization in the feed [W m-1 K-1]
hf=h;
%hp, heat transfer coefficient for temperature polarization in the draw [W m-1 K-1]
hp=h;
function F=q_flux(x)
%x(1) = q, heat flux [kg.m-2.s-1]
den=1; %[kg.L-1] density of water
Cpw=4200; %[J.kg-1.K-1] specific heat capacity of water vapor
z=1/3600; %hr/sec
%Uses enthalpy of vaporization and conductive heat transfer
F(1)=x(1)-((B*(Pv((Tf-x(1)/hf),0)-Pv((Tp+x(1)/hp),P)))*Hvap(((Tf-x(1)/hf)+(Tp+x(1)/hp))/2)+Km/d*((Tf-x(1)/hf)-(Tp+x(1)/hp)));
end
%guess water flux
Jw_guess=B*(Pv(Tf,0)-Pv(Tp,P));
%guess heat transfer
q_guess=(Jw_guess*Hvap((Tf+Tp)/2)+Km/d*(Tf-Tp));
%q_guess=0;
%solve for heat transfer
options = optimset('Display','iter');
q_std=fsolve(@q_flux,q_guess,options); % [kg s-3]
%solve for water flux in kg.m-2.s-1
Jw_std=(B*(Pv((Tf-q_std/hf),0)-Pv((Tp+q_std/hp),P)));
%convert unit to LMH
Jw=Jw1/z/den; %LMH
q=q_std %[kg s-3]
end
回答(1 个)
Matt J
2019-12-3
Since you only have single unknown, you should probably use fzero. With fzero you can specify a bounded interval within which to restrict the search.
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Thermal Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!