CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF not working, similar results with and without UDF (https://www.cfd-online.com/Forums/fluent-udf/236991-udf-not-working-similar-results-without-udf.html)

agent June 25, 2021 03:24

UDF not working, similar results with and without UDF
 
:(
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;

}

AlexanderZ June 25, 2021 05:07

code is correct,
check units in your model
what is the unit of value 0.02 you are applying?

agent June 25, 2021 05:55

The units are mN/m3.


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