I'm solving the heat equation using the finite volume method in OpenFOAM and the way it is set up right now is to average the thermal properties of the temperature field. What I want to achieve is to implement the thermal properties that correspond to the temperature of each cell/mesh. Is there a way to do that through the solver itself or in the transportProperties file.
Attached is the code I'm using. I just replaced the source term with the volumetric power that is calculated by another code.
Code:
Info<< "\nCalculating temperature distribution\n" << endl;
while (simple.loop(runTime))
{
Info<< "Time = " << runTime.timeName() << nl << endl;
while (simple.correctNonOrthogonal())
{
solve
(
fvm::ddt(T) - fvm::laplacian(DT, T) == volPower/(RHO * CP)
);
}
#include "write.H"
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
This is the script that reads the thermal properties from the transportProperties file.
Info<< "Reading field T\n" << endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
volScalarField volPower
(
IOobject
(
"volPower",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
Info<< "Reading diffusivity DT\n" << endl;
dimensionedScalar DT
(
transportProperties.lookup("DT")
);
Info<< "Reading density RHO\n" << endl;
dimensionedScalar RHO
(
transportProperties.lookup("RHO")
);
Info<< "Reading thermal conductivity CP\n" << endl;
dimensionedScalar CP
(
transportProperties.lookup("CP")
This is how the transportProperties file is structured
DT DT [0 2 -1 0 0 0 0] 1.7620248e-5; // Diffusion Coefficent
RHO RHO [1 -3 0 0 0 0 0] 1.52082743e3; // Density
CP CP [0 2 -2 -1 0 0 0] 707.36193; // Heat Capacity
I want DT and CP to be dependant on the temperature of each cell.