An algorithmic approach to determine the pressure distribution in rectangular reservoirs with no-flow, constant pressure, or mixed boundaries