I always try to have my sub pointed dead at or away from enemy DDs if I think I am going to be near them as they pass(a key for me is to try and observe the patterns of the AS escorts and then try to go to their weak spots) I do this to expose a smaller profile to enemy active sonar and ideally try to have my screws as far away from a TF or convoy to try and minimize the sound of my props.It seems to be part science and part art sneaking in for the kill skilled players can post the science part the art just takes time to learn and you never get it perfect every time.
Another thing you can try against a TF is getting into a good spot and then going deep at all stop and just wait then go back up to PD when you hear that the enemy is near it is tricky but it will work if you get a good basic track before hand. I prefer the top paragraph method though.At least you survived a very bad situation.