The first law of thermodynamics states that the change in internal energy equals the work done, and change is heat transfer.
Change in total (Specific) energy (E) of a fluid particle = Work done by the fluid particle + change in heat of fluid particle.
⎩⎨⎧Change in Specific energy (E) of afluid particle⎭⎬⎫=⎩⎨⎧Work done by the fluid particle⎭⎬⎫+⎩⎨⎧change in heat of the fluid particle⎭⎬⎫
Change in Specific energy (E) of a fluid particle is
ρDtDE
The specific energy (E) is equal to the sum of internl energy (i), kinetic energy (21(u2+v2+w2)), and gravitational potential energy.
If the potential energy due to gravitational force is considered as source term we can define the Specific energy as below
E=i+21(u2+v2+w2)
Work done
Work done by the fluid particle is equal to the product of the velocity and the forces.
We get the below equation when we take x-momentum with out the source term from Momentum equation in a 3D particle and its surface & body forces and multiply it by velcity u.
∂x∂[u(−p+τxx)]+∂y∂(uτyx)+∂z∂(uτzx)
Similary we can do for y and z directions as below
∂x∂(vτxx)+∂y∂[v(−p+τyx)]+∂z∂(vτzx)∂x∂(wτxx)+∂y∂(wτyx)+∂z∂[w(−p+τzx)]
Since,
−∂x∂(up)−∂y∂(vp)−∂z∂(wp)=−div(pU)
We can write the total work done by the fluid particle due to surface forces as below
−div(pU)+∂x∂(uτxx)+∂y∂(uτyx)+∂z∂(uτzx)+∂x∂(vτxx)+∂y∂(vτyx)+∂z∂(vτzx)+∂x∂(wτxx)+∂y∂(wτyx)+∂z∂(wτzx)=>Eq−(1)
Energy flux due to heat conduction
Similar to the conservation of mass we can define the energy flux due to heat conduction as below

Now the total heatflux per unit volume can be expressed with below equation
−∂x∂qx−∂y∂qy−∂z∂qz=−div(q)
Fourier law gives the flux due to heat condution (Refer Heat Transfer) as below.
qx=−k∂x∂T, qy=−k∂y∂T, and qz=−k∂z∂T
The same can be written in vector form as below
q=−k grad(T)
So, we can say
−div(q)=div(k grad(T))=>Eq−(2)
Total Energy
The total energy is equal to the sum of work done (Eq. 1), Energy flux (Eq. 2) due to heat conduction, and stored potential energy due to gravity (SE).
So,
ρDtDE=−div(pU)+∂x∂(uτxx)+∂y∂(uτyx)+∂z∂(uτzx)+∂x∂(vτxx)+∂y∂(vτyx)+∂z∂(vτzx)+∂x∂(wτxx)+∂y∂(wτyx)+∂z∂(wτzx)+div(k grad(T))+SE=>Eq−(3)
Kinetic Energy
The kinetic energy can be calculated by multiplying the momentum equation by the velocity.
Below is the momentum equation from Momentum equation in a 3D particle and its surface & body forces
ρDtDu=∂x∂(−p+τxx)+∂y∂(τyx)+∂z∂(τzx)+SMxρDtDv=∂x∂(τxx)+∂y∂(−p+τyx)+∂z∂(τzx)+SMyρDtDw=∂x∂(τxx)+∂y∂(τyx)+∂z∂(−p+τzx)+SMz
When we separate the pressure terms
ρDtDu=−∂x∂p+∂x∂τxx+∂y∂τyx+∂z∂τzx+SMxρDtDv=−∂y∂p+∂x∂τxx+∂y∂τyx+∂z∂τzx+SMyρDtDw=−∂z∂p+∂x∂τxx+∂y∂τyx+∂z∂τzx+SMz
Since,
−∂x∂p−∂y∂p−∂z∂p=−grad p
We can write the Kinematic equation as below,
ρDtD21(u2+v2+w2)=−U.grad p+u(∂x∂τxx+∂y∂τyx+∂z∂τzx)+v(∂x∂τxx+∂y∂τyx+∂z∂τzx)+w(∂x∂τxx+∂y∂τyx+∂z∂τzx)+U.SM=>Eq−(4)
Internal Energy
The internal energy can be calculated by subtracting the Kinetic energy (Eq. 4) from total energy (Eq. 3).
LHS
ρDtDE=ρDtD[i+21(u2+v2+w2)]
ρDtD[i+21(u2+v2+w2)]−ρDtD[21(u2+v2+w2)]=ρDtD[i]
RHS
Since,
−div(pU)=−[(U.grad p)+p div(U)]
Using the dot product rule (refer divergence rule)
∂x∂(uτxx)=u∂x∂(τxx)+τxx∂x∂(u)
And introducing a new source term SE−U.SM=Si, We can write the Internal Energy equation as below
ρDtD[i]=−p div(U)+div(k grad(T))+τxx∂x∂u+τyx∂y∂u+τzx∂z∂u+τxx∂x∂v+τyx∂y∂v+τzx∂z∂v+τxx∂x∂w+τyx∂y∂w+τzx∂z∂w+Si=>Eq−(5)
Deriving Temperature Equation for Incompressible Fluid
For incompressible fluid
i=c T
Where, c - specific heat
div U=0
We can rewrite Eq.5 from the above conditions, resulting in a temperature equation as below.
ρcDtDT=div(k grad(T))+τxx∂x∂u+τyx∂y∂u+τzx∂z∂u+τxx∂x∂v+τyx∂y∂v+τzx∂z∂v+τxx∂x∂w+τyx∂y∂w+τzx∂z∂w+Si=>Eq−(6)
Deriving Enthalpy Equation for Compressible Fluids
The specific enthalpy(h)(total enthalpy per unit mass) of fluid is equal to the sum of internal energy (i) and the product of pressure (p) & specific volume (1/ρ).
h=i+ρp
The total enthalpy (h0) equals the sum of specific enthalpy (h) and kinetic energy (21(u2+v2+w2)).
h0=h+21(u2+v2+w2)=i+ρp+21(u2+v2+w2)=E+ρp
Now,
E=h0−ρp=>Eq−(7)
As described in Conservation of momentum and energy, we can write the Energy equation below.
ρDtDE=∂t∂(ρE)+div(ρEU)
Substituting Eq. 7 to the above we get,
ρDtD(h0−ρp)=∂t∂(ρ(h0−ρp))+div(ρ(h0−ρp)U)=∂t∂(ρh0)−∂t∂p+div(ρh0U)−div(pU)
Using Eq. 3 we can write the below equation
∂t∂(ρh0)−∂t∂p+div(ρh0U)−div(pU)=−div(pU)+∂x∂(uτxx)+∂y∂(uτyx)+∂z∂(uτzx)+∂x∂(vτxx)+∂y∂(vτyx)+∂z∂(vτzx)+∂x∂(wτxx)+∂y∂(wτyx)+∂z∂(wτzx)+div(k grad(T))+Sh
∂t∂(ρh0)+div(ρh0U)=∂t∂p+div(k grad(T))+∂x∂(uτxx)+∂y∂(uτyx)+∂z∂(uτzx)+∂x∂(vτxx)+∂y∂(vτyx)+∂z∂(vτzx)+∂x∂(wτxx)+∂y∂(wτyx)+∂z∂(wτzx)+Sh