First law of thermodynamics applied to atmospheric fluid I was reading an article that talks on a climate prediction model. This article proposes the following equation (energy balance): 
$$\rho_0 c_v\left( \frac{\partial T}{\partial t} + \sum^{3}_{j=1} v_j \frac{\partial T}{\partial x_j}\right) -k \sum^3_{j=1} \frac{\partial^2 T}{\partial x^2_j} +p\sum^3_{j=1} \frac{\partial v}{\partial x_j} = -\sum^{3}_{j=1} \frac{\partial R_j}{\partial x_j} + C +\phi $$
Where $T$ is the temperature, $\sum^{3}_{j=1}\frac{\partial R_j}{\partial x_j}$ represents the temperature changes due to radiation, both solar emitted by warming, $C$ due to the evaporation and condensation of wate and $\phi$  due to the intrinsic dissipation
It is assumed it can be deduced from the first law of thermodynamics applied to a small part of the atmospheric fluid.
Can someone explain how to obtain such terms from the first law of thermodynamics? 
What does it mean exactly mean $-k \sum^3_{j=1} \frac{\partial^2 T}{\partial x^2_j}$, $p\sum^3_{j=1} \frac{\partial v}{\partial x_j}$ ?
Thank you very much.
 A: Those two terms that you have called out specifically --
$-k \sum^3_{j=1} \frac{\partial^2 T}{\partial x^2_j}$: This is the change in energy due to diffusion. 
$p\sum^3_{j=1} \frac{\partial v_j}{\partial x_j}$: This is the energy change due to compression or expansion of the fluid. 
So to tie it back into the first law of thermodynamics -- if we consider an infinitesimal fluid element, the diffusion term is the heat gain or loss by exchanging heat with the system outside of the fluid element. The second term is a $p dV$ term where the change in volume is computed by the velocity gradients. 
A: The equation can be rewritten in less cluttered form as
$$\begin{array}{||}\hline
\rho_0c_v\frac{DT}{Dt}-k\nabla^2T+p\nabla\cdot\mathbf{v}=Q\\
\hline\end{array}$$
where $Q$ are the external heat sources (sunlight, evaporation, etc.) and $\frac{D}{Dt}=\frac{\partial}{\partial t}+\mathbf{v}\cdot\nabla$ is the material (or convective) derivative.
It's a statement of conservation of energy. 
Meaning of the terms
The first term $\rho_0c_v\frac{DT}{Dt}$ describes the combined gain of energy at a particular location due to both temperature increase, $\frac{\partial T}{\partial t}$, and convection of energy-carrying matter, $\mathbf{v}\cdot\nabla T,$ into the location.
The second term $-k\nabla^2T$ describes nonconvective thermal diffusion of energy away from the location.
The third term $p\nabla\cdot\mathbf{v}$ includes heat created by mechanical compression of the air.
In the absence of external sources of energy, the sum of the terms would be equal to 0. However, because there are external sources (evaporation, sunlight, etc.), they must add to $Q$, the total external energy input.
