|
[Sponsors] |
January 12, 2016, 10:56 |
Periodic BC in ANSYS DDPM, UDF
|
#1 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Dear Friend,
I am using, DDPM simulation using ANSYS 14.5, for a simple system. I used inlet as periodic and outlet as shadow in ANSYS for making it periodic but after making periodic I have no control on the inlet (I am unable to specify mass flow rate inlet), it is showing option to specify pressure gradient. Thanks for helping in advance!!! |
|
January 12, 2016, 18:33 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Are you having a problem with the fluid or discrete phase? Are you using a UDF with the boundary condition? Are you sure you want to use a periodic boundary condition for the inlet and outlet?
|
|
January 13, 2016, 00:02 |
|
#3 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
I have not facing problem in defining fluid or discrete phase. Simply, I have 3D rectangular domain and i used udf for filling the particle in that, having diameter 1 cm (1000 particles), now i want to recycle the particles from the outlet to inlet, may be there will be so may method but up to now i am unable to do that. I am using ddpm-Dem in ANSYS 14.5.
Thanks!!! |
|
January 13, 2016, 20:14 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
I've not used the Dense Discrete Phase Model (DDPM) but it appears Fluent uses the same DPM model with modifications to the mass and momentum conservation equations in the Eulerian model (to overcome the limitation of the small volume fraction assumption).
One method of recycling the particles from the outlet to the inlet boundary is to modify the position when the particle reaches the outlet. Modify the x-position (assuming the outlet is in the Y-Z plane) using the DEFINE_DPM_BC macro and hook this macro to the outlet boundary for the DPM. An (incomplete) example with the key lines of code: Code:
DEFINE_DPM_BC(recycle_particles,...) { ... P_POS(p)[0] = 0.; // move particle to inlet (at origin, x=0) return PATH_ACTIVE; // allows the solver to continue tracking this parcel } |
|
January 27, 2016, 09:21 |
DDPM with particle recycle
|
#5 | |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Quote:
I am using, DDPM simulation using ANSYS 14.5, for a simple system. Domain is a rectangular column, having dimensions 0.2X0.15X1.5 m3. Also, there is one outlet and one inlet of 0.025X0.025X0.2 m3. In the column there are 1000 balls having diameter 0.02 m. I want to balls continuous recycle back in a countable way. [some body told me in circulating fluidized bed mostly people used this, outlet recycle back, using smaller domain, but i didn't get any thing by google search] Thanks |
||
January 27, 2016, 18:01 |
|
#6 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Starting with the code I've provided above, add in commands to save the number of particles cycled either to a text file (could include details of flow time or particle residence time) or global variable (simply an integer of the number of recycled particles).
Code:
static int recycledParticles=0; // global variable accessible only within this file DEFINE_DPM_BC(recycle_particles,...) { ... // open a data file // save data to a text file, you could include times or location of particle // close the data file recycledParticles = recycledParticles + 1; // update number of particles P_POS(p)[0] = 0.; // move particle to inlet (at origin, x=0) return PATH_ACTIVE; // allows the solver to continue tracking this parcel } |
|
January 29, 2016, 04:22 |
|
#7 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Thanks for nice reply, Is such type of UDF will work in ANSYS ( also which version of ANSYS is comfortable with such type UDF etc. My Second question: i am unable to the understand how to apply the step "// save data to a text file, you could include times or location of particle"
pls explain in detail. My email is roopesh99@gmail.com if you have some issues. Thanking You.. Last edited by roopesh99; January 29, 2016 at 09:55. |
|
January 31, 2016, 22:56 |
|
#8 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
I'm unsure of your first question but ANSYS bought Fluent and it's now called ANSYS Fluent but the code is the same (has been updated / developed since acquisition); the UDF I posted above should work on any Fluent version you're working with.
There are many examples online for saving data to a text file so I won't repeat here but check this post for starters. |
|
February 1, 2016, 23:39 |
|
#9 | |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Quote:
Second question: in the 8,9 and 10th row UDF is calling CURRENT_TIME, DT_CG (dt)[0],DT_CG(dt)[1], DT_CG(dt)[2]) etc, But how UDF will understand that in the running simulation that is current time and that is DT_CG... Thanks Also I have written one UDF based on your guidance, pls correct because i am not expert DEFINE_DPM_BC(recycle_particle) { FILE *fp; fp=fopen("recycleparticles.txt", "a"); //”w” or “a” fprintf(particles, " fp \n"); //ck (pebbles, " fp \n") or (fp, “%E”, particles) fclose(fp); recycledparticles = recycledparticles + 1; // update number of particles P_POS(p)[0] = 0.0; // inlet at x=0 origin return PATH_ACTIVE; // it will continue tracking this parcel } Can we use "*P" and * t, i saw this information in UDF manual-2015 heading 2.5.1.2 and 2.5.1.4 Also need to specify DPM.h????, at the start of the UDF??? Last edited by roopesh99; February 2, 2016 at 01:04. |
||
February 2, 2016, 17:15 |
|
#10 | ||||
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Quote:
Quote:
Quote:
Code:
fprintf(fp,"%e\n",P_POS(p)[1]); Quote:
Code:
DEFINE_DPM_BC(recycle_particle,p,t,f,f_normal,dim) Code:
#include "udf.h" |
|||||
February 3, 2016, 04:39 |
|
#11 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
First of all, thanks for this nice help. Pls see the following UDF. Is it o.k. or need to modify.
#include "udf.h" DEFINE_DPM_BC(recycle_particle,p,t,f,f_normal,dim) { FILE *fp; fp=fopen("recycleparticles.txt", "a"); //”w” or “a” fprintf(fp,"%e\n",P_POS(p)[1]); //or can use (pebbles, " fp \n") or (fp, “%E”, particles) fclose(fp); recycledparticles = recycledparticles + 1; // update number of particles P_POS(p)[0] = 0.0; // inlet at x=0 origin return PATH_ACTIVE; // it will continue tracking this parcel } Thanks when i am interpreted this UDF then it is showing the error in the 6th line which is "line 6: P_POS: undeclared variable", in the UDF 6th line is "fprintf(fp,"%e\n",P_POS(p)[1])" , i am taking x-axis as length, y as width and z as the height. Last edited by roopesh99; February 4, 2016 at 08:38. |
|
February 5, 2016, 17:14 |
|
#12 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The UDF probably requires compiling instead of interpreting. It's good practice to compile all UDFs to avoid these types of errors.
|
|
February 5, 2016, 23:47 |
|
#13 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Even compiling is not working it is showing error, i tried both......on compiling the error is "error C2065: 'recycledparticles' : undeclared identifier"
|
|
February 6, 2016, 00:35 |
|
#14 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The variable recycledparticles needs to be declared and initialised at the start of the code block (before or after FILE *fp;):
Code:
int recycledparticles = 0; |
|
February 6, 2016, 00:54 |
|
#15 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Thanks for nice help, now udf is compiling but i am unable to see this UDF in HOOK or outlet BC.
|
|
February 6, 2016, 00:58 |
|
#16 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
You're posting across several threads and have different versions in each one. You have this line of code from another thread:
Code:
Tracked_Particle *p |
|
February 6, 2016, 02:25 |
|
#17 | |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Quote:
Last edited by roopesh99; February 6, 2016 at 03:36. |
||
February 6, 2016, 02:39 |
|
#18 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Have you loaded the UDF after compiling? If you've modified the UDF then check my compiling process for Fluent UDFs with an existing library loaded.
|
|
February 6, 2016, 03:09 |
|
#19 | |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13 |
Quote:
Thanks a lot for helping.. This is the UDF which i am compiling successful as well as able to define at the outlet, but why recycleparticles.txt file not creating, i am running it in the 3D geometry #include "udf.h" DEFINE_DPM_BC(recycle_particle,p,t,f,f_normal,dim) { int recycledparticles = 0; FILE *fp; //Tracked_Particle *p; fp=fopen("recycleparticles.txt", "a"); //”w” or “a” fprintf(fp,"%e\n",P_POS(p)[1]); //or can use (pebbles, " fp \n") or (fp, “%E”, particles) fclose(fp); recycledparticles = recycledparticles + 1; // update number of particles P_POS(p)[0] = 0.0; // inlet at x=0 origin return PATH_ACTIVE; // it will continue tracking this parcel } |
||
February 6, 2016, 03:51 |
|
#20 | ||
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Quote:
Quote:
Code:
#include "udf.h" static int recycledParticles=0; // global variable accessible only within this file DEFINE_DPM_BC(recycle_particle,p,t,f,f_normal,dim) { FILE *fp; Message("The outlet boundary UDF is being called...\n"); fp=fopen("recycleparticles.txt", "a"); //”w” or “a” fprintf(fp,"%e\n",P_POS(p)[1]); //or can use (pebbles, " fp \n") or (fp, “%E”, particles) fclose(fp); recycledparticles = recycledparticles + 1; // update number of particles P_POS(p)[0] = 0.0; // inlet at x=0 origin return PATH_ACTIVE; // it will continue tracking this parcel } |
|||
|
|
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 |