|
[Sponsors] |
![]() |
![]() |
#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? |
|
![]() |
![]() |
![]() |
![]() |
#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 |
|
![]() |
![]() |
![]() |
![]() |
#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. |
|
![]() |
![]() |
![]() |
![]() |
#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 |
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
Join Date: Apr 2019
Posts: 5
Rep Power: 7 ![]() |
Thanks for you help. I will try.
|
|
![]() |
![]() |
![]() |
![]() |
#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 |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF setting wall boundary condition with a DEFINE_PROFILE | NLao | FLUENT | 3 | September 2, 2019 00:33 |
Define_profile UDF for Transient Heat flux boundary condition | Amoljoshi | Fluent UDF and Scheme Programming | 2 | June 20, 2018 21:55 |
UDF for 3rd Kind Boundary Condition | Ismail | FLUENT | 2 | October 26, 2015 01:57 |
udf for dpm boundary condition | ucmaen | Fluent UDF and Scheme Programming | 0 | July 15, 2014 13:33 |
UDF for traction-free boundary condition at outlet | psb | Fluent UDF and Scheme Programming | 0 | November 10, 2009 02:40 |