The book is actually mostly based on real events, as Buchheim went out on one patrol on U-96 with Kptlt. Heinrich Lehmann-Willenbrock in command. On this patrol they did meet another boat mid-Atlantic in a storm, and sat on the bottom of the straits of Gibraltar after being bombed.
The ending is the only fictional part of the book, as Willenbrock survived the war.
http://www.uboat.net/boats/u96.htm
Cheers,
Dan