TURBINS: an immersed boundary, Navier-Stokes code for the simulation of gravity and turbidity currents interacting with complex topographies. An accurate, three-dimensional Navier-Stokes based immersed boundary code called TURBINS has been developed, validated and tested, for the purpose of simulating density-driven gravity and turbidity currents propagating over complex topographies. The code is second order accurate in space and third order in time, uses MPI, and employs a domain decomposition approach. It makes use of multigrid preconditioners and Krylov iterative solvers for the systems of linear equations obtained by the finite difference discretization of the governing equations. TURBINS utilizes the direct forcing variant of the immersed boundary approach and enforces the no-slip boundary condition via the first grid point inside the solid, which yields very accurate wall shear stress results. The results of test simulations are discussed for uniform flow around a circular cylinder, and for two- and three-dimensional lock-exchange gravity currents.