Week 5 Challenge- Creating a test case in OpenFOAM
Creating a test case in OpenFOAM:
1. Create a .cpp file starting with:
#include "fvCFD.H"
int main( int argc, char *argv[] )
{
Foam::argList::noBanner();
Foam::argList args(argc, argv);
...
}
ANS:
#include "fvCFD.H"
//using namespace Foam;
int main(int argc, char *argv[])
{
//Foam::argList::noBanner(); //if you turn it off, this will print the OpenFOAM banner on the screen
Foam::argList args(argc, argv);
Foam::Time runTime
(
//Foam::Time::controlDictName,
args.rootPath(),
args.caseName()
);
IOdictionary ioDictObj
(
IOobject
(
"thermalProperties",
//runTime.constant(),
runTime,
//mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
/*double nu,T;
nu=ioDictObj.lookup("nu");
T=ioDictObj.lookup("T");*/
scalar T = readScalar(ioDictObj.lookup("T"));
scalar nu = readScalar(ioDictObj.lookup("nu"));
/*vector nu = vector( ioDictObj.lookup("nu"));
vector T = vector( ioDictObj.lookup("T"));*/
Info<
Copy the cavity problem from $FOAM_TUTORIALS/incompressible/icoFoam. Find the value assigned to: transportModel & kinematic viscosity (nu) stored in a dictionary file transportProperties.
Rename the file transportProperties to thermalProperties
- Add variable T in the dictionary and assign a value to it
- Print the value of all the constituent variables in thermalProperties file



Rename the file transportProperties to thermalProperties


Add variable T in the dictionary and assign a value to it

Make ->files

Make->options:

After Execution:

We can find here, the value of the constituent variables in thermalProperties file after execution = 0.01, 300