So, you’re really stretching the grey cells asking about TMD40a engines......but here goes...
The TMD 40a was originally delivered with a rectangular plate type heat exchanger, and a plastic expansion bottle mounted directly to the rear of the HE on the side of the exhaust manifold. If memory serves me correctly the temp alarm switch and temp gauge sender were mounted in the underside of the exhaust manifold, more or less hidden behind the HE. Up behind the alternator.
Later on there was a program to replace the plate HE and expansion tank with a larger tube type HE that was used on the aftercooled TAMD 40 engine because it had much better real rejection capabilities. The larger heat exchanger tank had bosses cast into it to accept the senders, in which case the senders would be located right in the front, engine side of the HE tank. You couldn’t miss them.
But if the new HE was installed and the senders weren’t moved, they would still be found in the exhaust manifold.
In the event that I’m mistaken, the sender still has to be in that general area. The coolant flow in the engine came out of the front of the cylinder head into a casting that directed it down the inside of the exhaust manifold to the turbo, out of the turbo and up the outside of the exhaust manifold and into the HE casting.
The sender will be in the manifold or HE casting just before the thermostats.