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

Using a C_UDMI defined in one UDF in another UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2018, 19:23
Default Using a C_UDMI defined in one UDF in another UDF
  #1
New Member
 
Matt
Join Date: Mar 2018
Posts: 11
Rep Power: 8
sthinmind is on a distinguished road
I use a C_UDMI to calculate the number of particles that deposit on a wall as:

DEFINE_DPM_BC(Deposition,p,t,f,f_normal,dim)
{
#if !RP_HOST
Thread *tcell=P_CELL_THREAD(p);
cell_t c=P_CELL(p);
Domain *d;
d=Get_Domain(1);
C_UDMI(c,tcell,0) += 1.;
return PATH_ABORT;
#endif
}

Then, I want to use this C_UDMI in another UDF to move the mesh where particles are deposited:

DEFINE_GRID_MOTION(beam,domain,dt,time,dtime)
{
Thread *tf;
face_t f;
int n;
Node *v;
/* get the thread pointer for which this motion is defined */
tf=DT_THREAD(dt);
begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);
......
......C_UDMI.......
......
}
}
end_f_loop(f,tf);
}



Is this possible? Can anyone help how to do this?

Thanks,

Last edited by sthinmind; March 31, 2018 at 13:10.
sthinmind is offline   Reply With Quote

Old   March 31, 2018, 03:18
Default
  #2
New Member
 
Doruk Yelkenci
Join Date: Apr 2017
Posts: 20
Rep Power: 9
doruk is on a distinguished road
real G;
G=C_UDMI(c,t,0); will allow you to use it on another define macro

but above you are trying to use cell data in face node loop. You cant transfer data like that
doruk is offline   Reply With Quote

Old   March 31, 2018, 11:36
Default
  #3
New Member
 
Matt
Join Date: Mar 2018
Posts: 11
Rep Power: 8
sthinmind is on a distinguished road
Thanks for your response. So does G have all information that C_UDMI has?(cell information and stored values)
Do I need to define G in the second UDF as well? Something like:

DEFINE_GRID_MOTION(beam,domain,dt,time,dtime)
{
Thread *tf;
face_t f;
int n;
Real G

....
sthinmind is offline   Reply With Quote

Old   March 31, 2018, 12:45
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by sthinmind View Post
I use a C_UDMI to calculate the number of particles that deposit on a wall as:

DEFINE_DPM_BC(OSU_Deposition_Model_R1,p,t,f,f_norm al,dim)
{
#if !RP_HOST
Thread *tcell=P_CELL_THREAD(p);
cell_t c=P_CELL(p);
Domain *d;
d=Get_Domain(1);
C_UDMI(c,tcell,0) += 1.;
return PATH_ABORT;
#endif
}

Then, I want to use this C_UDMI in another UDF to move the mesh where particles are deposited:

DEFINE_GRID_MOTION(beam,domain,dt,time,dtime)
{
Thread *tf;
face_t f;
int n;
Node *v;
/* get the thread pointer for which this motion is defined */
tf=DT_THREAD(dt);
begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);
......
......C_UDMI.......
......
}
}
end_f_loop(f,tf);
}



Is this possible? Can anyone help how to do this?

Thanks,
Yes, it is possible. It is even simpler than your code.

In your UDF "OSU_Deposition_Model_R1", you now store face data in a C_UDMI, by first finding the associated cell. You can skip that step, and directly store it in F_UDMI(f,t).

Code:
DEFINE_DPM_BC(OSU_Deposition_Model_R1,p,t,f,f_normal,dim)
{
#if !RP_HOST
F_UDMI(f,t,0) += 1.; 
return PATH_ABORT;
#endif	
}
And in your other code, you can simply extract the data with F_UDMI(tf,t).
pakk is offline   Reply With Quote

Old   April 1, 2018, 21:20
Default
  #5
New Member
 
Matt
Join Date: Mar 2018
Posts: 11
Rep Power: 8
sthinmind is on a distinguished road
Thanks for your response.

I guess I need the nodal values in DEFINE_GRID_MOTION to move the mesh? How do I store the same value (F_UDMI) in the neighboring nodes? How do I find the nodes around a the face f? (In 2D there are two nodes at two sides of the face)
sthinmind is offline   Reply With Quote

Reply

Tags
dpm fluent, dynamic meshing, user defined memory


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
Not able to use Interpreted in User Defined Function (UDF) Touré FLUENT 0 March 8, 2017 20:15
UDF error:strcpy has already been defined in the curren alinik FLUENT 0 November 2, 2016 21:17
Velocity inlet user defined function UDF in fluent Ammofreak Fluent UDF and Scheme Programming 0 January 14, 2014 05:59
Fluent User defined Scalars and UDF Anirudh_Deodhar Fluent UDF and Scheme Programming 0 February 16, 2011 21:16
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 11:50.