I've tried this a few times. Don't always nail it, and when I do I only curse if I'm low on torpedoes. But usually I'm right on the money.
In the interest of full disclosure, I use the stock SHIV Gold Edition on medium settings. Yes, the stock version: I'm lame, I know. But I really don't know much about modding, so baby steps here. I have a German-language mod installed, as I tend to use the (again stock) U-Boat campaign almost exclusively. That's as far as I've managed to get.
I also use the "automatic targeting" option: I failed just about every math course I've ever taken, so I'm already disinclined to do it here. And to be honest, manually targeting isn't fun for me, and if the whole point of playing a game is to have fun, what sense does it make to apply an aspect of it that is anything
but fun? Besides, while it's not "realistic" in that sense, if you think about it, weren't skippers usually on the periscope & one of their subordinate officers was the one doing all the trigonometry?
Anyways, back on topic. My standard method for attacking ships is as follows:
If it's a large, slow-moving vessel, aim amidships and all secondary shots are aimed closer to the bow
If it's a large, fast-moving vessel, aim approximately where the bridge is and all seconary shots confined to the foc'sle, likewise approaching the bow.
If it's a small, fast-moving vessel, get out of the way!
Nah, jj

. The only time I'll attack a DD outside of a self-defense situation is if there are 4 or more in a convoy I need to hit, if it's guarding a port I need to enter for recon purposes, or if it's sitting in the water trying to find me.
In the first situation, I'll send a torpedo to the lead DD and do my best to hit wherever the inevitable tanker might be, for tonnage purposes. I try to time my shots to where the DD and my intended target go up as close to simultaneously as possible. If there is any disparity between the explosions, I try to make the DD the first one that goes. The reason for this is that it gives me a better chance to make my escape with the closest DD neutralized.
In the third situation, I approach at an oblique angle from the DD's amidships line from behind, knowing that their sonar doesn't work behind them. I aim at the bow as close as I can get without passing it. Very rarely does this fail to work. If the DD doesn't move, his bow is destroyed & he's going down. If the DD picks up my torpedo coming to it, odds are not very good that he'll outrun it, in which case his engine room is destroyed and he sinks from the stern.
I have a really interesting anecdote about a past game I played trying to recon Sydney Harbor with the Mk XLVIII Walther U-Boat, but I'll save that for another day.