CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   User Defined Memory Problem (http://www.cfd-online.com/Forums/fluent/33784-user-defined-memory-problem.html)

Melih May 22, 2004 07:02

User Defined Memory Problem
 
Hi everbody,

I have a problem that may be a common problem for Fluent Users. I want to see pressure values of a wall by User Defined Memory at every iteration. The thing is that the pressure values are transfered to F_UDMI(t,f,0) in my UDF, but I can not see them in FLUENT. I mean, every values of F_UDMI(t,t,0) are zero in contour values windows in FLUENT. Here is the simple UDF that transfers pressure values to F_UDMI(t,f,0). Could you please tell me what is wrong with it?

#include "udf.h"

DEFINE_ADJUST(wall_pressure,domain)

{ face_t f;

int ID = 8;

/* Zone ID for wall zone */

Thread *t = Lookup_Thread(domain, ID);

begin_f_loop(f, t)

{

F_UDMI(f,t,0) = F_P(f,t);

Message("pressure %e\n",F_UDMI(f,t,0));

}

end_f_loop(f, t)

}

Andrew Garrard May 24, 2004 04:31

Re: User Defined Memory Problem
 
I have had exactly the same problem with the UDMI macro and the good people at the fluent USC couldn't help me much. I had to use a "dirty trick" to get around this one. If you assign the value of the F_UDMI to the adjcent cell you should then be able to see it in, say, a contour or XY plot with in fluent. If you need help doing this I can help you out with the source code, but you seem to know what you are doing, so I will leave it for the moment.

I hope this helps, happy coding.

ap May 25, 2004 04:20

Re: User Defined Memory Problem
 
I had the same problem too. Maybe it's a bug of FLUENT.

Hi :)

ap

dp May 25, 2004 21:39

Re: User Defined Memory Problem
 
Have had a similiar problem, and the bug seams to go away (if the same bug) by first viewing the udm with contours (should be all zeros), then run your udf and then replot. It appears that viewing the udm initializies it for use (atleast thats one interpretation).

s.m.saad jamil July 16, 2016 06:47

problem regarding user defined memory
 
i am trying to calculate source term for X-momentum equation by calculating first the average temperature in a mixed convection case.
I want to store the value of mean temperature using user defined memory and use this value to calculate source term in xmomentum equation.
i have written the UDF mentioned below:
#include "udf.h"
DEFINE_ON_DEMAND(on_demand_calc)
{
real tavg;
real temp,volume,vol_tot;
Domain*d;
Thread*t;
int i;
cell_t c;
tavg = 0.;
vol_tot = 0.;
d = Get_Domain(1);
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
volume = C_VOLUME(c,t);
temp = C_T(c,t)-273.5;
vol_tot += volume;
tavg += temp*volume;
}
end_c_loop(c,t)
tavg = tavg/vol_tot;
}
printf("Tavg = %g\n",tavg);
printf("volume = %g\n",volume);
printf("vol_tot = %g\n",vol_tot);
printf("temp = %g\n",temp);
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,0) = tavg;
}
end_c_loop(c,t)
}
}
DEFINE_SOURCE(mom_source,c,t,dS,eqn)
{
real x[ND_ND];
real source;
C_CENTROID(x,c,t);
source= 1.-5.33*(C_T(c,t)-C_UDMI(c,t,0));
dS[eqn]=0.;
return source;
}

but i am getting zero value when i am trying to plot the user defined memory.

please help me regarding this.

Regards

saad


All times are GMT -4. The time now is 05:36.