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

Random number generation for filter

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 18, 2017, 20:30
Default Random number generation for filter
  #1
New Member
 
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 22
Rep Power: 11
touyet is on a distinguished road
Hi

currently I working on filter efficiency. and I already know penetration Efficiency of filter in each particle size.

For try this on fluent simulation, I want put udf about DPM in porous jump.

So, My plan is generate random number on each particle (like 0 to1) and if particle has low random number than filter penetration Efficiency, the particle considered to pass through (PATH_ACTIVE
Else, particle considered to Capture (PATH_ABORT

Is anybody help me about this Udf or recommend reference about it?
touyet is offline   Reply With Quote

Old   April 19, 2017, 04:00
Default
  #2
New Member
 
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 22
Rep Power: 11
touyet is on a distinguished road
I wrote some udf code but ther is error ( "'bc_filter' : not all control paths return a value" )

Is anybody know about what is the problem??

regards
touyet is offline   Reply With Quote

Old   April 19, 2017, 04:01
Default
  #3
New Member
 
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 22
Rep Power: 11
touyet is on a distinguished road
/************************************************** *********************
UDF Particle Capture in Prous jump by Filter Efficiency.
************************************************** **********************/

#include "udf.h"

#include "stdlib.h"

DEFINE_DPM_BC(bc_filter,p,t,f,f_normal,dim)
{
/* Define Particle Random Number */
int ns;
int nc=TP_N_COMPONENTS(p);

/* Random Number Genreation 0 to 1 */
srand(time(NULL));

for (ns=0; ns < nc; ns++) {
real A=rand();


if(p->type==DPM_TYPE_INERT)
{

/* Different Efficiency by Particle Diameter */
if (P_DIAM(p)==0.000000005)
{
/* Penentration Efficiency */
if(A <= 0.266)
{return PATH_ACTIVE;}
else
{return PATH_ABORT;}
}

if (P_DIAM(p)==0.000000020)
{
/* Penentration Efficiency */
if(A <= 0.75)
{return PATH_ACTIVE;}
else
{return PATH_ABORT;}
}

if (P_DIAM(p)==0.000000050)
{
/* Penentration Efficiency */
if(A <= 0.885)
{return PATH_ACTIVE;}
else
{return PATH_ABORT;}
}

if (P_DIAM(p)==0.000000100)
{
/* Penentration Efficiency */
if(A <= 0.922)
{return PATH_ACTIVE;}
else
{return PATH_ABORT;}
}

if (P_DIAM(p)==0.000000300)
{
/* Penentration Efficiency */
if(A <= 0.881)
{return PATH_ACTIVE;}
else
{return PATH_ABORT;}
}

if (P_DIAM(p)==0.000000780)
{
/* Penentration Efficiency */
if(A <= 0.616)
{return PATH_ACTIVE;}
else
{return PATH_ABORT;}
}
return PATH_ACTIVE;
}
else
{return PATH_ACTIVE;}
}
}
touyet is offline   Reply With Quote

Old   April 20, 2017, 03:07
Default
  #4
New Member
 
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 22
Rep Power: 11
touyet is on a distinguished road
I develope my code and the New one is below.
problem 1 is how can i get new property for random number (currently I put random number in temperature but it is problem)

problem 2 when I compile and use this code all particle aborted

How can i deal with it??

regards
touyet is offline   Reply With Quote

Old   April 20, 2017, 03:07
Default
  #5
New Member
 
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 22
Rep Power: 11
touyet is on a distinguished road
/************************************************** *********************
UDF Particle Capture in Prous jump by Filter Efficiency.
************************************************** **********************/

#include "udf.h"

#include "stdlib.h"

DEFINE_DPM_INJECTION_INIT(Random_Temp, I)
{
Particle *p;

/* Random Number Genreation 0 to 1 */


/*Standard Fluent looping Macro to get particle streams in an inejction using steady particle tracking*/
loop(p,I->p)
{
/* Put Random Number Genreation (0 to 1) in Particle Temp Value */
srand(time(NULL));
P_T(p) = rand();
}
}


DEFINE_DPM_BC(bc_filter,p,t,f,f_normal,dim)
{
if(p->type==DPM_TYPE_INERT)
{

/* Different Efficiency by Particle Diameter && Penentration Efficiency */
if (P_DIAM(p)==0.000000005 && P_T(p) >= 0.266)
{return PATH_ABORT;}

else if (P_DIAM(p)==0.000000020 && P_T(p) >= 0.750)
{return PATH_ABORT;}

else if (P_DIAM(p)==0.000000050 && P_T(p) >= 0.885)
{return PATH_ABORT;}

else if (P_DIAM(p)==0.000000100 && P_T(p) >= 0.922)
{return PATH_ABORT;}

else if (P_DIAM(p)==0.000000300 && P_T(p) >= 0.881)
{return PATH_ABORT;}

else if (P_DIAM(p)==0.000000780 && P_T(p) >= 0.616)
{return PATH_ABORT;}
else
{return PATH_ACTIVE;}

return PATH_ACTIVE;
}
return 0;
}
touyet is offline   Reply With Quote

Old   April 20, 2017, 03:09
Default
  #6
New Member
 
Join Date: Mar 2017
Posts: 8
Rep Power: 9
ctw987 is on a distinguished road
hello touyet! You're a random addict? Is the StarCraft race also random?
ctw987 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 91 December 21, 2022 05:50
ERROR #001100279 has occurred in subroutine ErrAction. smnaryal CFX 11 December 20, 2017 17:32
random number generation hwet Fluent UDF and Scheme Programming 9 February 29, 2016 20:35
[OpenFOAM.org] OF2.3.1 + OS13.2 - Trying to use the dummy Pstream library aylalisa OpenFOAM Installation 23 June 15, 2015 15:49
[blockMesh] --> foam fatal error: lillo763 OpenFOAM Meshing & Mesh Conversion 0 March 5, 2014 11:27


All times are GMT -4. The time now is 22:06.