In this study, to develop the predictive technology of two-phase flow dynamics under earthquake acceleration, a detailed two-phase flow simulation code with an advanced interface tracking method TPFIT was expanded. In addition, the bubbly flow in a horizontal pipe excited by oscillation acceleration and under the fluctuation of the liquid flow was simulated by using the modified TPFIT. In the results, it was confirmed that the modified TPFIT can predict time dependent velocity distribution around the bubbles and shapes of bubbles qualitatively. The main cause of bubble deformation observed is large shear stress at the lower part of the bubble, and this large shear stress is induced by the velocity difference between the liquid phase and bubble. Moreover, we discussed about the difference between both effects of flow rate fluctuation and structure vibration on two-phase flow. In the results, bubble acceleration of the structure vibration case was larger than that of the flow rate fluctuation case. Finally, it was concluded that unsteady shear stress induced by vibration of the pipe wall was one of the main driving forces of bubble motion in structure vibration case.