Week 5 Challenge- Creating a test case in OpenFOAM
Here, first I copied the cavity problem from $FOAM_TUTORIALS/incompressible/icoFoam into my run folder. Here from the icoFoam/cavity/cavity folder i just copied the constant folder and system folder into my run folder.

Then renamed the transportProperties file into thermalProperties fiile by usnig mv command as shown in following fig.

Then inside the thermalProperties file i added Temperature term as T and assigned a value to it. And the text file is shown below.
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object thermalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu 0.01;
T 200;
// ************************************************************************* //
Then I created a C file called thermal.C and created an appropriate IOobject as 'ioDictObj' that reads the data inside the thermalProperties file, and assign the values to the scalar terms T and nu. And the thermal.C file code is given below.
#include "fvCFD.H"
int main( int argc, char *argv[])
{
Foam::argList::noBanner();
Foam::argList args(argc,argv);
Foam::Time runTime
(
Foam::Time::controlDictName,
args.rootPath(),
args.caseName()
);
IOdictionary ioDictObj
(
IOobject
(
"thermalProperties",
"constant",
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
// read and assign the "T" and "nu" variables as scalar
scalar T = readScalar (ioDictObj.lookup("T"));
scalar nu =readScalar (ioDictObj.lookup("nu"));
Info << "T = " << T nu = " << nu << Foam::endl;
return 0;
}
To run this code by using wmake command it need a Make folder that contants files and options. So I just copies the Make folder from the icoFoam solver into the run folde as shown below.

Then I did some changes in Make/files as shown below.
thermal.C
EXE = thermalread
and Make/options as shown below.
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools
Then run the code by using wmake command ad the results are attached below.
And by running ./thermalread command to read the EXE file, it results as follows,