CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT

User defined memory value changing

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By divergence

LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2017, 12:53
Default User defined memory value changing
New Member
James Kim
Join Date: Mar 2017
Posts: 13
Rep Power: 7
minhoabc is on a distinguished road
Hi guys,

In my UDF code, I'm trying to #define a value and use it as one of the factors to be included in DPM body force. However, when I set that defined value as C_UDMI (user defined memory 40) and check in the CFD-post to see if it really did stay constant, it shows me that the value have fluctuated. Anyone knows why the Fluent would change the #defined C_UDMI value on its own? Or should I use other methods to check the #defined value?

Thanks in advance,

james Kim

and Here's my code!

#include "udf.h"

#define TSTART 0.0 /* field applied at t = tstart */
#define pi 3.14159265359
#define mu0 pi*4E2
#define gravity 3.2997E-6
#define mobility 4.15E-6

cell_t c = RP_CELL(&(p->cCell));
Thread *t = RP_THREAD(&(p->cCell));

real bforce = 0.0000000000000000;

if (P_TIME(p) >= TSTART)

C_UDMI(c,t,40) = mobility;
C_UDMI(c,t,39) = pi;
if (i == 0)
bforce = 0.5*mobility*C_UDMI(c,t,1)/mu0 + gravity + P_VEL(p)[0];
else if (i == 1)
bforce = 0.5*mobility*C_UDMI(c,t,2)/mu0;
bforce = 0.0000000000000000;
/* an acceleration should be returned */
return (bforce);

Attached Images
File Type: jpg whole flow B_10_pi.jpg (168.6 KB, 25 views)
minhoabc is offline   Reply With Quote

Old   June 22, 2017, 06:50
Senior Member
KaLium's Avatar
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 7
KaLium is on a distinguished road
That is very odd. Try to remove this part from code:

C_UDMI(c,t,40) = mobility;
C_UDMI(c,t,39) = pi;
Then patch the correct values in Fluent.
KaLium is offline   Reply With Quote

Old   June 22, 2017, 07:28
Join Date: Mar 2014
Posts: 56
Rep Power: 10
divergence is on a distinguished road
A complete code noobie embarrassing myself here:

Should the

actually be

I found the "P_TIME" function via a search engine but the udf manual of Fluent R18 wouldn't have any of it. Instead it would suggest the following:

real bforce=0;
if(i==0) bforce=Q*BZ*TP_VEL(tp)[1];
else if(i==1) bforce=-Q*BZ*TP_VEL(tp)[0];
/* an acceleration should be returned */
return (bforce/TP_MASS(tp));
Naturally I wouldn't know which version of Fluent you are using but this might be a good thing to try.
KaLium likes this.

Last edited by divergence; June 22, 2017 at 09:37. Reason: grammar
divergence is offline   Reply With Quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
User Defined Memory Problem Melih FLUENT 17 February 21, 2020 08:43
[General] Paraview User defined view prapanj ParaView 3 January 3, 2014 21:54
user routine, user funcion, or fortran compile effect on the memroy? princeps11 CFX 1 May 13, 2009 19:37
User Defined Scalars - Returning Values Carlos V. FLUENT 0 April 19, 2006 19:18
Usage of user defined functions Gowrish FLUENT 1 October 26, 2005 08:44

All times are GMT -4. The time now is 12:37.