A numerical method for stratified shear flows over a long obstacle