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

DPM: UDF - loop over all particles

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 25, 2012, 01:56
Default
  #21
ADI
New Member
 
A. N.
Join Date: Oct 2009
Posts: 10
Rep Power: 16
ADI is on a distinguished road
Send a message via MSN to ADI
FORTRAN code UDF for FLUENT, I am 99% sure it is not possible. You will have to recode it in c/C++. Besides, If you are writing a UDF for FLUENT, usually you do not code every thing from continuity all the way to the slightest details in combustion. Use the FLUENT UDF manual. It really will guide you well.

As for openfoam, I dont have much experience. I have only tried a very small and simple pipe flow model at home. No where enough experience to provide help or advice.
__________________
Adi.
ADI is offline   Reply With Quote

Old   April 25, 2012, 02:01
Default
  #22
Member
 
Join Date: Apr 2012
Location: Mainz, Germany
Posts: 60
Rep Power: 14
juzer_700 is on a distinguished road
Ok.

Yes I have started reading the UDF manual. Thanks for your advice.
juzer_700 is offline   Reply With Quote

Old   April 25, 2012, 05:42
Default
  #23
Member
 
Join Date: Apr 2012
Location: Mainz, Germany
Posts: 60
Rep Power: 14
juzer_700 is on a distinguished road
@ADI : one more thing. It is possible to generate a virtual grid in C language and run the UFD code developed on that grid and to simultaneously run the FLUENT code (Continuity, mom, energy eqs) on the grid developed in GAMBIT/FLUENT?
juzer_700 is offline   Reply With Quote

Old   July 13, 2012, 17:23
Default
  #24
Member
 
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 16
sfotovati is on a distinguished road
High everybody,

I would like to loop over all particles and find their intraction with each other. However, this has to be done inside a UDF for DPM (e.g. Defiend_DPM_SCALAR_UPDATE). The compiler will go wrong as soon as I have one of the macros related for looping over the particles (e.g. begin_particle_cell_loop!).

Does anyone have any idea to resolve this situation?

Thank you.

Sean
sfotovati is offline   Reply With Quote

Old   April 11, 2015, 00:47
Default
  #25
Senior Member
 
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 11
HyperNova is on a distinguished road
Quote:
Originally Posted by Wikie View Post
Hi,

I still stuck at this problem. I'm always getting the same error message saying: "error C2198: 'bin_particles_in_cells' : too few arguments for call".
Can anybody help me please, I have to know the number of particles to continue my work.

Thanks,
wikie
hi Wikie
have you found any solution for that ? i stuck at this problem either, i am using Fluent v15.0, in v6.3.26 it works correctly, but in v15.0 no,
thank you
HyperNova is offline   Reply With Quote

Old   August 27, 2017, 19:34
Smile nanoparticle measurement by CFD
  #26
New Member
 
HASAN
Join Date: Oct 2016
Location: canada
Posts: 9
Rep Power: 9
alburkatyhasan@yahoo.com is on a distinguished road
Hello, dear
Is there any way to count the Particles on Boundries over the time ?
how can I do it in the fluent? pls tell me the steps for it, and pls how can I know How many particles pass the Inlet in those ten seconds of Simulation in the fluent? 1000000000 thanks
alburkatyhasan@yahoo.com is offline   Reply With Quote

Old   August 14, 2018, 12:25
Default Solution: looping over all particles, calculating melt fraction
  #27
New Member
 
Patrick
Join Date: Jul 2018
Posts: 4
Rep Power: 7
pat-cfd is on a distinguished road
Hi All,

Thank you for all your posts! I haven't read all the posts, so I'm not sure if a solution has been found. If not, here's some code I've written to count all of the particles and calculate the melt fraction. Note that I only have one injection so I didn't have to loop through them, as we done in the previous posts with Ilist.

DEFINE_ON_DEMAND(melt_percent_calc)
{
Injection *I;
Particle *p;

real particle_count = 0;
real melt_count = 0;
real melt_percent = 0;

I = Get_dpm_injections();

loop(p, I->p)
{
particle_count++;
if (TP_T(p) > Tmelt){
melt_count++;
}
if (TP_TIME(p) > time){
time = TP_TIME(p);
}
}

melt_percent = (melt_count/particle_count)*100;
Message("\n");
Message("Particle count: %g\n", particle_count);
Message("Melt count: %g\n", melt_count);
Message("Melt percent: %g\n", melt_percent);

}
vavnoon likes this.
pat-cfd is offline   Reply With Quote

Old   June 17, 2020, 01:21
Default
  #28
Member
 
vav noon
Join Date: May 2020
Posts: 49
Rep Power: 5
vavnoon is on a distinguished road
Hello everybody,

I want to inject several particles using read a file in the DPM setting and finally get their positions.

I used the following UDF for writing the positions.

#include "udf.h"
#include "dpm.h"
DEFINE_ON_DEMAND(particles_position)
{

Domain *d;
Thread *t;
cell_t c;
d = Get_Domain(1);

Injection *I;
Particle *p;
I = Get_dpm_injections();

FILE *fp;

loop(p, I->p)
{

fp = fopen ("E:/aafinal/path/position.txt","a");

fprintf(fp, "%d %d %d \n", P_POS(p)[0], P_POS(p)[1], P_POS(p)[2]);

fclose(fp);

}

}
Despite the declaration variable I, I faced the error: I: undeclared variable.
Could anyone please guide me?

Thank you for your time and concern!
vavnoon is offline   Reply With Quote

Old   June 17, 2020, 02:11
Default
  #29
Member
 
vav noon
Join Date: May 2020
Posts: 49
Rep Power: 5
vavnoon is on a distinguished road
I also have another question. Should I use if-loop if I want to get positions in several specified times? Do you have any suggestions?

Thanks
vavnoon is offline   Reply With Quote

Old   June 17, 2020, 03:45
Default Compilation
  #30
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Are you compiling it or interpreting it? Interpreter will not work for this scenario. As a compiled version, it would work fine. You don't need the following lines

#include "dpm.h"
Domain *d;
Thread *t;
cell_t c;
d = Get_Domain(1);

And open and close the file outside the loop, otherwise I/O will slow down the process significantly.
vavnoon likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 17, 2020, 05:38
Default
  #31
Member
 
vav noon
Join Date: May 2020
Posts: 49
Rep Power: 5
vavnoon is on a distinguished road
Many thanks for the reply.

I interpreted it.
Yes, you're right. There is no need to write the lines.

#include "udf.h"

DEFINE_ON_DEMAND(particles_position)
{

Injection *I;
Particle *p;
I = Get_dpm_injections();

FILE *fp;
fp = fopen ("E:/aafinal/path/position.txt","a");

loop(p, I->p)
{

fprintf(fp, "%d %d %d \n", P_POS(p)[0], P_POS(p)[1], P_POS(p)[2]);
}

fclose(fp);
}
vavnoon is offline   Reply With Quote

Old   June 17, 2020, 05:52
Default Compiler
  #32
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
You need to compile it. Interpreter won't work.
vavnoon likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm 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
DPM UDF Injection leads to 2 different particles sega Fluent UDF and Scheme Programming 4 December 28, 2017 22:57
DPM - do the particles affect the liquid? Nikhil Dani FLUENT 0 January 1, 2009 11:58
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 15:57
DPM: using UDF for creating and deleting Particles Markus Alzon FLUENT 0 July 4, 2007 01:18
DPM; particle seeded / deleted by UDF Laika FLUENT 6 January 22, 2006 23:40


All times are GMT -4. The time now is 23:55.