|
[Sponsors] | |||||
|
|
|
#1 |
|
New Member
James Kim
Join Date: Mar 2017
Posts: 13
Rep Power: 10 ![]() |
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); } |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 10 ![]() |
That is very odd. Try to remove this part from code:
Code:
C_UDMI(c,t,40) = mobility; C_UDMI(c,t,39) = pi; https://www.sharcnet.ca/Software/Flu...g/node1035.htm |
|
|
|
|
|
|
|
|
#3 |
|
Member
Join Date: Mar 2014
Posts: 56
Rep Power: 13 ![]() |
A complete code noobie embarrassing myself here:
Should the Code:
(P_TIME(p) >= TSTART) Code:
(TP_TIME(p) >= TSTART) 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));
}
Last edited by divergence; June 22, 2017 at 09:37. Reason: grammar |
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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 |