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 local temperature given by the

expected value of the local energy and current. Scaling space and time

diffusively yields, in the $n\to+\infty$ limit, the heat equation for the

macroscopic temperature profile $T(t,u),$ $t>0$, $u \in [0,1]$. It is to be

solved for initial conditions $T(0,u)$ and specified $T(t,0)=T_-$, the

temperature of the left heat reservoir and a fixed heat flux $J$, entering the

system at $u=1$. $J$ is the work done by the periodic force which is computed

explicitly for each $n$.