CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

How to Define heat generation rate that changes with the system coordinate.

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By a19910112a
  • 1 Post By hesong

LinkBack Thread Tools Search this Thread Display Modes
Old   December 2, 2014, 06:20
Default How to Define heat generation rate that changes with the system coordinate.
New Member
Join Date: Oct 2014
Location: Cambridge,England
Posts: 22
Rep Power: 10
a19910112a is on a distinguished road
Hi Foamers,
This question was posted years ago and seems no good enough answer to it. I have the picture of the problem:

This is a very simple question similar to the planewall2D question, except the bottom air is changed by a heat generation block. I managed to do this with a constant heat generation rate and the case file is attached.

The current problem is that I want to set the heat generation rate that changes according to the system coordinate. Something like q'''=cos (x), which I think should be easily done by editing some lines in the fvOption file.

Anyone could suggest a method to do this?

I have been considering the scalarCodedSource utility, but the C++ is a little bit confusing. Anyone has an example on this? I have the officially provided example, but some illustration for the code is needed.
Attached Files
File Type: zip (36.8 KB, 30 views)
raj kumar saini likes this.

Last edited by a19910112a; December 2, 2014 at 10:18.
a19910112a is offline   Reply With Quote

Old   December 7, 2014, 05:12
Senior Member
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 159
Rep Power: 16
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
Hi a19910112a from England ,

what exactly is your problem with the codedSource and C++? The particular hooks used are explained in the sources quite well (on an average OpenFOAM level, to be fair).

If you just want to change the temperature on the walll, why don't you go for groovyBC or code your own?
"The OpenFOAM Technology Primer":
Twitter: @sourceflux_de
Interested in courses on OpenFOAM?
jhoepken is offline   Reply With Quote

Old   December 12, 2014, 03:22
New Member
Join Date: Nov 2014
Posts: 3
Rep Power: 10
hesong is on a distinguished road
you can try this
type codedFixedValue;
value uniform 0;
redirectType myFixedValue; // name of generated BC

forAll(*this, i)
scalar z = patch().Cf()[i][2];
if (z > 0 && z < 32)
(*this)[i] = 0.0075 * z -1.58;
else if (...)

#include "fvCFD.H"

raj kumar saini likes this.
hesong is offline   Reply With Quote


fvoptions, heat sources

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
Heat generation Rate MARIO276 FLUENT 3 February 20, 2013 08:57
Installing OF 1.6 on Mac OS X gschaider OpenFOAM Installation 129 June 19, 2010 09:23
Inconsistent Total Heat Transfer Rate Ken Adams FLUENT 0 July 24, 2007 11:04
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23

All times are GMT -4. The time now is 22:40.