CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

how to express a heat source term which depends on coordinate

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 22, 2012, 08:34
Default how to express a heat source term which depends on coordinate
  #1
New Member
 
kob
Join Date: Nov 2011
Posts: 28
Rep Power: 5
bryant_k is on a distinguished road
Hello everyone
I am doing a heat transfer problem with source term. Source term itself depends on the x,y coordinates. The expression of the volumetric heat source is:
Code:
when -0.2<x<0.2,-0.3<y<0.3
q=20*exp(-10*y)
otherwise 
q=0
should I use the functionSetFields? If I don't use the function,can you tell me how to write the code when declaring the heat soure q?

There is another question which is related to the x,y coordinate.
Is it correct to express it like:
Code:
volScalarField x = mesh.C().component(vector::X);
volScalarField y = mesh.C().component(vector::Y);
or
Code:
pos().x
pos().y
what is the difference between them?

regards!

bryant
bryant_k is offline   Reply With Quote

Old   August 25, 2012, 07:37
Default
  #2
New Member
 
kob
Join Date: Nov 2011
Posts: 28
Rep Power: 5
bryant_k is on a distinguished road
Can you tell me about the above things if you know about that?
Thank you very much!

regards!

bryant
bryant_k is offline   Reply With Quote

Old   April 7, 2013, 23:54
Default
  #3
Member
 
Neilson Whit
Join Date: Aug 2011
Location: USA
Posts: 48
Rep Power: 5
wolfindark is on a distinguished road
Dear bryant_k

did you find the solution? I am also working on it...
pleased if you can inform me.
wolfindark is offline   Reply With Quote

Old   April 8, 2013, 02:22
Default
  #4
Senior Member
 
Mohammad Shakil Ahmmed
Join Date: Oct 2012
Location: AU
Posts: 122
Rep Power: 5
ahmmedshakil is on a distinguished road
@ wolfindK
you can easily use funkySetFields utility, it's easy to apply, http://openfoamwiki.net/index.php/Co...funkySetFields
ahmmedshakil is offline   Reply With Quote

Old   April 9, 2013, 15:10
Default
  #5
Senior Member
 
chegdan's Avatar
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 535
Rep Power: 18
chegdan will become famous soon enough
@wolfindark

Have you looked at using the new fvOptions capabilities? Here I have defined a source names "energySource1" with a time duration at a single point. The injection rate coefficients are specified as pairs of Su-Sp coefficients e.g. h (10 0) where the 10 is the explicit component and 0 is the implicit component. This is a linearized source term (read Patankar's book for more details and a source of this method)

Code:
	energySource1
	{
		type            scalarSemiImplicitSource;
		active          true;
		timeStart       0.2;
		duration        2.0;
		selectionMode   points;
		points
		(
		    (2.75 0.5 0)
		);

		scalarSemiImplicitSourceCoeffs
		{
		    volumeMode      absolute;
		    injectionRateSuSp
		    {
		        h           (10 0);
		    }
		}
	}
for selectionMode you can use cellZone and then choose a cellZone where you want a heat source to be. For more information, look at the source files located at

Code:
$FOAM_SRC/fvOptions/sources/general/semiImplicitSource
good luck
__________________
Dan

Find me on twitter @dancombest and LinkedIn

Last edited by chegdan; April 9, 2013 at 17:29.
chegdan is offline   Reply With Quote

Old   April 9, 2013, 22:57
Default
  #6
Member
 
Neilson Whit
Join Date: Aug 2011
Location: USA
Posts: 48
Rep Power: 5
wolfindark is on a distinguished road
Thank you chegdan,

For my case I needed a constant heat source, therefore, I used another method which was mentioned in this forum sometime ago. I just added explicit source term to temperature equation (in TEqn.H). Then I set the field values with setFields, a spherical heat source covering a particular region in fluid region.
So it works fine until now.

I am not sure but if time dependency is needed, it can be implemented in TEqn.H, What do you think..?
wolfindark is offline   Reply With Quote

Old   April 10, 2013, 09:14
Default
  #7
Senior Member
 
chegdan's Avatar
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 535
Rep Power: 18
chegdan will become famous soon enough
Quote:
I am not sure but if time dependency is needed, it can be implemented in TEqn.H, What do you think..?
Yes, anything is possible but it will require programming and if are comfortable with that then that is a good option.
__________________
Dan

Find me on twitter @dancombest and LinkedIn
chegdan is offline   Reply With Quote

Old   November 29, 2013, 07:19
Default
  #8
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 490
Rep Power: 9
samiam1000 is on a distinguished road
Dear All,

pardon the interruption. I have a question about fvOption and I think you can help me.

I would like to add a body force on certain cells.

I have tried to write something like

Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

momentumSource
{
    type            vectorExplicitSetValue;
    active          on;            //on/off switch
    selectionMode   all;       //cellSet // points //cellZone

    vectorExplicitSetValueCoeffs
    {
        injectionRate
        {
            F    ( 0.1335 0 0 );
        }
    }
}
But I cannot und how to tell OpenFOAM that F is a force. Is that possible?

Thanks a lot,
Samuele
samiam1000 is offline   Reply With Quote

Old   December 1, 2014, 16:32
Default
  #9
New Member
 
zech
Join Date: Oct 2014
Location: Cambridge,England
Posts: 21
Rep Power: 2
a19910112a is on a distinguished road
Does scalarSemiImplicitSourceCoeffs{ h (10,0)} mean that the source is S=10+0*x, where S is the magnitude of the source and x is the coordinate. If that is true, then:
1.this method is applicable when the source is linearly related to the coordinate. What if it is not a linear function. Such as a cosine or experiential function?
2.Even worse, it is not even an function: it's just a matrix of random numbers.
3. what if the value is changing in both x and y direction?
a19910112a is offline   Reply With Quote

Reply

Tags
heat source

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12
GPU Linear Solvers for OpenFOAM gocarts OpenFOAM Announcements from Other Sources 35 March 1, 2012 21:41
UDF source term jerome_ FLUENT 2 July 11, 2011 11:55
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
Source Term in Cylindrical Coordinate. Apurv Main CFD Forum 0 January 26, 2000 08:15


All times are GMT -4. The time now is 02:55.