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

Help with DEFINE_ADJUST udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 4, 2023, 00:57
Default Help with DEFINE_ADJUST udf
  #1
New Member
 
Teja
Join Date: Jan 2023
Posts: 1
Rep Power: 0
kvs.teja1 is on a distinguished road
Hello,

I'm trying to modify the pressure inside a 2D axisymmetric pipe using DEFINE_ADJUST udf. But when I try to change the value of pressure to a constant value, the value in the results is different from what I have entered in the udf.
Another issue I keep having is that the UDF doesn't work as intended near the boundaries. It keeps trying to interpolate the value at the boundary with the point which lies outside and thus gives incorrect values near the boundary.

Here's my UDF:
#include "udf.h"

DEFINE_ADJUST(pr_adjust,d)
{
Thread *t;

cell_t c;

real c_volfr = 0;
real y_cell;
real c_cen[ND_ND];
real y_distance;
real new_pr;
thread_loop_c(t,d)
{

begin_c_loop(c,t)
c_volfr = C_R(c,t);
C_CENTROID(c_cen, c, t);
y_cell = c_cen[1];

if(c_volfr > 10)
{
new_pr = 100000;
C_P(c,t) = new_pr;

}


end_c_loop(c,t)
}

}


I tried to set the pressure to be 10^5 Pa everywhere at all time instances. But the contours and the plot shows different values and incorrect values near the boundaries.

Screenshot 2023-06-03 232706.png

Screenshot 2023-06-03 232812.png

Can someone help with this and let me know what is causing this issue and how do I fix this?
Should I use a different function like DEFINE_PROFILE or DEFINE_SOURCE for pressure instead? I want the pressure to be a function of y (vertical direction) at all cells.

Otherwise, can I change the way DEFINE_ADJUST does the interpolation to stop that?

Would appreciate any help. Thanks in advance.
kvs.teja1 is offline   Reply With Quote

Reply

Tags
adjust function, pressure, udf and programming


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
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 03:18
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 13:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 11:17.