|
[Sponsors] |
UDF not working, similar results with and without UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 25, 2021, 04:24 |
UDF not working, similar results with and without UDF
|
#1 |
New Member
Pseudo Saiyan
Join Date: Jun 2021
Posts: 2
Rep Power: 0 |
Hey all, My prof asked me to write a UDF for a body force term and simulate it for a flow over a flate plate at a certain location of the domain. This code doesnt seem to have any effect on the solution. Here are the steps I followed: 1. Interpreted the UDF 2. Hooked the UDF in the cell zone conditions as X_Momentume Source term 3. Used SIMPLE method (I am not sure if this has something to do with the solution being the same, I am a noob in this field) and nearly 6000 iterations. Here is the code #include "udf.h" #define CON 0.02 DEFINE_SOURCE(cell_x_source, cell, thread, dS, eqn) { real source; real xc[ND_ND]; /* 3D position in array */ C_CENTROID(xc,cell,thread); /* outputs xc (cell centroid) */ if((xc[0] >0.1)&&(xc[0] < 0.105)&& (xc[1] > 0)&&(xc[1] < 0.001)) /*restriction of the body force*/ { source=CON; dS[eqn]=0; } else { source=0; dS[eqn]=0; } return source; } |
|
June 25, 2021, 06:07 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
code is correct,
check units in your model what is the unit of value 0.02 you are applying?
__________________
best regards ****************************** press LIKE if this message was helpful |
|
June 25, 2021, 06:55 |
|
#3 |
New Member
Pseudo Saiyan
Join Date: Jun 2021
Posts: 2
Rep Power: 0 |
The units are mN/m3.
|
|
|
|