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

Periodic BC in ANSYS DDPM, UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 12, 2016, 11:31
Default
  #41
Member
 
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13
roopesh99 is on a distinguished road
Dear Friend,
Thanks a lot for your's strong help and guidance. Presently, i made changes according to your suggestion. It is working good for rectangle geometry. When, i am using inlet and out is equal to 2 cm [i also used mesh size 2cm and particle size dia 1.5cm], then particles are not recycling.
See that attached figures for detail. Can say, in figure 1 small inlet as well as small outlet and in fig no. 2 used wider inlet and small outlet, but both cases are not working.
Note:Particle reaching to the top boundary and recycle txt file generated but particles not recycling.
Note: Pls try your case also for small inlet and outlet and can see yourself.
Pls suggest the solution for operating this type cases.
My second question, can we give recycle particle inlet in 3d at some fixed inlet point?
// send particle to the inlet boundary
P_POS(p)[2] = 0.;
P_POS(p)[0] = 0.15;
P_POS(p)[1] = 0.075;
or in 2d
P_POS(p)[2] = 0.;
P_POS(p)[0] = 0.15;
Thank you!!
Attached Images
File Type: jpg mytrycase1.jpg (60.0 KB, 17 views)
File Type: jpg mytrycase2.jpg (61.0 KB, 10 views)

Last edited by roopesh99; March 14, 2016 at 01:39.
roopesh99 is offline   Reply With Quote

Old   March 29, 2016, 08:57
Default
  #42
Member
 
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13
roopesh99 is on a distinguished road
Dear friend, i have one question, how can we write information in txt file about particles again enter with which velocity, after recycled by UDF?

Last edited by roopesh99; March 30, 2016 at 04:36.
roopesh99 is offline   Reply With Quote

Old   March 30, 2016, 04:35
Default
  #43
Member
 
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13
roopesh99 is on a distinguished road
Dear friend,
i want to see inlet and oulet velocity of recycle. Can i use P_POS0(p)[0 or 2 or 3] and P_POS(p)[0 or 2 or 3] together in fprintf. My second question is for recycling the particles, particle velocity not matter, only touch to thread,face etc. works.
roopesh99 is offline   Reply With Quote

Old   April 4, 2016, 20:44
Default
  #44
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Quote:
Originally Posted by roopesh99 View Post
Presently, i made changes according to your suggestion. It is working good for rectangle geometry. When, i am using inlet and out is equal to 2 cm [i also used mesh size 2cm and particle size dia 1.5cm], then particles are not recycling.
How are they not recycling, where are the particles terminating and what is your UDF and geometry coordinates (specifically, the inlet and outlet)?

Quote:
Originally Posted by roopesh99 View Post
Note:Particle reaching to the top boundary and recycle txt file generated but particles not recycling.
Are the particles stuck or escaped?


Quote:
Originally Posted by roopesh99 View Post
My second question, can we give recycle particle inlet in 3d at some fixed inlet point?
// send particle to the inlet boundary
P_POS(p)[2] = 0.;
P_POS(p)[0] = 0.15;
P_POS(p)[1] = 0.075;
or in 2d
P_POS(p)[2] = 0.;
P_POS(p)[0] = 0.15;
Yes, this code should scale fine with three dimensions. In 2-D, you'll need to use P_POS(p)[0] (x-coordinate) and P_POS(p)[1] (y-coordinate). For 3-D, you'll also include the P_POS(p)[2] macro for the z-coordinate. You've mentioned the z-coordinate for the 2-D case.

Quote:
Originally Posted by roopesh99 View Post
how can we write information in txt file about particles again enter with which velocity, after recycled by UDF?
You can add additional variables to the data file, including velocity by modifying the fprintf line (added after the positions):

Code:
fprintf(fp,"%e %e %e %e %e %e %d %e\n",P_POS(p)[0],P_POS(p)[1],P_POS(p)[2],P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2],p->part_id,P_TIME(p));
Quote:
Originally Posted by roopesh99 View Post
want to see inlet and oulet velocity of recycle. Can i use P_POS0(p)[0 or 2 or 3] and P_POS(p)[0 or 2 or 3] together in fprintf. My second question is for recycling the particles, particle velocity not matter, only touch to thread,face etc. works.
The velocity before and after the recycle is unchanged and this value is copied to the data file with the procedure above. You could include the P_POS0 macro as well; the indices should be 0, 1 and 2 (not 3).
`e` is offline   Reply With Quote

Old   April 5, 2016, 15:01
Default
  #45
Member
 
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13
roopesh99 is on a distinguished road
Dear Friend, thanks a lot for nice reply, my first question is why you used the P_USER_REAL(p,0) and P_USER_REAL(p,1) both . Second, you are only updating only to P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1 not to P_USER_REAL(p,1)

Last edited by roopesh99; April 6, 2016 at 01:37.
roopesh99 is offline   Reply With Quote

Old   April 15, 2016, 06:41
Default
  #46
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Quote:
Originally Posted by roopesh99 View Post
my first question is why you used the P_USER_REAL(p,0) and P_USER_REAL(p,1) both
The first memory, P_USER_REAL(p,0), is used for storing the number of times this parcel has been recycled. The second memory, P_USER_REAL(p,1), is used as a flag which is true when the particle has reached the outlet area (it's a fix as Fluent was calling this macro multiple times before updating the particle position to the inlet).

Quote:
Originally Posted by roopesh99 View Post
Second, you are only updating only to P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1 not to P_USER_REAL(p,1)
Yes, that's intentional (see above).
`e` is offline   Reply With Quote

Old   April 17, 2016, 02:53
Default
  #47
Member
 
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13
roopesh99 is on a distinguished road
Thanks for such guidance... bye
roopesh99 is offline   Reply With Quote

Old   July 19, 2016, 08:17
Default particles trapped
  #48
New Member
 
Select One
Join Date: Jul 2016
Posts: 1
Rep Power: 0
RB_90 is on a distinguished road
Dear forum members,

I would like to use the suggested approach to relocate particles to the inlet when they would normally leave the domain. However when I look at the particle tracks they are not moving back but simply stay at the outlet.

My code:



#include "udf.h"

DEFINE_DPM_BC(continue_tracking,p,t,f,f_normal,dim )
{
return PATH_ACTIVE;
}

DEFINE_DPM_SCALAR_UPDATE(recycle_particles,c,t,ini tialize,p)
{


if (P_POS(p)[2]>0.09)
{
P_POS(p)[2] = 0.0;
}
}


I also tried to use an execute at end approach, which reulted in my particles being actually moved to the inlet but jumping back to the outlet for the next iteration. My guess would therefore be that fluent somehow overwrites my values for the position with the previous values or calculates a the new position based on the old values. I also set the unsteady tracking.

I would be really glad if someone has a suggestion how to resolve this

Last edited by RB_90; July 19, 2016 at 11:10. Reason: missing information
RB_90 is offline   Reply With Quote

Old   May 22, 2017, 16:41
Default
  #49
New Member
 
Walid Abou Hweij
Join Date: Oct 2014
Posts: 10
Rep Power: 12
walid abou hweij is on a distinguished road
Dear Friends,

The posts are important, but I hope u could help me in this problem.

Running a steady flow I have a pipe of 40 mm diameters and I need to find the residence time distribution for a pipe that is 4 times the original one. Accordingly, the DPM with massless particles under steady state were used. I need the particles that exit to be recycled 4 times. As it appears in the UDF that you have provided, that the transient condition determines the number of times the particles crosses the outlet; however, in my case I need the opposite way round, that is given number of crosses that the particles passes the outlet, I need the particles properties (position, velocity and time) when they cross the outlet. Please provide me with an idea as soon as possible.

Thanks in advance.
Walid
walid abou hweij is offline   Reply With Quote

Old   May 22, 2017, 16:42
Default
  #50
New Member
 
Walid Abou Hweij
Join Date: Oct 2014
Posts: 10
Rep Power: 12
walid abou hweij is on a distinguished road
Dear Friends,

The posts are important, but I hope u could help me in this problem.

Running a steady flow I have a pipe of 40 mm diameters and I need to find the residence time distribution for a pipe that is 4 times the original one. Accordingly, the DPM with massless particles under steady state were used. I need the particles that exit to be recycled 4 times. As it appears in the UDF that you have provided, that the transient condition determines the number of times the particles crosses the outlet; however, in my case I need the opposite way round, that is given number of crosses that the particles passes the outlet, I need the particles properties (position, velocity and time) when they cross the outlet. Please provide me with an idea as soon as possible.

Thanks in advance.
Walid
walid abou hweij is offline   Reply With Quote

Old   July 12, 2017, 06:33
Default UDF for particle recirculation in dense discrete phase modeling
  #51
New Member
 
adnan
Join Date: Jul 2016
Posts: 5
Rep Power: 10
eddy123 is on a distinguished road
Hi guys,
I am working on 2D Riser simulations using DDPM approach. I have a simple rectangular domain having boundaries inlet (velocity inlet), outlet (pressure outlet) and wall as is shown in attached Figure. I want to recycle the particles which after leaving from outlet domain recirculate back to the inlet. I am not good at all in UDF skills. I saw your posts which are useful regarding my issue. So i want to know that how can I change the UDF as shown below this message according to my 2D problem. If you guys can help me it will be encouraging for me. Thanks.



#include "udf.h"

DEFINE_DPM_BC(continue_tracking,p,t,f,f_normal,dim )
{
return PATH_ACTIVE;
}

DEFINE_DPM_SCALAR_UPDATE(recycle_particles,c,t,ini tialize,p)
{
FILE *fp;

if (P_POS(p)[0]<0.08333)
{
P_USER_REAL(p,1) = 0.;
}

if (P_POS(p)[0]>0.91667 && P_USER_REAL(p,1) == 0.)
{
// save particle position to a text file
fp=fopen("recycleparticles.txt", "a"); // x, y, z particle positions [m], particle ID [#] and time [s]
fprintf(fp,"%e %e %e %d %e\n",P_POS(p)[0],P_POS(p)[1],P_POS(p)[2],p->part_id,P_TIME(p));
fclose(fp);

// save the number of times this particle has been recycled
P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1.;
P_USER_REAL(p,1) = 1.;

// send particle to the inlet boundary
P_POS(p)[0] = 0.;

P_POS(p)[1] = P_POS(p)[1] + 0.0833;
eddy123 is offline   Reply With Quote

Old   July 12, 2017, 06:57
Default UDF for particle recirculation in dense discrete phase modeling
  #52
New Member
 
adnan
Join Date: Jul 2016
Posts: 5
Rep Power: 10
eddy123 is on a distinguished road
Attached figure.
Attached Images
File Type: jpg 2d-riser.jpg (7.5 KB, 9 views)
eddy123 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
UDF for periodic boundary condition Angeline Fluent UDF and Scheme Programming 6 November 7, 2015 01:08
Periodic model for ansys cfx jayendrajpatel CFX 3 January 21, 2015 17:44
Ansys FLUENT UDF - Velocity profile (of known values) across edge / surface emmkell FLUENT 0 October 20, 2011 08:37
Compiling UDF in Ansys Fluent12 Vishu Fluent UDF and Scheme Programming 2 October 5, 2011 10:09
Ansys meshing of two-phase periodic domain kcsmith ANSYS Meshing & Geometry 11 March 9, 2011 22:08


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