|
[Sponsors] |
April 18, 2017, 20:30 |
Random number generation for filter
|
#1 |
New Member
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 22
Rep Power: 11 |
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? |
|
April 19, 2017, 04:00 |
|
#2 |
New Member
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 22
Rep Power: 11 |
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 |
|
April 19, 2017, 04:01 |
|
#3 |
New Member
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 22
Rep Power: 11 |
/************************************************** *********************
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;} } } |
|
April 20, 2017, 03:07 |
|
#4 |
New Member
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 22
Rep Power: 11 |
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 |
|
April 20, 2017, 03:07 |
|
#5 |
New Member
Yoon
Join Date: Mar 2015
Location: Seoul
Posts: 22
Rep Power: 11 |
/************************************************** *********************
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; } |
|
April 20, 2017, 03:09 |
|
#6 |
New Member
Join Date: Mar 2017
Posts: 8
Rep Power: 9 |
hello touyet! You're a random addict? Is the StarCraft race also random?
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Foam::error::PrintStack | almir | OpenFOAM Running, Solving & CFD | 92 | May 21, 2024 08:56 |
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 |