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

any macros to get this?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By `e`
  • 1 Post By `e`

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 10, 2016, 22:02
Default any macros to get this?
  #1
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 13
hwet is on a distinguished road
Good day

I want a udf for the discrete phase to be activated only when the particle passes through a cell with a specific property.

For example, the DEFINE_DPM_BC is activated only when the particle hits a wall. But, here I am trying to activate the UDF while the particle is travelling away from the walls and only when it passes through a cell with a certain property.

To be specific the cells representing a different eulerian phase which is moving constantly as well. So the UDF is called only when the particle enters such a cell.

Is this even possible to achieve? Am i looking at a DEFINE_ON_DEMAND macro? Usually the DPM macros are called at everytime step but this wont be very efficient in my case where the cell occupied by the eulerian phase is only a small fraction of the total number of cells.
hwet is offline   Reply With Quote

Old   February 11, 2016, 05:14
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
The DEFINE_ON_DEMAND macro is only executed when you manually enable it (unless you're using scripts). The DEFINE_DPM_SCALAR_UPDATE macro is called each time a particle position is updated. With conditional statements, you can restrict when code is executed and this method is generally quick (I can't think of a more elegant solution). For an arbitrary example, a particle travelling away from a wall (on the XZ plane) within a cell of a high velocity:

Code:
DEFINE_DPM_SCALAR_UPDATE(certain_particles,c,t,initialise,p)
{
	if (P_VEL(p)[1] > 0. && C_U(c, t) > 1.)
	{
		// a code block
	}
}
If, however, you wanted to modify the force acting on the particle in certain regions of your domain then you could use the DEFINE_DPM_BODY_FORCE macro.

Code:
DEFINE_DPM_BODY_FORCE(certain_particles_force,p,i)
{
	cell_t c;
	Thread *t;

	c = P_CELL(p);
	t = P_CELL_THREAD(p);

	if (P_VEL(p)[1] > 0. && C_U(c, t) > 1.)
	{
		// a code block
	}
}
hwet likes this.

Last edited by `e`; February 11, 2016 at 23:10.
`e` is offline   Reply With Quote

Old   February 11, 2016, 19:23
Default
  #3
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 13
hwet is on a distinguished road
Aren't these already passed in the macro?

Code:
DEFINE_DPM_SCALAR_UPDATE(certain_particles,''c'',''t'',initialise,p)
Why would we need this then?.
Code:
cell_t c;
Thread *t;

c = P_CELL(p);
t = P_CELL_THREAD(p);
hwet is offline   Reply With Quote

Old   February 11, 2016, 23:09
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Woops, that's correct: you won't need to find the cell number and thread for the DEFINE_DPM_SCALAR_UPDATE macro (already provided) but it's required for DEFINE_DPM_BODY_FORCE (only provides the particle and direction index).
hwet likes this.
`e` 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
Some guidance is needed about UDF macros highhopes Fluent UDF and Scheme Programming 2 July 3, 2012 09:41
Tecplot360 - Macros calling Macros? eRzBeNgEl CFX 1 April 15, 2011 06:32
help with macros F_ID and C_ID Jack Martinez FLUENT 0 August 19, 2007 08:27
What are UDF macros C_T_S , C_T_AP,...???? Asghari FLUENT 0 January 28, 2007 10:54
Orientation of Face Variable Macros hirokata FLUENT 0 February 17, 2006 00:12


All times are GMT -4. The time now is 19:57.