CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF : heat source located in a solid

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 29, 2013, 05:50
Question UDF : heat source located in a solid
  #1
New Member
 
Join Date: Jul 2013
Posts: 21
Rep Power: 13
cdiako is on a distinguished road
Hello,

I am an user of FINE/Open. I would like to make a comparison with Fluent. Therefore, I need a little help in Fluent. In my domain, I have a fluid part and a solid part. In the solid, I'd like inserting a localized heat source in function of x, y and z. Is it possible? (and in the definition of the coordinates, it slightly exceeds? eg, due to an imprecise geometry, my x-coordinate exceeds of 1 mm, how Fluent work?)

You can help me to construct the udf ? if I have this coordonates for the heat source :

- x : x=0 to 0.001
- y : y=0 to 0.0015
- z : z=0.001 to 0.00012

vol=0.001*0.0015*0.0002;
HS=10/vol;

thanks a lot !
cdiako is offline   Reply With Quote

Old   July 29, 2013, 11:59
Default
  #2
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
Yes, defining a local heat source via UDF is possible. Here is part of a UDF I used for a similar purpose:

Code:
#include "udf.h"

DEFINE_SOURCE(sourceterm,c,t,dS,eqn)
{
  real x[ND_ND];          //some variable declaration
  real source;

  C_CENTROID(x,c,t);      //reads the position of the cell centroid and writes it to the field x
  source = 1.0            //instead of the constant heat source, apply whatever function f(x[0],x[1]x[2],...) you need
  return source;          //returns the value of the heatsource for the cell
}
After interpreting or compiling this UDF, you can choose "sourceterm" as a sourceterm in the domain.

The DEFINE_SOURCE macro used here loops automatically over all cells in the domain. Consequently, the source term is applied cell-wise which means it has a conatant value in a cell.
I am sure you can work out the exact function using a few if-statements. x[0] holds the x-coordinate, x[1] the y-coordinate and x[2] the z-coordinate of the cell centroid.


Edit:
Quote:
- x : x=0 to 0.001
- y : y=0 to 0.0015
- z : z=0.001 to 0.00012

vol=0.001*0.0015*0.0002;
HS=10/vol;
too many or not enough zeros...
flotus1 is offline   Reply With Quote

Old   July 30, 2013, 05:08
Default
  #3
New Member
 
Join Date: Jul 2013
Posts: 21
Rep Power: 13
cdiako is on a distinguished road
Thank you ! The code is correct like this? (indeed, I made little mistake for the z coordinate)

#include "udf.h"

DEFINE_SOURCE(sourceterm,c,t,dS,eqn)
{
real x[ND_ND];
real source;
real vol;

C_CENTROID(x,c,t);

if(x[0]=>0 && x[0]<=0.001 && x[1]=>0 && x[1]<=0.0015 && x[2]=>0.001 && x[2]<=0.0012)
{
vol=0.001*0.0015*0.0002;
source=10/vol;
}
else
{
source=0;
}

return source;
}
cdiako is offline   Reply With Quote

Old   July 30, 2013, 06:21
Default
  #4
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
Looks fine.
flotus1 is offline   Reply With Quote

Old   July 30, 2013, 08:55
Default
  #5
New Member
 
Join Date: Jul 2013
Posts: 21
Rep Power: 13
cdiako is on a distinguished road
It's strange, I have no warning in the compilation, but the temperature in the solid doesn't increase. An idea?
cdiako is offline   Reply With Quote

Old   July 30, 2013, 09:22
Default
  #6
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
Quote:
After interpreting or compiling this UDF, you can choose "sourceterm" as a sourceterm in the domain.
Did you add the source term to your domain?
Simply interpreting the UDF does not acrivate any source terms.

source_term.jpg
flotus1 is offline   Reply With Quote

Old   July 30, 2013, 09:27
Default
  #7
New Member
 
Join Date: Jul 2013
Posts: 21
Rep Power: 13
cdiako is on a distinguished road
Yes yes, I find the error. I was stupid, I made a mistake in one of the coordinates. Thank you for your help !
cdiako is offline   Reply With Quote

Old   October 8, 2013, 19:56
Default
  #8
New Member
 
David Aliaga
Join Date: Oct 2013
Posts: 4
Rep Power: 13
David UTFSM MEC is on a distinguished road
Quote:
Originally Posted by cdiako View Post
Yes yes, I find the error. I was stupid, I made a mistake in one of the coordinates. Thank you for your help !
Hey hi! i have the same problem, i need to put on mi domain a constant heat, momentum and mass source on a localized point on the cell zone ( in this case water liquid). Cause of the options of Fluent it self only allows to loop the source on all the fluid cell zone, i realized that i haved to find the way to program with UDF to indicate just a certain point, in this case the centroid of the cell. I also intempted to make two bodies and assign the fluid zone to both, but the all turns real messy with the zones that are created. My question is, this udf will help me with my problem? wich are the steps for writing my udf. IŽll really appreciated your help =D
David UTFSM MEC 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 building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 17:02
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 06:18
Simulation of a Silo Attesz CFX 20 October 15, 2010 09:11
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24
udf with moving heat source Ryan FLUENT 0 April 10, 2003 20:13


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