What is the flow rate? fluid or gas flow rate? if the gas flow rate like a 4 stroke fuel motor, influences the working process of the combustion engine. For example the work process of a 4 stroke gasoline motor, there are 2 valves, namely the suction valve and exhaust valve. The opening of the suction valve and exhaust valve is only once in a single process work and closed 3 times in one work process. For open suction valves only on the suction and closed steps in the business compression step and discard. So also the opening step is only when the step is just throw it and closed on the suction step, compression and effort.
Your question requires some points to be considered.
1) if you are considering the opening phase of the valve, the problem is transient, the flow rate increases in time due to the opening.
2) Considering the Bernoulli integral between 1 and 2 is not correct if the valve causes loss of pressure due to friction effects. Furthermore, Bernoulli is only for incompressible flows. Conversely, you have to use the Crocco relation.
3) If P1 is the pressure in a closed tank, such pressure will decrease until an equilibrium is reached.
I suggest to read the book of White where you can find a lot of similar exercise.
For water, the continuity equation reduces to the divergence-free constraint divv =0. Then, just integrate over a control volume, use Gauss and see that the Int[S] n.v dS = 0