CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Thermal conductivity as function of temperature

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By magazoni
  • 3 Post By mkraposhin

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 10, 2012, 07:32
Default Thermal conductivity as function of temperature
  #1
New Member
 
magazoni
Join Date: Jul 2012
Posts: 11
Rep Power: 14
magazoni is on a distinguished road
Hi everyone,

I'm trying to make a test with the solver laplacianFoam making the thermal conductivity as function of temperature. I'm doing something like that:

fvScalarMatrix Teqn
(
fvm::ddt(rho, T)
- fvm::laplacian(k_T(T)/Cp, T)
);
Teqn.solve();
}

My idea is create a function to calculate the thermal conductivity:

dimensionedScalar k_T(volScalarField T)
{
dimensionedScalar k1
(
"k1",
dimensionSet(1,1,-3,-2,0,0,0),
-0.0691734413
);
dimensionedScalar k2
(
"k2",
dimensionSet(1,1,-3,-1,0,0,0),
421.0792245378
);
volScalarField k;
k=k1*T+k2;
return k;
}

But it's not working. How can I do it using a function?

Thanks,
Best regards,
Felipe Magazoni
Kummi likes this.
magazoni is offline   Reply With Quote

Old   October 10, 2012, 08:42
Default
  #2
Senior Member
 
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16
Chrisi1984 is on a distinguished road
Hi Felipe,

the following code should give you an idea how to do it:

Quote:
{
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix tEqn
(
-fvm::laplacian(K, T)
);
tEqn.relax();
eqnResidual = tEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);

}

Info<< "Min/max T:" << min(T).value() << ' '
<< max(T).value() << endl;

//////////////////////////////////////

forAll(solidRegions[i].cellZones(), zoneI)
{
const cellZone& cz = solidRegions[i].cellZones()[zoneI];
const labelList& cells = cz;

if (cz.name() == "s-oc")
{
forAll(cells, iCells)
{
const label cellId = cells[iCells];
const scalar& cellT = T[cellId];

cp[cellId] = 380.68 + cellT * (0.35536 - 0.00012713 * cellT);
K[cellId] = 9.6995954 + cellT * (0.017429246 - 2.0551036e-06 * cellT);
rho[cellId] = 7920;
}
}

}


/////////////////////////////////////

}
It is an example for a steady solver, but it should not be that difficult to modify it for your time depending equation.

Don't forget to define your variables in the "createFields" file.

Kind regards

Chrisi
Chrisi1984 is offline   Reply With Quote

Old   December 31, 2012, 10:19
Default
  #3
New Member
 
Romain
Join Date: Jun 2010
Location: Lyon
Posts: 28
Rep Power: 16
nakor is on a distinguished road
hello Chrisi,
I am looking to implement something a bit similar, I would like to have a value 'a' for my thermal conductivity if the temperature is under a certain value, and a value 'b' for my thermal conductivity if the temperature is above the value.
Something like,

Code:
if (cz.name() == "s-oc")
{
forAll(cells, iCells)
{
const label cellId = cells[iCells];
const scalar& cellT = T[cellId];

cp[cellId] = 380.68 + cellT * (0.35536 - 0.00012713 * cellT);

if (cellT<273.15)
{
K[cellId] = 10;
}
else
{
K[cellId] = 100;
}

rho[cellId] = 7920;
}
}
is that possible ? I never used those kind of thermal dependent constant in my code before.

Thanks,
nakor is offline   Reply With Quote

Old   January 5, 2013, 11:54
Default
  #4
Senior Member
 
Join Date: Jan 2010
Location: Stuttgart
Posts: 150
Rep Power: 16
Chrisi1984 is on a distinguished road
Hallo Nakor,

at the minute for me it seems that your code should work.

Kind regards,

Chrisi
Chrisi1984 is offline   Reply With Quote

Old   January 6, 2013, 12:52
Default
  #5
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21
mkraposhin is on a distinguished road
I can hint a bit more elegant solution:
{
dimensionedScalar k1 (dict.lookup("k1"));
dimensionedScalar k2 (dict.lookup("k2"));
volScalarField k = k1*T + k2;
volScalarField DT = k / Cp1;

fvScalarMatrix Teqn
(
fvm::ddt(rho, T)
- fvm::laplacian(DT, T)
);
Teqn.solve();
}
cfdsolver1, amolrajan and mikulo like this.
mkraposhin is offline   Reply With Quote

Old   May 19, 2016, 19:25
Default
  #6
Member
 
Join Date: Oct 2015
Posts: 63
Rep Power: 11
Scram_1 is on a distinguished road
Hey,
I have modified the icoFoam solver to solve the energy equation by following the steps detailed in https://openfoamwiki.net/index.php/H...ure_to_icoFoam

Now, I want to make the thermal diffusivity (DT) temperature dependent.
Can someone tell me how to go about doing this? Where should I make the changes?

Thanks!!
Ram
Scram_1 is offline   Reply With Quote

Reply

Tags
function, laplacianfoam, property, temperature


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simulation of a single bubble with a VOF-method Suzzn CFX 21 January 29, 2018 01:58
Constant velocity of the material Sas CFX 15 July 13, 2010 09:56
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00
THERMAL CONDUCTIVITY FOR SOLID DOMAIN -BOUYANCY CARL CFX 1 June 9, 2006 17:44
Info: Short Course On Thermal Design of Electronic Equipment Arnold Free Main CFD Forum 0 August 10, 1999 11:18


All times are GMT -4. The time now is 13:54.