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

UDF placing volumetric heat source in exact region

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 16, 2014, 07:23
Default UDF placing volumetric heat source in exact region
  #1
Member
 
Rafal
Join Date: Aug 2013
Location: CK
Posts: 36
Rep Power: 12
vekh is on a distinguished road
Hello,
I'm trying to place volumetric heat source in specified region. My domain extents:
0<x<=0.02
0<y<=0.02
0<z<=0.01
I would like to apply heat source at region:
0.0075<x<0.00125
0.0075<y<0.00125
0.0004<z<0.0005
I wrote condition:
Code:
xc=x[0];
yc=x[1];
zc=x[2];
(...)
if ((0.0075<xc<0.00125)&&(0.0075<yc<0.00125)&&(0.0004<zc<0.0005))
{
source = I_0/(3.14*omega*omega);
dS[eqn] = 0.0;
}
else
{
source = dS[eqn] = 0.;
}
The first two conditions (for x and y) works fine, but z condition doesn't work. It's looks like there is no limitation for this dimmension.
Can you help with that problem?
vekh is offline   Reply With Quote

Old   September 17, 2014, 08:08
Default
  #2
Senior Member
 
Cees Haringa
Join Date: May 2013
Location: Delft
Posts: 607
Rep Power: 0
CeesH is on a distinguished road
Hi Vekh,

Wouldn't it be easier to create a separate cell zone in your domain within the mesh, and enable the source term on that location only, if the location is fixed anyway?

Best,
Cees
CeesH is offline   Reply With Quote

Old   September 17, 2014, 08:52
Default
  #3
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 12
upeksa is on a distinguished road
I guess you have obtained the coordinates of the cell with the function C_CENTROID. In that case, you will get the coordinates of the cell centroid.
The region you have limited with the z coordinate is very small, so although you have a cell in that area, perhaps you do not have a cell centroid coordinate in it.
You can simply check that with an UDF like "if 0.0004<z<0.0005, C_UDMI = true", and then create an iso-surface and see if any cell is found.

Cheers
upeksa is offline   Reply With Quote

Old   September 17, 2014, 10:52
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Maybe you have to replace
Code:
if ((0.0075<xc<0.00125)&&(0.0075<yc<0.00125)&&(0.0004<zc<0.0005))
by
Code:
if ((0.0075<xc)&&(xc<0.00125)&&(0.0075<yc)&&(yc<0.00125)&&(0.0004<zc)&&(zc<0.0005))
Mathematically, "0.0075<xc<0.00125" is clear, but for a computer program, "0.0075<xc<0.00125" means "first see if 0.0075 is smaller than xc, and then see if the result of that is smaller than 0.00125".
In other words: if xc is 0.002:
"0.0075<xc<0.00125" is equal to "0.0075<0.002<0.00125" is equal to "(0.0075<0.002)<0.00125" is equal to "FALSE<0.00125" is equal to "0<0.00125" is equal to "TRUE", which is not what you intended.

I am surprised that it gave correct results for x and y, I would expect it to give unwanted results in all three dimensions.
pakk 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
chtMultiRegionSimpleFoam: modelling a heat source in a solid region zfaraday OpenFOAM Pre-Processing 10 February 18, 2019 14:17
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 10:57
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 11:44
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
heat source UDF error co2 FLUENT 8 May 18, 2004 07:47


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