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

heat source in one cell only!

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 10, 2013, 14:57
Default heat source in one cell only!
  #1
New Member
 
David Aliaga
Join Date: Oct 2013
Posts: 4
Rep Power: 12
David UTFSM MEC is on a distinguished road
Hey hi! 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. iīm trying with this udf, wich i find on this forum, but i have a question.

the c_centroid, will loop on all cell zoneīs and will add the source to the cellīs wich centroid applys to the conditional "If". how is the best way to write the If sentence to point to just one cell?

thx!

#include "udf.h"

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

C_CENTROID(x,c,t);

if ((x[0]>=-1.) && (x[0]< 1.) && (x[1]>= -1.) && (x[1]<= 1.) && (x[2]>= -1.) && (x[2]<= 1.))
{
source = 30.;
}
else
{
source = 0.;
}
return source;
}
David UTFSM MEC is offline   Reply With Quote

Old   October 15, 2013, 17:14
Unhappy help!! :(
  #2
New Member
 
David Aliaga
Join Date: Oct 2013
Posts: 4
Rep Power: 12
David UTFSM MEC is on a distinguished road
Hi, some one can help me? ive been working on this udf. i realized that the source must be divided for the cell volume ( or the total cells that applys with the conditional if) so i added another macro to wich integrates de volume. I hope someone coud help me. my bests...

#include "udf.h"



DEFINE_ADJUST(my_adjust,d)
{
/* Integrate volume. */
Thread *t;
real x[ND,ND], sum_vol=0.;
cell_t c;
thread_loop_c(t,d)
{
begin_c_loop(c,t)

C_CENTROID(x,c,t);
if((x[0]>=-2.) && (x[0]< 2.) && (x[1]>= -5.) && (x[1]<= 5.) && (x[2]>= -5.) && (x[2]<= 5.))
{
sum_vol += C_VOLUME(c,t);
}
end_c_loop(c,t)
}
printf("Volume integral: %g\n", sum_vol);
}




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


C_CENTROID(x,c,t);

if ((x[0]>=-2.) && (x[0]< 2.) && (x[1]>= -5.) && (x[1]<= 5.) && (x[2]>= -5.) && (x[2]<= 5.))
{

source = 20./sum_vol;
}
else
{
source = 0.;
}
return source;
}
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
GPU Linear Solvers for OpenFOAM gocarts OpenFOAM Announcements from Other Sources 37 August 17, 2022 14:22
[swak4Foam] groovyBC in openFOAM-2.0 for parabolic velocity bc ofslcm OpenFOAM Community Contributions 25 March 6, 2017 10:03
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 01:41
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
Warning 097- AB Siemens 6 November 15, 2004 04:41


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