You can find many reference material about this. I would like to recommend to read an article ”Stress analysis methods for underground pipe lines, L.C.Peng, May 1978, Pipe Line Industry”.

Virtual anchor location may be calculated roughly as below;

L = Ft / Ff
where,
L = length of pipe from virtual anchor to the point of entry or exit from the ground(ft)
Ft : force due to thermal compressive stress (lbs)
Ff : frictional resistance of pipe to thermal growth (lbs/ft)

However, it will depend on buried conditions. If you want to get more correct number, you have to use computer software. There are some software for buried pipe and soil analysis.
I don’t see a problem to model your piping even a few kilometers into Caesar II. Caesar II will give the virtual anchor location and thermal movements.
_________________________
Sun Wee