# 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: 11 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: 11 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; }