# Setting pressure value for specific cells, UDF

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

 August 29, 2005, 14:37 Setting pressure value for specific cells, UDF #1 Amir Guest   Posts: n/a Hello, I am trying to control the pressure for few specific cells in the domain by a UDF but haven't been successful yet. as I read in the UDF manual I have to use DEFINE_ADJUST for that. now the question is how I should assign a specific value for those cells. Here's the code I wrote but doesn't work yet. The code wants to assign the pressure value of 500 for a band of cells within the +- delta width in y direction and between x1 and x2 in x direction. Any hint is appreciated /************************************************** ********* / UDF for satisfying the specific boundary conditions at / the interface ************************************************** **********/ #include "udf.h" #define delta 0.0003 #define x1 0.0532 #define x2 0.4092 #define y1 0.00635 #define y2 0.121 DEFINE_ADJUST(interface_adjust,d) { Thread *t; real x[ND_ND]; cell_t c; C_CENTROID(x, c, t); if (x[0] <= x2 & x[0] >= x1) C_P(c,t) = 100; if (x[1] > y1 - delta & x[1] < y1) C_P(c,t) = 500; if (x[1] < y1 + delta & x[1] > y1) C_P(c,t) = 500; if (x[1] > y2 - delta & x[1] < y2) C_P(c,t) = 500; if (x[1] < y2 + delta & x[1] > y2) C_P(c,t) = 500; }

 August 30, 2005, 16:41 Re: Setting pressure value for specific cells, UDF #2 Alec Eiffel Guest   Posts: n/a i think you need to put a cell loop to change the values in the cells. something like thread_loop_c(t,d) { begin_c_loop(c,t) your_code_here end_c_loop(c,t) }

 September 1, 2005, 18:59 Re: Setting pressure value for specific cells, UDF #3 Amir Guest   Posts: n/a Thanks Alec, It was certainly useful