A finite difference scheme with ghost cell technique is used to study viscous fluid sloshing in 2D and 3D tanks with internal structures. The Navier-Stokes equations in a moving coordinate system are derived and they are mapped onto a time-independent and stretched domain. The staggered grid is used and the revised SIMPLEC iteration algorithm is performed. The developed numerical model is rigorously validated by extensive comparisons with reported analytical, numerical and experimental results. The present numerical results were also validated through an experiment setup with a tank excited by an inclined horizontal excitation or a tank mounted by a vertical baffle. The method is then applied to a number of problems including sloshing fluid in a 2D tank with a bottom-mounted baffle and in a 3D tank with a vertical plate. The phenomena of diagonal sloshing waves affected by a vertical plate are investigated in detail in this work. The effects of internal structures on the resonant frequency of a tank with liquid are discussed and the present developed numerical method can successfully analyze the sloshing phenomenon in 2D or 3D tanks with internal structures.