# heat source in one cell only!

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

 October 10, 2013, 14:57 heat source in one cell only! #1 New Member   David Aliaga Join Date: Oct 2013 Posts: 4 Rep Power: 3 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; }

 October 15, 2013, 17:14 help!! :( #2 New Member   David Aliaga Join Date: Oct 2013 Posts: 4 Rep Power: 3 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; }

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post yossi OpenFOAM Installation 2 October 9, 2013 01:41 ofslcm OpenFOAM 22 August 26, 2013 11:06 gocarts OpenFOAM Announcements from Other Sources 35 March 1, 2012 21:41 jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51 AB CD-adapco 6 November 15, 2004 05:41

All times are GMT -4. The time now is 16:36.