A harmonic scalar field has a Laplacian (i.e., both source-free and curl-free) gradient vector field and vice versa. Despite the good performance of spherical harmonic series on modeling the gravitational field generated by spheroidal bodies (e.g., the Earth), the series may diverge inside the Brillouin sphere enclosing all field-generating mass. Divergence may realistically occur when determining the gravitational fields of asteroids or comets that have complex shapes, which is known as the complex-boundary value problem (CBVP). To overcome this weakness, we propose a new spatial-domain numerical method based on the equivalence transformation which is well known in the fluid dynamics community: a potential-flow velocity field and a gravitational force vector field are equivalent in a mathematical sense, both referring to a Laplacian vector field. The new method abandons the perturbation theory based on the Laplace equation, and, instead, derives the governing equation and the boundary condition of the potential flow from the conservation laws of mass, momentum and energy. Correspondingly, computational fluid dynamics (CFD) techniques are introduced as a numerical solving scheme. We apply this novel approach to the gravitational field of the comet 67P/Churyumov–Gerasimenko which has an irregular shape. The method is validated in a closed-loop simulation by comparing the result with a direct integration of Newton’s formula. Both methods are consistent with a relative magnitude discrepancy at the percentage level and with a small directional difference root-mean-square value of $$0.78^{\circ }$$
0
.
78
∘
. Moreover, the Laplacian property of the potential flow’s velocity field is proved mathematically. From both theoretical and practical points of view, the new numerical method is able to overcome the divergence problem and, hence, has a good potential for solving CBVPs.