% HOLDUP_CHANGE.M %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Compute holdup change

function dm = holdup_change(L,V,L_in,V_in)

global termodata

Nt = length(L);

dm = [
    L_in - L(1) + (1 - termodata.alpha) * V(2) + termodata.alpha * V(3) - V(1)
    L(1:Nt - 3) - L(2:Nt - 2) + (1 - termodata.alpha) * V(3:Nt - 1) + termodata.alpha * V(4:Nt) - V(2:Nt - 2)
    L(Nt - 2) - L(Nt - 1) + (1 - termodata.alpha) * V(Nt) + termodata.alpha * V_in(1) - V(Nt - 1)
    L(Nt - 1) - L(Nt) + (1 - termodata.alpha) * V_in(1) + termodata.alpha * V_in(2) - V(Nt)
];
