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

UDF to read cell var. based on particle position

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 27, 2014, 11:02
Default UDF to read cell var. based on particle position
  #1
Senior Member
 
Cees Haringa
Join Date: May 2013
Location: Delft
Posts: 607
Rep Power: 0
CeesH is on a distinguished road
Hello all,

I'm currently working on a routine to read local tracer gradients, based on particle position; so globally:

- Read in which cell C particle P resides at timestep T
- Update user defined scalar to take the value of C for particle P

I don't have any experience on writing UDFs (The ANSYS tutorials show how to use them, but not how to write them.) but expected the routine to be very much like the DPM_SCALAR_UPDATE macro supplied in the UDF manual.

However, when I try to literally copy this routine:

cphase_state_t *c = &(p->cphase);
p->user[0] = 0.;
viscosity_0 = c->C_YI(i);

with i the component index I want to read; it gives the error C_YI is not defined in cphase_state.
If I use

conc_0 = c->yi[i];
p->user[0] = conc_0;

The routine runs, but the output is always zero.
Probably I'm just doing something stupid, based on my lack of UDF/C programming knowledge, but I'm a bit lost in how to continue/where to look.
For example, I cannot find any comprehensive list containing accessible and variables and structures; does anybody know where to find such a list?
And of course, any ideas on how to read the local concentration would be much appreciated.

Thanks in advance!
Cees
CeesH is offline   Reply With Quote

Old   February 3, 2014, 11:14
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by CeesH View Post
- Read in which cell C particle P resides at timestep T
cell_t c = P_CELL(p);
Quote:
Originally Posted by CeesH View Post
- Update user defined scalar to take the value of C for particle P
Do you really mean user defined scalar, and not user defined memory? If you mean user defined memory:
P_USER_REAL(p,0)=C_YI(c,t,0)

It is not much, but maybe it can help you a bit.
pakk is offline   Reply With Quote

Old   February 24, 2014, 10:21
Default
  #3
Senior Member
 
Cees Haringa
Join Date: May 2013
Location: Delft
Posts: 607
Rep Power: 0
CeesH is on a distinguished road
Hello Pakk,

C_YI(c,t,0) was indeed the function I needed, thanks!
CeesH 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
how to know position of particle in PTK areriko CFX 0 November 19, 2007 21:19
udf of the "particle-body-force" for help zhaoh FLUENT 0 January 11, 2007 05:52
How to read data into my UDF??? Harshit Gupta FLUENT 3 June 15, 2006 02:34
strain rate at arbitrary position in a cell K. Kevala FLUENT 0 February 4, 2004 17:14
How can I get the particle current position in UDF cfdfans FLUENT 4 April 2, 2001 05:03


All times are GMT -4. The time now is 04:41.