\documentclass[12pt]{report}
\usepackage{float}
\usepackage{parskip}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\title{Project 3 : Adding a temperature dictionary to the icoFoam case to solve the energy equation}
\author{Satya Sasank K}
%\date{November 2021}
\begin{document}
\maketitle
\section*{AIM}
The aim of this project is to add temperature to the icofoam case and solve the energy equation.
\section*{OBJECTIVE}
The objectives of this project are as follows:-\\
1. Create a new solver called icoTempFoam which is based on icoFoam.\\
2. Create an IOObject called T and create a scalar called kappa(heat diffusion coefficient) which must be read.\\
2. Solve the temperature equation.\\
3. Copy the \$FOAM\_TUTORIALS/incompressible/icoFoam/cavity/cavity tutorial and rename it to cavityTemp.\\
4. Add T in the 0 folder and add kappa in the constant/transportproperties. \\
5. Make appropriate changes in fvschemes and fvsolutions and run the case.\\
6. Run the solver and plot the results of temperature in Paraview.
\section*{PROCEDURE}
The icoFoam solver solves the incompressible flow equations for mass and momentum:\\
\[\nabla.U = 0\]\\
\[{\frac{\partial U}{\partial t}}+\nabla.U = -\nabla p+\nabla.(\nu\nabla U)+g\]\\
Our goal is to now add an equation for temperature as: \\
\[{\frac{\partial T}{\partial t}}+(\nabla.U)T = \kappa\nabla^2T \]\\
where \(\kappa\) is the heat diffusion coefficient \\
\newline
The icofoam solver in the \$foam/applications/solvers/incompressible/icoFoam is copied into the openFoam directory where the run folder exists. Here a new folder is created called mysolvers and the icoFoam solver is copied in it. Right next to the run directory another directory called platforms/linux64GccDpInt32opt/bin is created. This is where the new solver executive file is stored. The contents of the icofoam now renamed to icoTempFoam solver are as follows.\\
1.Make folder which consists the "files" file and the "options" file.\\
2.CreateFields.H\\
3.icoFoam.c which will be renamed to icoTempFoam.c\\
In the CreateFields.H the following piece of code is added under the velocity section.
\begin{verbatim}
Info<< "Reading field T\n" << endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
\end{verbatim}
Along with the above snippet, these lines are added under the viscosity in the same file.
\begin{verbatim}
dimensionedScalar kappa
(
"kappa",
dimViscosity,
transportProperties.lookup("kappa")
);
\end{verbatim}
The content in the files file will be as follows
\begin{verbatim}
icoTempFoam.C
EXE = $(FOAM_USER_APPBIN)/icoTempFoam
\end{verbatim}
The content in the options file remains the same.
The following changes are made in the icoTempFoam.c just after the PISO loop. The temperature equation is added and solved.
\newpage
\begin{verbatim}
fvScalarMatrix TEqn
(
fvm::ddt(T)
+fvm::div(phi,T)
-fvm::laplacian(kappa,T)
);
TEqn.solve();
\end{verbatim}
Upon executing the wmake command the new solver will be compiled and will be created here platforms/linux64GccDpInt32opt/bin.\\
The cavity folder from \$FOAM\_TUTORIALS/incompressible/icoFoam/cavity is copied into the run folder and is renamed as cavityTemp.\\
In cavityTemp/0 the pressure file is duplicated and is renamed as T with the following code in it.
\newpage
\small
\begin{verbatim}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 300;
boundaryField
{
movingWall
{
type fixedValue;
value uniform 400;
}
fixedWalls
{
type fixedValue;
value uniform 300;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
\end{verbatim}
\newpage
The following snippet will be added under the viscosity in cavityTemp/constant/transportproperties.
\begin{verbatim}
kappa [0 2 -1 0 0 0 0] 0.001;
\end{verbatim}
The end time in cavityTemp/system/ControlDict is changed to 3sec with everything else remaining the same. The divschemes and laplacian schemes in fvschemes are modified as follows.
\begin{verbatim}
divSchemes
{
default none;
div(phi,U) Gauss linear;
div(phi,T) Gauss upwind;
}
laplacianSchemes
{
default Gauss linear orthogonal;
laplacian(kappa,T) Gauss linear corrected;
}
\end{verbatim}
In the fvsolutions the following code snippet is added under U.
\begin{verbatim}
T
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-07;
relTol 0;
}
}
\end{verbatim}
The case is run using the following commands\\
"blockMesh"\\
"checkMesh"\\
"icoTempFoam"
\newpage
\section*{RESULTS}
The following is the temperature contour at the end of 3 secs.\\
\begin{figure}[H]
\centering
\includegraphics[scale=0.7]{temp.png}
\caption{Temperature Contour}
\end{figure}
\end{document}