Fully Restrained Bar:
Let us consider a bar of uniform cross-sectional area A and length L and constrained at both ends as display in Figure (a) and (b).
Figure
Now let us increase the temperature of the bar by ΔT. If a bar were free to expand, it would have raised to a length L + ΔL as in Figure (b). Therefore, this increase in length, ΔL, is completely restrained. Thus, the restraining force, P, will be equivalent to a force that would have produced the same change in length. Subsequent these arguments
ΔL = αL ΔT = PL/AE or P = AE α ΔT
Therefore, Thermal Strain = ΔL/L = α ΔT
Thermal Stress in the bar = Strain × E = E α ΔT
Which is the similar as P/A. Since the force P is compressive, the stress developed is also compressive in nature.