|
[Sponsors] |
February 7, 2016, 23:58 |
|
#21 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Friend, now UDF is working fine and created .txt file (when particle touch outlet boundary). My problem, UDF is creating Lacs of rows and one column. I am taking only 1042 particles. After analyze, I saw particles are not recycling. All is fine, but particle after reach to outlet boundary remains there as it is. This is the main problem. Pls tell, why particle not recycle even i made outlet diameter in such a way that only one one-one particle reach to outlet boundary.
Thanks a lot |
|
February 9, 2016, 00:52 |
|
#22 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The UDF is only called at the outlet when particles reach the outlet boundary (and are recycled back to the inlet at x = 0 m); then and only then are the particle positions written to the text file.
Considering you have a number of lines of text in the file suggests particles have been recycled. There is no end state for the particles (they will loop from outlet to inlet unless they escape elsewhere) and therefore the number of recycled particles could exceed the number of injected particles (1042). |
|
February 9, 2016, 02:27 |
|
#23 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Thanks a lot, but my problem is particles not recycling even i tried the PATH_ACTIVE, PATH_END, PATH_BREAK, PATH_STOP as well as PATH_ABORT, also tried P_POS(p)[0] = 0.0 and P_POS(p)[0] = 0.15
Thanking You Last edited by roopesh99; February 9, 2016 at 07:45. |
|
February 9, 2016, 18:51 |
|
#24 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
I've investigated this problem and there's a couple of tricks:
My test case was a 1 m cube domain centred about (0.5,0,0) with an inlet velocity of 1 m/s (left), pressure outlet (right) and the side walls were of type symmetry. The mesh had 12 elements in each direction (each cell length was 0.08333... m). Use the DEFINE_DPM_BC macro to keep the particle tracked at the outlet boundary and use the DEFINE_DPM_SCALAR_UPDATE macro to shift the particle from the outlet (beyond some critical x position) to the inlet. See below for my UDF, you'll need to enable two user-defined scalars for the particles (Define > Models... > Discrete Phase > UDF > User Variables). The first UDS is for counting the number of times a parcel has recycled and the second UDS is for a fix (the scalar macro is sometimes called a couple of times when the parcel reaches the outlet). 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,initialize,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; } } |
|
February 10, 2016, 00:24 |
|
#25 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
you udf is not compiling. i made cube 1m with center (0,0,0), x-y in hz and z-vertical. Inlet from bottom and outlet from top. what is the problem with that. it will be good if send case file so that i can analyze the given udf my case point of view.
Thank you Last edited by roopesh99; February 11, 2016 at 03:03. |
|
February 11, 2016, 05:06 |
|
#26 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
My UDF compiled fine on my system, what error are you getting while compiling? If you have a different domain then you'll need to modify the UDF to reflect those changes. The main difference with your case (inlet at the bottom, outlet at the top and the centre at the origin) can be customised for by modifying which particle positions are used. Note that these positions are available as macros in the x (P_POS(p)[0]), y (P_POS(p)[1] and z (P_POS(p)[2]) directions.
|
|
February 11, 2016, 06:25 |
|
#27 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Thanks friend, now udf is compiling. But I am confuse in your udf which axis is inlet. I am taking z axis as inlet and outlet. x and y as wall. My center is at the bottom vertex of z.
|
|
February 11, 2016, 06:28 |
|
#28 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
My inlet was on the left side of the cube in the YZ plane (x = 0 m, y and z both ranged from -0.5 m to +0.5 m).
|
|
February 11, 2016, 13:51 |
|
#29 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Dear friend,
i tried one example case same 1m cube with yz plane as velocity inlet as well as pressure outlet, still problem same as before as well as recycleparticles.txt not generated. [In my actual case inlet will be in x-y plan and z axis will be in vertical direction and origin (0,0,0)] |
|
February 12, 2016, 00:31 |
|
#30 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The text file is saved to the local Fluent working directory because a relative (instead of absolute) directory location was provided. For example:
Code:
...\DPMrecycle\DPMrecycle_files\dp0\FFF\Fluent\recycleparticles.txt |
|
February 12, 2016, 03:12 |
|
#31 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
see the attached jpg run file. Also in the working folder no recycleparticles.txt. I want also where the command execute "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));"
|
|
February 12, 2016, 03:37 |
|
#32 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Where have you saved your Workbench project and does Fluent have access to writing files there? Try saving the text file to an external hard drive or anywhere outside the Program Files folder or My Documents.
|
|
February 29, 2016, 01:36 |
|
#33 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Dear Friend,
check the attached case and UDF. Send me one case with udf and i will understand that and try to modify for my vertical direction outlet case. Also pls tell what is the means of P_USER_REAL(p,1) and P_USER_REAL(p,0) in the udf. Thanks. Last edited by roopesh99; February 29, 2016 at 12:13. |
|
February 29, 2016, 19:31 |
|
#34 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
You hadn't enabled the scalar update macro, via: Define > Models > Discrete Phase > UDF > User-Defined Functions > Scalar Update. Note: you need to define two user-defined scalars (under user variables of the same dialog box).
|
|
March 1, 2016, 22:14 |
|
#35 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Thanks a lot friend, now code is working and i already run it for 10 no. of particles and i saw particles recycle properly. See the attached generated txt file. In the txt file second last column printing contentiously the same particle 2 to 6 times with millisecond time difference. May be possible, i am using 0.025 m diameter particle (big size particles). But, i want only once reporting time for that i.d. particle in the txt file when that particle cross the outlet boundary or in other word it should not depend on particle size. See the second last column of attached result .txt file.
Also wt is the means of "p->part_id" [Is it used to provide the particle ID?] [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));] And wt is the means of P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1.; P_USER_REAL(p,1) = 1.; [Is it related with initial and 1st time-step?] Thanks for guiding and help.. Last edited by roopesh99; March 2, 2016 at 00:41. |
|
March 2, 2016, 16:53 |
|
#36 | |||
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Quote:
Quote:
Quote:
|
||||
March 3, 2016, 00:24 |
|
#37 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Dear Friend
what is the means of "I used that second user-defined memory location in the particles to avoid duplicate entries (flags particles when they reach the outlet, and then resets at inlet). " i think it is (P_POS(p)[0]>0.91667 && P_USER_REAL(p,1) == 0.)? Also pls explain wt is the role of this line "P_POS(p)[0]>0.91667 && P_USER_REAL(p,1) == 0." in the udf? Thanks a lot |
|
March 3, 2016, 00:46 |
|
#38 | |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Quote:
As above, and the first portion checks to see if this particle is near the outlet (we've defined it as x > 0.91667 m in this case). |
||
March 3, 2016, 11:53 |
|
#39 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Dear Friend
I am trying this for vertical column. But i want to ask that "P_USER_REAL(p,0) and P_USER_REAL(p,1) are represent to axis x and y or UDS 1 and 2? Because now I am trying to modify this where xy is base and z as height. Thanks a lot Last edited by roopesh99; March 4, 2016 at 00:41. |
|
March 8, 2016, 18:08 |
|
#40 | |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Quote:
For example, setting the particle position in the z-direction to zero would be done with: Code:
P_POS(p)[2] = 0.; |
||
|
|
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 |