Fluid resonance inside a narrow gap between two side-by-side boxes is investigated based on an open-source CFD package, OpenFOAM. An upstream box heaves freely under wave actions and a downstream box remains fixed. The focus of this work is to study the influence of the motion of the upstream box on the hydrodynamic behavior of the resonant fluid inside the gap. The hydrodynamic behavior considered in this study includes the wave height inside the gap, heave displacement and their harmonic components, and reflection, transmission and energy loss coefficients. For comparison, the configuration in which the two boxes are fixed is considered. It was found that the heave motion of the upstream box increases the fluid resonant frequency and significantly reduces the resonant wave height in the gap. The frequencies at which the maximum and minimum heave displacements of the upstream box are observed to obviously deviate from the fluid resonant frequency. For the wave height in the gap and heave displacement, the effects of the incident wave height on their harmonic components are different. The heave motion of the upstream box results in a larger reflection coefficient and smaller energy loss coefficient.