Natural convection and entropy generation of a ferrofluid in a square enclosure under the effect of a horizontal periodic magnetic field