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

User defined memory value changing

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By divergence

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2017, 11:53
Default User defined memory value changing
  #1
New Member
 
James Kim
Join Date: Mar 2017
Posts: 13
Rep Power: 9
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

DEFINE_DPM_BODY_FORCE(particle_body_force,p,i)
{
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;
}
else
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, 05:50
Default
  #2
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
That is very odd. Try to remove this part from code:

Code:
C_UDMI(c,t,40) = mobility;
C_UDMI(c,t,39) = pi;
Then patch the correct values in Fluent.

https://www.sharcnet.ca/Software/Flu...g/node1035.htm
KaLium is offline   Reply With Quote

Old   June 22, 2017, 06:28
Default
  #3
Member
 
Join Date: Mar 2014
Posts: 56
Rep Power: 12
divergence is on a distinguished road
A complete code noobie embarrassing myself here:

Should the

Code:
(P_TIME(p) >= TSTART)
actually be

Code:
(TP_TIME(p) >= TSTART)
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:

Code:
DEFINE_DPM_BODY_FORCE(particle_body_force,tp,i)
{
real bforce=0;
if(TP_TIME(tp)>=TSTART)
{
if(i==0) bforce=Q*BZ*TP_VEL(tp)[1];
else if(i==1) bforce=-Q*BZ*TP_VEL(tp)[0];
}
else
bforce=0.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 08:37. Reason: grammar
divergence 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Defined Memory Problem Melih FLUENT 17 February 21, 2020 07:43
[General] Paraview User defined view prapanj ParaView 3 January 3, 2014 20:54
user routine, user funcion, or fortran compile effect on the memroy? princeps11 CFX 1 May 13, 2009 18:37
User Defined Scalars - Returning Values Carlos V. FLUENT 0 April 19, 2006 18:18
Usage of user defined functions Gowrish FLUENT 1 October 26, 2005 07:44


All times are GMT -4. The time now is 23:57.