function res = valve(x, aux)
d = aux.d;
sc = aux.sc;
u = aux.u;
x = x.*sc.x;
z = x(1);
n = x(2);
hout = x(3);
DP = u(1);
rho = u(2);
hin = u(3);
res = [n-z*d.Cv*sqrt(DP*rho/d.MW);
       hout-hin]./sc.res;
