|
[Sponsors] |
"Segmentation fault" when using UDFs in Fluent |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 2, 2022, 09:54 |
"Segmentation fault" when using UDFs in Fluent
|
#1 |
New Member
Join Date: Nov 2022
Posts: 10
Rep Power: 4 |
Hello!
I'm modeling an airflow through a heated pipe in Fluent 18 and would like to recalculate the pipe wall temperature dependiong on the flow exit temperature at every iteration. I've tried familarizing with UDFs to solve this issue. I'm able to recalculate the wall temperature with constants and set a profile with the define_profile function. When I try accessing flow variables (after sucessfully interpreting and hooking the UDFs) with F_T(T(f,t) or when I try to access the geometry with F_AREA(A,f,t) I get a fatal signal everytime I try to run the simulation with a "segmentation fault". Error: received a fatal signal (Segmentation fault). Can you please tell me how to debugg this error? I've also tried using F_UDMI(f,t,0) to save the temperature I want to access but I get the same error. (I thought it might be a memory problem?) I'll post a few UDFs I've tried and sucesfully interpreted below. Is this an approach or user issue from my side? Thanks in advance! First UDF (Temperature): #include "udf.h" /* Compute face temperature and store in user-defined memory */ DEFINE_EXECUTE_AT_END(t_out) { Domain *d; Thread *t; face_t f; real temp; d = Get_Domain(6); t = Lookup_Thread(d, 11); begin_f_loop(f,t) { temp = F_T(f,t); F_UDMI(f,t,0) = (temp-923) / (1023-923); } end_f_loop(f,t) } Second UDF (Area): #include "udf.h" DEFINE_EXECUTE_AT_END(area_calculation) { Domain *d; face_t f; real A[ND_ND]; real area=0; int ID = 11; /*this is the ID of the boundary wall that I want to get the temperature from*/ Thread *t; int zone_ID; d = Get_Domain(6); t = Lookup_Thread(d,ID); begin_f_loop(f,t) { F_AREA(A,f,t); area = NV_MAG(A); } end_f_loop(f,t) printf("area = %g\n",area); } Third UDF (Adjust to then set profile): #include "udf.h" Thread *out_surface_T; face_t face; real t_out=0.00; real area_out=0.00; real out_face; real NV_VEC(area); DEFINE_ADJUST(adjust,d) { d = Get_Domain(6); out_surface_T=Lookup_Thread(d,11); begin_f_loop(face,out_surface_T) { F_AREA(area,face,out_surface_T); area_out+=NV_VEC(area); t_out+=F_T(face,out_surface_T)*NV_VEC(area); } end_f_loop(face,out_surface_T) out_face=t_out/area_out; printf("after adjust %d/n", out_face); } DEFINE_PROFILE(inet_T,t,i) { face_t f; begin_f_loop(f,t) { F_PROFILE(f,t,i)=out_face; } end_f_loop(f,thread) printf("after profile %d/n", out_face); } |
|
November 3, 2022, 04:03 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
was
d = Get_Domain(6); to be Code:
d = Get_Domain(1);
__________________
best regards ****************************** press LIKE if this message was helpful |
|
November 3, 2022, 04:09 |
|
#3 |
New Member
Join Date: Nov 2022
Posts: 10
Rep Power: 4 |
||
Tags |
ansys 18.0, fluent - udf, fluent 18, segmentation error, segmentation fault |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to run fluent from matlab without using aas toolbox? | artemis96 | ANSYS | 7 | May 23, 2022 13:16 |
How to change the type of a cell in FLUENT with UDFs? | husywfl | Fluent UDF and Scheme Programming | 3 | November 3, 2017 05:48 |
Fluent UDFs Repository | bbmorales | Fluent UDF and Scheme Programming | 1 | February 22, 2013 11:36 |
FLUENT UDFs | saisanthoshm88 | Fluent UDF and Scheme Programming | 22 | January 16, 2013 12:59 |
how to upload mutiple UDFs in FLUENT. | shunahshep | FLUENT | 8 | March 2, 2005 22:56 |