In the last decade, the field of wireless optical communication has gathered immense interest due to its adoption in growing bandwidth-hungry underwater applications. The expensive and non-standardized on-field research measurements call for a reliable simulation tool that allows researchers to realistically design and assess the performance of Underwater Optical Communication (UOC) systems before conducting actual underwater experiments. In this paper, we present a UOC module as an extension to the network simulator ns-3. The module can study the impact of different water conditions on underwater optical networks from the physical layer to the network layer. The proposed UOC module realizes physical layer models of the UOC channels where the added noise and interference effects are modeled as Additive White Gaussian Noise (AWGN). Results show the capability of our module to facilitate large underwater optical network design and optimization. Since ns-3 is an open-source software, the module has the flexibility and reusability to be further developed by the worldwide research community.