# Introduction to laplacianFoam and simple validation calculation

In this blog post, I will try to give a description of the governing equation of the laplacianFoam in OpenFOAM that solves a simple Laplace equation, e.g. for thermal diffusion in a solid.

 Governing Equation

The heat conduction equation is given by the following equation:

\begin{align}
\frac{\partial T}{\partial t} = \frac{1}{\rho c_p} \nabla \cdot \left(k \nabla T\right) + \frac{q}{\rho c_p}, \tag{1} \label{eq:conductionEqn}
\end{align}

where $$T\;{\rm [ K]}$$ is the absolute temperature field, $$\rho\;{\rm [kg/m^3]}$$ is the density field, $$q\;{\rm [W/m^3]}$$ is the rate of energy generation per unit volume, $$k\;{\rm [W/(m\cdot K)]}$$ is the thermal conductivity and $$c_p\;{\rm [J/(kg\cdot K)]}$$ is the specific heat at constant pressure.

If the heat capacity $$\rho c_p$$ is spatially uniform, the Eq. \eqref{eq:conductionEqn} can be transformed into the following form irrespective of whether the thermal conductivity $$k$$ is spatially uniform or not:

\begin{align}
\frac{\partial T}{\partial t} = \nabla \cdot \left(\alpha \nabla T\right) + \frac{q}{\rho c_p}, \tag{2} \label{eq:conductionEqn2}
\end{align}

where $$\alpha = k/\rho c_p\;{\rm [m^2/s]}$$ is the thermal diffusivity.

The laplacianFoam (in OpenFOAM-4.x and earlier versions) doesn’t consider the heat generation and the implemented equation is

\begin{align}
\frac{\partial T}{\partial t} = \nabla \cdot \left(\alpha \nabla T\right), \tag{3} \label{eq:laplacianFoam}
\end{align}

but the solver in the latest development version supports the fvOptions so that we can solve \eqref{eq:conductionEqn2} and specify a volumetric heat source.

We can find the Eq. \eqref{eq:conductionEqn2} solved in laplacianFoam.C.

The variable DT represents the thermal diffusivity $$\alpha$$ and it is specified in the constant/transportProperties file.

 Comparison with Analytical Solution

We consider the steady state problem of source-free heat conduction in a concentric cylinder whose inner and outer walls are maintained at constant temperature of 400 K and 300 K respectively. This problem can be analytically solved and the following relation holds for the temperature distribution in the radial direction $$T(r)$$:

\begin{align}
\frac{T_1 – T(r)}{T_1 – T_2} = \frac{\ln{(r/r_1)}}{\ln{(r_2/r_1)}}, \tag{4} \label{eq:cylinderT}
\end{align}

where the subscripts 1 and 2 indicate the values at the inner and outer walls respectively shown in Figure 1.

The temperature distribution obtained using laplacianFoam is shown in Figure 2 and the comparison between the numerical and analytical solutions is shown in Figure 3. The agreement with the analytical solution is good.

 Introduction of Source Term

In the next post, I’ll deal with a simple example case to introduce how to specify a heat generation source term in laplacianFoam using the fvOptions functionality (scalarSemiImplicitSource).

## Author: fumiya

CFD engineer in Japan

## 9 thoughts on “Introduction to laplacianFoam and simple validation calculation”

1. David says:

Thank you.

2. Alberto Karkour says:

Thanks! This is helping me with my Thesis!

3. Di Cheng says:

Actually, the equation (1) is of little wrong. The diffusion term must be div(alpha*grad(T)) rather than simple alpha*laplacian(T). There is a little difference if alpha is changing with T or spatial coordinate.

1. fumiya says:

Thank you for pointing out my mistake. I am going to correct it.

1. Di Cheng says:

Hi, I am looking into OpenFOAM recently. I am reading , the book of F. Moukalled, L.Mangani and M. Darwish. In the book it is recommended that the thermal conductivity should be interpolated using geometric average rather than algebraic average. However, I cannot find any interpolation implementation of geometric average in OpenFOAM. I think you may be more familiar with it. How to implement one if I want to add an additional interpolation scheme?

Thanks a lot

4. hc says:

Thanks a lot.

5. Khayrul Hasan says:

Thank you very much. It is really very much helpful for me. If you allow me I would like to communicate with you.

6. Excellent contribution for understanding openFOAM.