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

UDF not working, similar results with and without UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 25, 2021, 04:24
Exclamation UDF not working, similar results with and without UDF
  #1
New Member
 
Pseudo Saiyan
Join Date: Jun 2021
Posts: 2
Rep Power: 0
agent is on a distinguished road

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;

}
agent is offline   Reply With Quote

Old   June 25, 2021, 06:07
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
AlexanderZ is offline   Reply With Quote

Old   June 25, 2021, 06:55
Default
  #3
New Member
 
Pseudo Saiyan
Join Date: Jun 2021
Posts: 2
Rep Power: 0
agent is on a distinguished road
The units are mN/m3.
agent is offline   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



All times are GMT -4. The time now is 18:20.