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

Random number generation for filter

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 18, 2017, 19:30
Default Random number generation for filter
  #1
New Member
 
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 20
Rep Power: 4
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, 03:00
Default
  #2
New Member
 
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 20
Rep Power: 4
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, 03:01
Default
  #3
New Member
 
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 20
Rep Power: 4
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, 02:07
Default
  #4
New Member
 
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 20
Rep Power: 4
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, 02:07
Default
  #5
New Member
 
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 20
Rep Power: 4
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, 02:09
Default
  #6
New Member
 
Join Date: Mar 2017
Posts: 8
Rep Power: 2
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
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR #001100279 has occurred in subroutine ErrAction. smnaryal CFX 9 September 17, 2017 21:07
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 83 July 22, 2017 08:26
random number generation hwet Fluent UDF and Scheme Programming 9 February 29, 2016 20:35
OF2.3.1 + OS13.2 - Trying to use the dummy Pstream library aylalisa OpenFOAM Installation 23 June 15, 2015 14:49
--> foam fatal error: lillo763 OpenFOAM Native Meshers: blockMesh 0 March 5, 2014 11:27


All times are GMT -4. The time now is 15:13.