|
[Sponsors] |
June 4, 2023, 00:57 |
Help with DEFINE_ADJUST udf
|
#1 |
New Member
Teja
Join Date: Jan 2023
Posts: 1
Rep Power: 0 |
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. |
|
Tags |
adjust function, pressure, udf and programming |
|
|
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 |