Project 4
Latex Code:
\documentclass{report}
\usepackage{graphicx} % Required for inserting images
\title{Final Project}
\author{Thomas Abraham}
\date{July 2024}
\begin{document}
\maketitle
\section{Introduction to the Challenge}
The aim of this project is to :
\begin{itemize}
\item Study the effect of diffusion coefficient in a case of pure diffusion.
\item Study the effect of ``divSchemes" on the solution of a case of pure convection and to find the appropriate scheme for the most accurate results.
\end{itemize}
This challenge makes use of the ``\verb|$FOAM_TUTORIALS/ compressible/sonicFoam/laminar/shockTube/|'' tutorial.
\section{Preparation of the case}
The ``controlDict", ``fvSchemes", ``fvSolution", ``transortProperties" files were copied over from ``\verb|$FOAM_TURORIALS/basic/scalarTransportFoam/pitzDaily/|''.
\\
The ``setFields" was set according to the given problem statement.
setFields:
\begin{verbatim}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volVectorFieldValue U(0 0 0)
volScalarFieldValue T 0.0 //Altered as per Q
);
regions
(
boxToCell
{
box(-0.5 - 1 - 1)(0.5 1 1); //Altered as per Q
fieldValues
(
volScalarFieldValue T 1.0 //Altered as per Q
);
}
);
// ************************************************************************* //
\end{verbatim}
controlDict:
\begin{verbatim}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application scalarTransportFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 5; /*Altered as per Q */
deltaT 0.0001;
writeControl timeStep;
writeInterval 50;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
\end{verbatim}
The ``blockMeshDict" of the original ``sonicFoam'' case was left unchanged.
\subsection{Prepararing the case to study the effects of the diffusion coefficient:}
This case is set-up such that the only mode of heat transfer is diffusion (with no advection) study the effect of the diffusion coefficient.\\
The velocity was set to ``(0,0,0)'' so that only diffusion acts and no advection comes into play.
\verb|0/U:|
\begin{verbatim}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
arch "LSB;label=32;scalar=64";
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0); //set to 0
boundaryField
{
sides
{
type zeroGradient;
}
empty
{
type empty;
}
}
// ************************************************************************* //
\end{verbatim}
The diffusion coefficient is read from the ``transportProperties" file. The challenge requires the diffusion coefficient's value to be changed to study it's role in diffusion.
transportProperties:
\begin{verbatim}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
DT 0.0; //0.0001, 0.01, 1
// ************************************************************************* //
\end{verbatim}
fvSchemes:
\begin{verbatim}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,T) Gauss linearUpwind grad(T);
}
laplacianSchemes
{
default none;
laplacian(DT,T) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //
\end{verbatim}
fvSolutions:
\begin{verbatim}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
T
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
norm default;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //
\end{verbatim}
\subsection{Preparation of the case to study the impact of different ``divSchemes" on the solution}
This case is set-up to study the effect different divergence schemes or ``divSchems" have on the solution.\\
The velocity is set to ``(1,0,0)" according to the given problem statement.
\begin{verbatim}
0/U:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
arch "LSB;label=32;scalar=64";
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (1 0 0); //Altered according to Q
boundaryField
{
sides
{
type zeroGradient;
}
empty
{
type empty;
}
}
// ************************************************************************* //
\end{verbatim}
The diffusion coefficient is set to zero to disable all possibility of diffusion so that the heat transfers by pure advection only.\\
transportProperties:
\begin{verbatim}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
DT 0;
// ************************************************************************* //
\end{verbatim}
The changes to ``divSchemes" is made in the ``fvSchemes" file.
fvSchemes:
\begin{verbatim}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi, T) Gauss upwind; //Gauss linearUpwind, Gauss QUICK,etc.
}
laplacianSchemes
{
default none;
laplacian(DT, T) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //
\end{verbatim}
fvSolution:
\begin{verbatim}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
T
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-6;
relTol 0;
norm default;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //
\end{verbatim}
\section{Results and interpretations}
\subsection{For pure diffusion}
This section studies the role of thermal diffusivity in heat transfer.\\
In Heat Transfer analysis, the thermal diffusivity is one of the most important parameters that describes how quickly heat ``diffuses'' in a material. Mathematically, it is the thermal conductivity divided by the product of the material's density and the specific heat capacity at constant pressure. $$\alpha=\frac{\kappa}{\rho*C_p}$$
Here,
``$\alpha$'' is the thermal diffusivity in `$m^2/sec$', ``$\kappa$'' is the thermal conductivity in `$J/(Kg*K) $' and ``$\rho$" is the density of the material in `$Kg/m^3$''
As the thermal diffusivity describes the thermal conductivity of a material relative to the volumetric heat capacity (the product of density and specific heat capacity at constant pressure), it is an important parameter in determining how temperature gradients smooth out over time. In summation,
the thermal diffusivity has a major say in how quickly heat ``spreads out" or ``diffuses" in a material. \\
More the ``$\alpha$", more the heat will spread out at the end of the simulation time (which is set at 5 seconds.)
\subsubsection{For thermal diffusivity (DT) as `0':}
With the diffusivity as zero, no diffusion will take place. Thus at the end of the simulation time, the temperature contour will look exactly the same as the initial contour:\\
\includegraphics[scale=0.65]{Diff_1.png}
\subsubsection{For thermal diffusivity (DT) as `0.0001':}
The thermal diffusivity is a very negligible value, consequently, very little thermal diffusion would have taken place by t=5 seconds (simulation end time).
\includegraphics[scale=0.65]{Diff_2.png}
\subsubsection{For thermal diffusivity (DT) as `0.01':}
The heat would have diffused a lot more than the previous case (as the thermal diffusivity here is a hundred times the previous value) by the end of the simulation time. In the below contour, the temperature seems to visibly ``spread out".
\includegraphics[scale=0.65]{Diff_3.png}
\subsubsection{For thermal diffusivity (DT) as `0.01':}
Corresponding to this high value of thermal diffusivity, it was observed that the heat had diffused a lot more by t=5 seconds. The red hot spot was no longer seen as all the heat had diffused outwards. This demonstrates how much quicker materials with higher diffusivity smooths out temperature gradients.
\includegraphics[scale=0.65]{Diff_4.png}
\subsection{For pure advection:}
This section studies the effect that different divergence schemes or ``divSchemes" have on the solution of the simulation of a problem involving only pure advection. The choice of divergence schemes mostly affects the advection aspect of any transport problem.
Second order truncation errors present in first order schemes (like ``upwind") are numerically dissipative in nature. The diffusive or dissipative effect of first order schemes is very useful in unstable solutions where they can smooth out numerical oscillations. The lack of this term in higher order schemes (like ``linearUpwind'') makes the solution prone to numerical oscillations and instability.Despite not inducing oscillations and being popular in the sphere of convection driven problems, first order schemes are not very accurate due to this diffusive effect; they tend to smooth out the solutions.\\
TVD (Total Variable Diminishing) schemes offer a blend between a low order scheme and a higher order scheme based on the calculation of a limiter. The value of the limiter (often denoted by ``$\psi$'') can be tuned to be a first order scheme to damp out oscillations or to a higher order scheme for more accuracy or a convenient blend between the two based on the requirement. This limiter is a function of the solution itself (gets updated with every time-step). This makes TVD schemes the best suited in dealing with the problem given for this challenge. An examole of a TVD scheme is the ``vanLeer" scheme.
\\
The temperature profiles along the length of the 'x'-axis at t=0 and t=3.5 were compared to study the effect each of these ``divSchemes'' have on the solution.
\subsubsection{For the ``upwind" scheme:}
(at t=0) \\
\includegraphics[scale=0.65]{upwind_0.png}
(at t=3.5) \\
\includegraphics[scale=0.65]{upwind_3.png}
By t=3.5, the rectangular profile became very rounded, thus demonstrating the diffusive effect that this first-order scheme has on the solution.
\subsubsection{For the ``linearUpwind" scheme:}
(at t=0)\\
\includegraphics[scale=0.65]{linearUpwind_0.png}
(at t=3.5)\\
\includegraphics[scale=0.65]{linearUpwind_3.png}
The oscillations induced by this second order scheme got worse over time. This demonstrated the instability inducing nature of higher order schemes.
\subsubsection{For the ``linearUpwind" scheme:}
(at t=0)\\
\includegraphics[scale=0.65]{quadraticLinearUpwindFit_0.png}
(at t=3.5)\\
\includegraphics[scale=0.65]{quadraticLinearUpwindFit_3.png}
Being second order accurate, this scheme induced oscillations into the solutions that worsened as the simulation went on.
\subsubsection{For the ``cubic" scheme}
(at t=0)\\
\includegraphics[scale=0.65]{cubic_0.png}
(at t=3.5)\\
\includegraphics[scale=0.65]{cubic_3.png}
This scheme is a fourth order accurate scheme. It induced strong oscillations in the solutions that worsened with time.
\subsubsection{For the ``vanLeer" scheme:}
(at t=0)\\
\includegraphics[scale=0.65]{vanLeer_0.png}
(at t=3.5)\\
\includegraphics[scale=0.65]{vanLeer_3.png}
This is a TVD scheme. The ``vanLeer" seemed the best suited out of all the schemes as it blends the dissipative effects of first order schemes with the accuracy of the higher order schemes by the calculation of a limiter. The temperature profile at t=3.5 outputted by this scheme seemed the most well-preserved.
\subsubsection{For the ``QUICK" scheme:}
(at t=0)\\
\includegraphics[scale=0.65]{quick_0.png}
(at t=3.5)\\
\includegraphics[scale=0.65]{quick_3.png}
This scheme is third order accurate. As expected of a higher order scheme, this scheme also induced oscillations in the solutions that worsened as the simulation went on. Despite being third order accurate, the ``QUICK" scheme along with the other higher order schemes have the inherent drawback of inducing numerical instability into the solution.
\end{document}