To check the correctness of the inputs we must check that
nnodes is positive
the length of Q is equal to the number of rows in M
the elements in C are all positive
the length of C is equal to the number of columns in M
the pressure in the outlet is smaller than the pressure in the inlet Pout < PinIf any of these checks fails the function must exit and return a value of zero for the tw outputs (flow, v). Please bear in mind that flow is a vector of dimension equal to the number of columns of M so it must return a 1-D array of zeros of that dimension. The velocity v instead is a scalar value.