CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Setting pressure value for specific cells, UDF (http://www.cfd-online.com/Forums/fluent/37741-setting-pressure-value-specific-cells-udf.html)

Amir August 29, 2005 14:37

Setting pressure value for specific cells, UDF
 
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;

}

Alec Eiffel August 30, 2005 16:41

Re: Setting pressure value for specific cells, UDF
 
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)

}

Amir September 1, 2005 18:59

Re: Setting pressure value for specific cells, UDF
 
Thanks Alec, It was certainly useful


All times are GMT -4. The time now is 04:22.