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

Temperature Dependent Heat Source

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2024, 12:37
Exclamation Temperature Dependent Heat Source
  #1
New Member
 
Asiimwe Paul
Join Date: Jun 2024
Posts: 2
Rep Power: 0
Oden is on a distinguished road
Hi All, I am trying to add a temperature dependant cooling source fvModel in a coldRoom simulation case. Below is my code:

coolingModel
{
type coded;
active yes;

codedCoeffs
{
name coolingSource;
selectionMode all; // Apply to entire mesh or specify a cellZone
// cellZone coolingZone; // Uncomment if applying to a cell zone
fields (e); // Energy field to which the source is applied

code
#{
#include "fvCFD.H"

// Access the mesh and time objects
const fvMesh& mesh = this->mesh();
const Time& runTime = mesh.time();

// Source term addition function for scalar equations
void addSup(fvMatrix<scalar>& eqn)
{
const volScalarField& T = mesh.lookupObject<volScalarField>("T");
const scalarField& V = mesh.V();
scalarField& source = eqn.source();

scalar Tmax = 280.15; // Upper temperature limit (5°C)
scalar Q = -100; // Cooling rate in W/m³

forAll(source, celli)
{
if (T[celli] > Tmax)
{
source[celli] += Q * V[celli];
}
}

Info << "Applied cooling source term at time " << runTime.timeName() << endl;
}

// Source term addition function for vector equations (if needed)
void addSup(fvMatrix<vector>& eqn)
{
// Do nothing for vector equations
}

// Correct function (called after the solution)
void correct()
{
// No corrections needed
}
#};
}
}

As much as the fvModel is executed during simulation, I don't see its impact on the temperature field as the temperature in my cold room keeps rising beyond the set threshold (Tmax) until it settles at ambient temperature.

Any ideas on how I can better this approach?
Oden is offline   Reply With Quote

Old   October 27, 2024, 19:20
Default
  #2
Senior Member
 
Desh
Join Date: Mar 2021
Location: Sydney
Posts: 118
Rep Power: 5
dasith0001 is on a distinguished road
Hi,

Just double check if you can implement a negative value for the heat source?

you can certainly decrease of power say 100 to 0 W/m^3 over specified period of time.

hope this helps
dasith0001 is offline   Reply With Quote

Reply


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
[swak4Foam] swak4foam for OpenFOAM 4.0 mnikku OpenFOAM Community Contributions 80 May 17, 2022 09:06
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 04:30
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
[foam-extend.org] problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 22:53
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 02:41


All times are GMT -4. The time now is 14:06.