fluentError: received a fatal signal (Segmentation fault).
I‘m now simulating the gas-liquid two-phase flow in vertical pipe. I have written UDF including adjust function and diffusivity function. When i loaded the adjust function, the case can be calculated.However, once i added the diffusivity function, the error appeared as shown below:
Error: received a fatal signal (Segmentation fault). Error: received a fatal signal (Segmentation fault). Error Object: #f The UDF is presented below, i couldn't find the reason for the error for a long time. Could anyone do me a favor? Thank you very much!!! #include "udf.h" /* Define which user-defined scalars to use. */ enum { MF=0, N_REQUIRED_UDS }; DEFINE_ADJUST(adjust_droplet_mass_fraction, mixture_domain) { cell_t c; Thread **pt; Thread *cell_threads; /* Domain *mixture_domain; /* t is mixture_thread according to the definition of the ADJUST Macro */ mixture_domain = Get_Domain(1); /* Make sure there are enough user defined-scalars. */ if (n_uds < N_REQUIRED_UDS) Internal_Error("not enough user-defined scalars allocated"); /* Fill UDS with the variable. */ mp_thread_loop_c(cell_threads, mixture_domain, pt) { begin_c_loop (c,cell_threads) { C_UDSI(c,cell_threads,MF)= C_VOF(c,pt[1])*C_VOLUME(c,cell_threads)*C_R(c,pt[1])/(C_VOF(c,pt[1])*C_VOLUME(c,cell_threads)*C_R(c,pt[1])+C_VOF(c,pt[0])*C_VOLUME(c,cell_threads)*C_R(c,pt[0])); /*DEFINE the mass fraction of the droplet, the scalar*/ } end_c_loop (c,cell_threads) } } #include "udf.h" DEFINE_DIFFUSIVITY(my_uds_diffusivity,c,t,i) { /*int phase_domain_index=0;*/ Thread **primary_t=THREAD_SUB_THREADS(t); /* primary phase pointer*/ return C_R(c,primary_t[0])*C_MU_EFF(c,primary_t[0])*C_R(c,primary_t[0])*C_K(c,t)*C_K(c,t)/C_D(c,t); } |
The segmentation fault means that you try to access a variable, which is not saved.
The problem might be with the C_D turbulent kinetic energy dissipation rate. Do you use the k-epsilon model? If you use anything different, like k-omega, then the epsilon is not saved, and when you call C_D, you will have a segmentation fault. Try to use epsilon = 0.09*omega * k instead. |
Quote:
Is there anyway to trace and find what variable is causing this error? Also what is the workaround to this problem? |
Thomas, did you solve this?
Quote:
|
Doubt regarding UDF
Hello everyone,
I am simulating the behaviour of the non-Newtonian fluid, Colgate on top of a vibrating membrane of a speaker. I have been working on a UDF to apply on a vibrating membrane, giving it a sinusoidal input velocity, i.e., v =v0* cos(pi*x/L)*sin(2*pi*f*t) Where v0 is the maximum velocity achieved by the vibrating membrane and pi is already defined. f is the input frequency which I have obtained from previous experiments. The code I have written is as follows, but it shows a segmentation error: #include "udf.h" #include "dynamesh_tools.h" #define pi 22/7 DEFINE_GRID_MOTION(inlet_y_velocity,d,dt,time,dtim e) { Thread *t; real y[ND_ND]; real x_c; face_t f; int n; begin_f_loop(f,t,n) { x_c=y[0]; y[0]=.2*cos((pi*x_c)/.08)*sin(2*pi*120*time); } end_f_loop(f,t) } I would be highly grateful if somebody could help me on the same. |
Quote:
#define pi 3.1416 Secondly, what is your output? Because in your code, you write x_c=y[0]; y[0]=.2*cos((pi*x_c)/.08)*sin(2*pi*120*time); Don't have any initialization y[0] don't have any value and after that you insert into x_c. And then use x_c to calculate y[0]. It means that you only calculate null ??? |
Quote:
My output is supposed to be the vibrating membrane vibrating with a sinusoidal velocity input given. I understood the error there. But doesn't y[0] imply that I am initializing the y-velocity component? I have done some editing. Does the below code make more sense? #include "udf.h" #include "dynamesh_tools.h" #define pi 3.1416 DEFINE_GEOM(plane,domain,dt,position) { position[1]=0.001; } DEFINE_GRID_MOTION(inlet_y_velocity,d,dt,time,dtim e) { Thread *t; real y[ND_ND]; real x_c; face_t f; real v; Node *w; int n; SET_DEFORMING_THREAD_FLAG(THREAD_TO(t)); begin_f_loop(f,t) { f_node_loop(f,t) { w = F_NODE(f,t,n); if (NODE_X(v)>0 && NODE_X(v)<0.08 && NODE_Y(v)==0 && NODE_POS_NEED_UPDATE(v)) { NODE_POS_UPDATED(v); v=.2*cos((pi*x_c)/.08)*sin(2*pi*120*time); } end_f_loop(f,t) } } |
Hello,
Usually we get segmentation error in UDM when we have used it in a UDF but havent set the number of UDMs in fluent GUI. When we compile a UDF in which we use a UDM, before compiling we should go to DEFINE->User Defined->Memory and Set the number as you wish Hope this helps |
Quote:
|
Received a fatal Signal ( Segmentation fault )
Hi everyone !
I hope you are fine. I am using UDF in VOF model in ANSYS FLUENT, although, my VOF model without UDF is running fine. The UDF is written by my friend used it successfully. He has graduated last year after getting the results from same UDF. The UDF was working well on his server. He was using Fluent 6.3 on Linux system. When I am using same case, date and UDF on my laptop the case is not running, although UDF compilation is very fine. I also check it on Linux system too. During or after initialization, Error occurred segmentation fault error. It is very strange that same case and UDF is not working on his office now. Main error occurred when I am hooking ADJUST and EXECUTE-AT-END UDFs. May be there is some problem of writing/calling style is different in Windows and Linux system with 32bit and 64bit. ( this is just my opinion). I hope you can understand the situation and have a try to fix the problem. I would be highly thankful if you guide me that where is the problem. I can send UDF by email if needed.. Thanks in Advance, Regards, M. F. ALi |
Please have a look at my UDF and let me know what could be causing Segmentation error
Hi all, I'm writing a udf for galvanic corrosion damage. Below is my code. I was able to compile and load it, but ran into segmentation fault when I tried to run it. Please take a look and give me some ideas on how to fix it.
Code:
/********************************************************** Quote:
|
a little tips
Quote:
|
All times are GMT -4. The time now is 06:07. |