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

Trap condition UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 21, 2019, 19:57
Default Trap condition UDF
  #1
New Member
 
Join Date: Apr 2019
Posts: 5
Rep Power: 7
FlavioC is on a distinguished road
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;
	}
}
It can be compiled without any problema but when I select this udf in the boundary condition panel , fluent gave me this message:
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?
FlavioC is offline   Reply With Quote

Old   April 21, 2019, 22:46
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
AlexanderZ is offline   Reply With Quote

Old   April 22, 2019, 14:10
Default relative velocity
  #3
New Member
 
Join Date: Apr 2019
Posts: 5
Rep Power: 7
FlavioC is on a distinguished road
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.
FlavioC is offline   Reply With Quote

Old   April 22, 2019, 21:41
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
I've already gave you a tip.
More information in Ansys Fluent Customization manual

best regards
AlexanderZ is offline   Reply With Quote

Old   April 23, 2019, 23:32
Default
  #5
New Member
 
Join Date: Apr 2019
Posts: 5
Rep Power: 7
FlavioC is on a distinguished road
Thanks for you help. I will try.
FlavioC is offline   Reply With Quote

Old   April 24, 2019, 02:09
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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);
however, I/m not sure how it will work

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
AlexanderZ is offline   Reply With Quote

Reply

Tags
condition, segmentation fault, trap, udf


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
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


All times are GMT -4. The time now is 00:27.