As a promising large-scale energy storage device, the vanadium redox flow battery (VRFB) has attracted attention due to its excellent safety, the independence between energy capacity and power capacity, the suitable polarization potential, and the ability to avoid cross-contamination. In this work, a 3D model of VRFB is developed based on the open-source computational fluid dynamics (CFD) platform OpenFOAM, which is well-validated. Then, the effect of operating conditions is studied, which shows that a higher electrolyte concentration can reduce the overpotential and increase the discharge voltage. Reducing the current density can increase the deepness of charge and discharge, reduce the electrolyte concentration gradient, the mass transfer loss and the activation loss. In addition, the effect of electrode porosity is studied that the overpotential decreases near the membrane and increases near the current collector with increasing porosity. Finally, the effect of porosity changes in different directions is studied, and an attempt is made to utilize this overpotential distribution by introducing the gradient-porosity electrode to reduce the non-uniformity of overpotential. The gradient-porosity electrode design using higher porosity near the membrane and lower porosity near the current collector can effectively improve the distribution of overpotential and increase battery performance by 1.67 mV.