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

Setting pressure value for specific cells, UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 29, 2005, 15:37
Default 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;

}
  Reply With Quote

Old   August 30, 2005, 17:41
Default 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)

}
  Reply With Quote

Old   September 1, 2005, 19:59
Default Re: Setting pressure value for specific cells, UDF
  #3
Amir
Guest
 
Posts: n/a
Thanks Alec, It was certainly useful
  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
correct UDF code for unsteady pressure boundary James W FLUENT 0 November 2, 2005 12:38
physical boundary error!! kris Siemens 2 August 3, 2005 01:32
Warning 097- AB Siemens 6 November 15, 2004 05:41
UDF: neighbour cells, upwind cells Dmitriy Makarov FLUENT 0 February 18, 2001 14:53
Hydrostatic pressure in 2-phase flow modeling (long) DS & HB Main CFD Forum 0 January 8, 2000 16:00


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