|
[Sponsors] |
UDF to read cell var. based on particle position |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 27, 2014, 12:02 |
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 |
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 |
|
February 3, 2014, 12:14 |
|
#2 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
cell_t c = P_CELL(p);
Quote:
P_USER_REAL(p,0)=C_YI(c,t,0) It is not much, but maybe it can help you a bit. |
||
February 24, 2014, 11:21 |
|
#3 |
Senior Member
Cees Haringa
Join Date: May 2013
Location: Delft
Posts: 607
Rep Power: 0 |
Hello Pakk,
C_YI(c,t,0) was indeed the function I needed, thanks! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to know position of particle in PTK | areriko | CFX | 0 | November 19, 2007 22:19 |
udf of the "particle-body-force" for help | zhaoh | FLUENT | 0 | January 11, 2007 06:52 |
How to read data into my UDF??? | Harshit Gupta | FLUENT | 3 | June 15, 2006 03:34 |
strain rate at arbitrary position in a cell | K. Kevala | FLUENT | 0 | February 4, 2004 18:14 |
How can I get the particle current position in UDF | cfdfans | FLUENT | 4 | April 2, 2001 06:03 |