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
  2 个评论
Duong Nguyen
Duong Nguyen 2019-12-3
I solved Jw based on q. Based on the equation of Jw and q, the initial guess for q should be this:
q_guess=(Jw_guess*Hvap((Tf+Tp)/2)+Km/d*(Tf-Tp));
This one shows a very big Jw (which is not correct). If I choose q_guess=0, it shows me negative value. So how do I fix that?

请先登录,再进行评论。

回答(1 个)

Matt J
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.

类别

Help CenterFile Exchange 中查找有关 Thermal Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by