% COMPUTE_LIQUID.M %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Compute liquid and vapour flows for a section
%
% Written by: Martin Kvernland

function L = compute_liquid(secnr,L_in,holdup,temp)

global coldata hydraulic termodata

L_heatloss = termodata.U * pi * coldata.diameter * ...
    coldata.sech(sec_nr) * (temp - termodata.T0) ...
    ./ (coldata.Nt(secnr) * termodata.deltaH);

L = L_in + ...
    hydraulic.k1 * (holdup - coldata.M0) - ...
    toeplitz(ones(coldata.Nt(secnr),1),[1; zeros(coldata.Nt(secnr) - 1,1)]) * L_heatloss;

