We derive a macroscopic heat equation for the temperature of a pinned harmonic chain subject to a periodic force at its right side and in contact with a heat bath at its left side. The microscopic dynamics in the bulk is given by the Hamiltonian equation of motion plus a reversal of the velocity of a particle occurring independently for each particle at exponential times, with rate $$\gamma $$
γ
. The latter produces a finite heat conductivity. Starting with an initial probability distribution for a chain of n particles we compute the current and the local temperature given by the expected value of the local energy. Scaling space and time diffusively yields, in the $$n\rightarrow +\infty $$
n
→
+
∞
limit, the heat equation for the macroscopic temperature profile T(t, u), $$t>0$$
t
>
0
, $$u \in [0,1]$$
u
∈
[
0
,
1
]
. It is to be solved for initial conditions T(0, u) and specified $$T(t,0)=T_-$$
T
(
t
,
0
)
=
T
-
, the temperature of the left heat reservoir and a fixed heat flux J, entering the system at $$u=1$$
u
=
1
. |J| equals the work done by the periodic force which is computed explicitly for each n.