|
[Sponsors] |
September 24, 2009, 03:43 |
udf segmentation violation when hooked
|
#1 |
New Member
christophe
Join Date: Aug 2009
Posts: 24
Rep Power: 17 |
I am using Fluent 6.3 under linux.
I wrote udf in order to simulate specific boundary conditions. For one of my udf, I can compil it (as compiled udf) and load it without problem. But when I select it in the boundary condition window, I have the following message: "fluent.6.3.26 received a fatal signal (SEGMENTATION VIOLATION)" does any body have a clue? here is my udf's code: #include "udf.h" #include "unsteady.h" DEFINE_PROFILE(pressure_outlet_S,thread,i) { real A[ND_ND]; /* face's area */ real Q=0.; /* volume flow rate @ thread @ previous time step */ real t=CURRENT_TIME; /* current time */ face_t f; float u,v,w,vn,R; /* output of pressure outlet for 1st time step */ if (t=0.) { begin_f_loop(f,thread) { F_PROFILE(f,thread,i)=200.; } end_f_loop(f,thread) } else { /* computation of thread's flow rate @ previous time step */ begin_f_loop(f,thread) { u=F_U_M1(f,thread); v=F_V_M1(f,thread); w=F_W_M1(f,thread); vn=u*u+v*v+w*w; vn=SQR(vn); F_AREA(A,f,thread); Q=Q+NV_MAG(A)*vn; } end_f_loop(f,thread) /* computation of thread's resistance @ current time step */ R = 0.5+(15.5/Q); Q=0.; begin_f_loop(f,thread) { u=F_U_M1(f,thread); v=F_V_M1(f,thread); w=F_W_M1(f,thread); vn=u*u+v*v+w*w; vn=SQR(vn); F_AREA(A,f,thread); Q=Q+NV_MAG(A)*vn; /* output of pressure outlet @ current time step */ F_PROFILE(f,thread,i)=100*R*Q; } end_f_loop(f,thread) } } |
|
October 22, 2009, 06:14 |
solution and new pb
|
#2 |
New Member
christophe
Join Date: Aug 2009
Posts: 24
Rep Power: 17 |
I realized that, in the last part,
u=F_U_M1(f,thread); v=F_V_M1(f,thread); w=F_W_M1(f,thread); should become u=F_U(f,thread); v=F_V(f,thread); w=F_W(f,thread); By correcting this mistake, I have no more segmentation violation message when hooking the UDF, but I have one when initializing. Anybody got a clue why? |
|
October 26, 2009, 22:36 |
|
#3 |
Member
Krishna
Join Date: Oct 2009
Posts: 34
Rep Power: 17 |
I have'nt gone through the code properly but their is a mistake in the if statement. if(t=0) should be replaced by if(t==0).
regards |
|
October 27, 2009, 00:37 |
|
#4 |
New Member
christophe
Join Date: Aug 2009
Posts: 24
Rep Power: 17 |
Thank you, I have made the correction.
But I still have the segmentation violation message. |
|
October 27, 2009, 02:49 |
|
#5 |
Member
Krishna
Join Date: Oct 2009
Posts: 34
Rep Power: 17 |
SQR(float) does'nt exist in C language. Use sqrt() to find square root.
|
|
October 27, 2009, 03:36 |
|
#6 |
New Member
christophe
Join Date: Aug 2009
Posts: 24
Rep Power: 17 |
Thank you for your comment.
with the correction things are in progress: I can go through the initialize step. But then, when I start to iterate, I have again a segmentation violation message. |
|
October 27, 2009, 03:56 |
|
#7 |
Member
Krishna
Join Date: Oct 2009
Posts: 34
Rep Power: 17 |
What is that you want to assign at the boundary? Write the expression and constraints.
|
|
October 27, 2009, 04:39 |
|
#8 |
New Member
christophe
Join Date: Aug 2009
Posts: 24
Rep Power: 17 |
I have created 2 udfs to express inlet and outlet conditions. The udf at the inlet provides the velocity (it's a pulsatile flow, the aim is to model blood flow in pulmonary artery). I tested it separately, no pb.
The second one (the one shown here) is aimed at expressing a pressure boundary condition at the outlets. By getting the volume flow rate Q at the outlet at the former time step (that's why I need to separate t=0) I want to compute the pulmonary vascular resistance R by using the formula based on experimental results: R = 0.5+(15.5/Q) as Fluent cannot interpret directly this resistance, I compute the pressure p at the outlets by using the formula: p=RxQ where this time Q is the current volume flow rate at the outlets. I think the pb come from the fact that I am requesting a data from a former time step (Q). |
|
October 29, 2009, 07:09 |
|
#9 |
New Member
christophe
Join Date: Aug 2009
Posts: 24
Rep Power: 17 |
it seems I solved the pb by using UDM instead of F_U_M1 functions.
thank you again for your help. |
|
June 25, 2012, 06:46 |
|
#10 |
Member
Satish Gupta
Join Date: Jun 2012
Posts: 30
Rep Power: 14 |
I have written the UDF for convective b.c using DEFINE_PROFILE.........Can any1 tell me how to apply it at outlet
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
udf wall distance segmentation violation | gento | FLUENT | 1 | April 15, 2016 16:59 |
DPM UDF - Segmentation Violation & Stack Backtrace | Prashanth | Fluent UDF and Scheme Programming | 4 | July 10, 2012 11:39 |
Segmentation Violation | Corentin | FLUENT | 1 | February 13, 2011 02:07 |
[UDF] Segmentation violation | visuja | Fluent UDF and Scheme Programming | 0 | April 23, 2009 23:23 |
segmentation violation | wasan | FLUENT | 0 | December 23, 2008 12:37 |