|
[Sponsors] |
April 21, 2019, 19:57 |
Trap condition UDF
|
#1 |
New Member
Join Date: Apr 2019
Posts: 5
Rep Power: 7 |
Hello to everyone, I am working in a particle trap condition when particles satisfies that 0.001>vrel, where vrel is the fluid velocity minus the particle velocity. This is my code:
Code:
#include "udf.h" DEFINE_DPM_BC(best_dpmbc3,p,t,f,f_normal,dim) { /*Variable declarations*/ int i; /*working counter for script*/ real vrel; real rx, ry, rz; /*Variable evaluations*/ cell_t c; c=P_CELL(p); rx=C_U(c,t)-P_VEL(p)[0]; ry=C_V(c,t)-P_VEL(p)[1]; rz=C_W(c,t)-P_VEL(p)[2]; vrel = sqrt(rx*rx+ry*ry+rz*rz); if(0.001 > vrel) { for(i=0; i<dim; i++) P_VEL(p)[i] = 0; return PATH_ABORT; } /*Stop tracking the particle*/ else { return PATH_ACTIVE; } } Error: received a fatal signal (Segmentation fault).Error Object: #f I am novice in the UDF area, can someone give me suggestions or opinions please? |
|
April 21, 2019, 22:46 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you are using C_U(c,t) macro but c has nothing inside
you should make loop over cell/threads to use C_U(c,t) Code:
thread_loop_c(t,domain) { begin_c_loop(c,t) { code } end_c_loop(c,t) } best regards |
|
April 22, 2019, 14:10 |
relative velocity
|
#3 |
New Member
Join Date: Apr 2019
Posts: 5
Rep Power: 7 |
Hello AlexanderZ.
Thanks for you replay. I really appreciate your answer. Could you please give me some help on the uses of loop macro, I have been reading about it, but all my attempts have failed. |
|
April 22, 2019, 21:41 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
I've already gave you a tip.
More information in Ansys Fluent Customization manual best regards |
|
April 23, 2019, 23:32 |
|
#5 |
New Member
Join Date: Apr 2019
Posts: 5
Rep Power: 7 |
Thanks for you help. I will try.
|
|
April 24, 2019, 02:09 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
I was wrong there.
I your code c and thread were defined so you don't need a loop. I have no experience with DPM but it seems like DEFINE_DPM_BC macro is defined on boundary (face) only, so any data related to cells is not avaliable. You may try to get the data from cell,which is adjusted to this face using Code:
c0 = F_C0(f,t); t0 = THREAD_T0(t); on the other hand, in UDF manual there is some macro WALL_F_VV(f,thread)[i] there is no information how it works. You may try to find something in Ansys Fluent Customization manual in DEFINE_DPM_BC chapter best regards |
|
Tags |
condition, segmentation fault, trap, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF setting wall boundary condition with a DEFINE_PROFILE | NLao | FLUENT | 3 | September 2, 2019 01:33 |
Define_profile UDF for Transient Heat flux boundary condition | Amoljoshi | Fluent UDF and Scheme Programming | 2 | June 20, 2018 22:55 |
UDF for 3rd Kind Boundary Condition | Ismail | FLUENT | 2 | October 26, 2015 02:57 |
udf for dpm boundary condition | ucmaen | Fluent UDF and Scheme Programming | 0 | July 15, 2014 14:33 |
UDF for traction-free boundary condition at outlet | psb | Fluent UDF and Scheme Programming | 0 | November 10, 2009 03:40 |