|
[Sponsors] |
fluentError: received a fatal signal (Segmentation fault). |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 19, 2014, 23:50 |
fluentError: received a fatal signal (Segmentation fault).
|
#1 |
New Member
zj
Join Date: Jul 2014
Posts: 2
Rep Power: 0 |
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); } |
|
September 11, 2014, 06:45 |
|
#2 |
New Member
Rita Szijarto
Join Date: Oct 2013
Posts: 3
Rep Power: 13 |
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. Last edited by polaritus; September 12, 2014 at 05:53. |
|
November 3, 2016, 13:12 |
|
#3 | |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 18 |
Quote:
Is there anyway to trace and find what variable is causing this error? Also what is the workaround to this problem? |
||
December 9, 2016, 17:14 |
|
#4 | |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 18 |
Thomas, did you solve this?
Quote:
|
||
June 3, 2017, 07:27 |
Doubt regarding UDF
|
#5 |
Member
Ravi
Join Date: May 2017
Posts: 32
Rep Power: 9 |
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. |
|
June 4, 2017, 04:02 |
|
#6 | |
Member
Quang Le Dang
Join Date: Jun 2012
Posts: 61
Rep Power: 14 |
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 ??? |
||
June 4, 2017, 06:42 |
|
#7 | |
Member
Ravi
Join Date: May 2017
Posts: 32
Rep Power: 9 |
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) } } Last edited by raviramesh10; June 4, 2017 at 09:24. |
||
June 19, 2017, 06:11 |
|
#8 |
Member
Shravan
Join Date: Mar 2017
Posts: 73
Rep Power: 9 |
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 |
|
June 19, 2017, 06:17 |
|
#9 | |
Member
Shravan
Join Date: Mar 2017
Posts: 73
Rep Power: 9 |
Quote:
|
||
June 30, 2017, 04:05 |
Received a fatal Signal ( Segmentation fault )
|
#10 |
Member
|
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 |
|
September 6, 2018, 19:57 |
Please have a look at my UDF and let me know what could be causing Segmentation error
|
#11 | |
New Member
Paul Lee
Join Date: Jun 2018
Location: Vancouver
Posts: 14
Rep Power: 8 |
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:
/********************************************************** node motion based on corrosion rate calculated from electric current density compiled UDF **********************************************************/ #include "udf.h" #include "metric.h" #include "mem.h" #include "sg_udms.h" #include "sg.h" #include "models.h" #include "dynamesh_tools.h" DEFINE_GRID_MOTION(corrosion_rate,domain,dt,time,dtime) { Thread *tf = DT_THREAD(dt); face_t f; cell_t c; Node *v; real y; int n; real F=96485.34; //Faraday's constant C/mol or A*s/mol real MWT=26.981539; //molecular weight int z=3; //al ion charge# real RHO=2700000; //Al density g/m^3 real sigma=5; real k=(-sigma*MWT/(z*F*RHO)); thread_loop_c (tf,domain) { begin_c_loop (c,tf) { C_UDMI(c,tf,0) = k*C_PHI_1_G(c,tf)[1]; } end_c_loop (c,tf) } /* set deforming flag on adjacent cell zone */ SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); Message ("time = %f, Cr = %f\n", time); begin_f_loop(f,tf) { f_node_loop(f,tf,n) { v = F_NODE(f,tf,n); if (NODE_POS_NEED_UPDATE (v)) { /* indicate that node position has been update so that it's not updated more than once */ NODE_POS_UPDATED(v); NODE_Y(v) -= C_UDMI(c,tf,0)*dtime; //new y position } } } end_f_loop(f,tf); } Quote:
|
||
January 13, 2021, 10:37 |
a little tips
|
#12 | |
New Member
Qi-Zhao-Lu
Join Date: Jan 2021
Posts: 2
Rep Power: 0 |
Quote:
|
||
Tags |
adjust function, udf, udsi |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VOF model error:Cortex received a fatal signal (SEGMENTATION VIOLATION) | Sdezmond | Fluent Multiphase | 4 | July 20, 2017 04:03 |
Fluent15: received a fatal signal (Segmentation fault) | lcg44 | FLUENT | 4 | August 29, 2016 13:19 |
A fatal signal (segmentation violation) | sutthinan | Fluent UDF and Scheme Programming | 6 | March 16, 2011 19:35 |
Fluent.6.2.received a fatal signal (SEGMENTATION ) | Jungfeng | FLUENT | 0 | October 8, 2007 12:05 |
error while compiling the USER Sub routine | CFD user | CFX | 3 | November 25, 2002 16:16 |