|
[Sponsors] |
July 17, 2009, 10:25 |
Segmentation violation
|
#1 |
New Member
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17 |
I am using fluent 6.3.26in LINUX. after starting the solution fluent shows a error message. Error: fluent.6.3.26 received a fatal signal (SEGMENTATION VIOLATION).
I am solving the energy equation with the enthalpy formulation. I would like to add a source term via UDF that includes the gradient of enthalpy but I get an Access Violation error when I try to use the *C_H_G*(c,t) macro, or C_T_G(c,t)*cp. If anybody knows the remedies, Please help me. Thanks. |
|
July 17, 2009, 12:52 |
|
#2 |
Member
Akour
Join Date: May 2009
Posts: 79
Rep Power: 17 |
hi,
you need to specify either a gradient direction or magnitude i.e. just doing C_T_G(c,t,0)*something as you have written is not correct, it either needs to be C_T_G(c,t)[0, 1 or 2] where 0 is x, 1 is y, 2 is z (so C_T_G(c,t)[0] is for dT/dx.) OR NV_MAG(C_T_G(c,t,0)) which is the magnitude of the gradient vector. I hope that helps
__________________
akour |
|
July 20, 2009, 05:49 |
|
#3 |
New Member
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17 |
Hi
Thank you for your repley, i tested this written, but i have also the same error message "segmentation violation". Good day |
|
July 20, 2009, 10:18 |
|
#4 |
Member
Akour
Join Date: May 2009
Posts: 79
Rep Power: 17 |
hi again
do you mind posting the entire UDF?
__________________
akour |
|
July 20, 2009, 10:20 |
|
#5 |
Member
Akour
Join Date: May 2009
Posts: 79
Rep Power: 17 |
also could you please tell me all the steps uve taken before running the simulation (i.e. what models you are using, boundary conditions...step by step)
thanks
__________________
akour |
|
July 20, 2009, 10:27 |
|
#6 |
New Member
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17 |
Hi,
My UDF is: #include "udf.h" #include "models.h" #include "data_argon3.h" #include "data_anode.h" /*================================================= ===========================*/ /* */ /* User-Defined Scalars & User-Defined Memories */ /* */ /*================================================= ===========================*/ enum { ep, /* uds 0 -> Electric Potential (V) */ pvx, /* uds 1 -> Potential Vector Axial component (Ax) */ pvr, /* uds 2 -> Potential Vector Radial component (Ar) */ N_REQUIRED_UDS /* UDS number : 3 */ }; enum { efx, /* udm 0 -> Electric Field Axial Component (Ex) */ efr, /* udm 1 -> Electric Field radial Component(Er) */ efmagn, /* udm 2 -> Electric Field Magnitude(E) */ cudx, /* udm 3 -> Current Density Axial Component (jx) */ cudr, /* udm 4 -> Current Density radial Component(jr) */ cdmagn, /* udm 5 -> Current Density Magnitude(j) */ mfh, /* udm 6 -> Magnetic Field Azimuthal Component (B) */ lpfx, /* udm 7 -> Laplace Force Axial Component(jrB) */ lpfr, /* udm 8 -> Laplace Force Radial Component(-jxB) */ jh, /* udm 9 -> Joule Heating */ rl, /* udm 10 -> Radiative Losses */ addt, /* udm 11 -> enthalpy electron */ est, /* udm 12 -> Energy Source Term */ NUM_OF_USED_UDM /* Nombre d'UDM : 13 */ }; real interp_func(real temperature, real x_array[], real y_array[], int i_max) { real x1 = x_array[0]; real y1 = y_array[0]; real x2 = x_array[1]; real y2 = y_array[1]; real slop; real interp_prop; int i = 1; while ( (i < i_max) && (temperature > x2) ) { i++; y1 = y2; x1 = x2; y2 = y_array[i]; x2 = x_array[i]; } slop = (y2 - y1) / (x2 - x1); interp_prop = slop * (temperature - x1) + y1; return interp_prop; } DEFINE_DIFFUSIVITY(udf_diffusivity, c, t, i) { /*-------------------------------------------------------------------------*/ /* uds 0 -> Electric conductivity */ /*-------------------------------------------------------------------------*/ if (i == ep) { return interp_func( C_T(c,t), sig_x, sig_y, i_max_sig ) ; } /*-------------------------------------------------------------------------*/ /* uds 1 & uds 2 -> Potential Vector Components */ /*-------------------------------------------------------------------------*/ else { return 1.0 ; } } DEFINE_PROPERTY(udf_density, c, t) { return interp_func( C_T(c,t), rho_x, rho_y, i_max_rho ) ; } /*================================================= ===========================*/ /* */ /* User-Defined Memories calculation */ /* */ /*================================================= ===========================*/ DEFINE_ADJUST(udf_adjust, domain) { Thread *t; cell_t c; /* real temp_gradient_x;*/ if ( N_UDS < N_REQUIRED_UDS ) Error("Not enough user-defined scalars allocated !"); if ( N_UDM < NUM_OF_USED_UDM ) Error("Not enough user-defined memory allocated !"); thread_loop_c(t,domain) { if (NULLP(THREAD_STORAGE(t, SV_UDS_I(ep)))) Internal_Error("Storage is not allocated for user-defined storage variable : ep"); if (NULLP(T_STORAGE_R_NV(t, SV_UDSI_G(ep)))) return ; if (NULLP(THREAD_STORAGE(t, SV_UDS_I(pvx)))) Internal_Error("Storage is not allocated for user-defined storage variable : pvx"); if (NULLP(T_STORAGE_R_NV(t, SV_UDSI_G(pvx)))) return ; if (NULLP(THREAD_STORAGE(t, SV_UDS_I(pvr)))) Internal_Error("Storage is not allocated for user-defined storage variable : pvr"); if (NULLP(T_STORAGE_R_NV(t, SV_UDSI_G(pvr)))) return ; if (NULLP(THREAD_STORAGE(t, SV_UDM_I))) Internal_Error("Thread as no user-defined memories set up on it !"); /* if (NULL != THREAD_STORAGE(t,SV_T_G)) { temp_gradient_x = C_T_G(c,t)[0]; } else { /*first iteration OR option to store gradients not turned on */ /* temp_gradient_x = 0.0; }*/ begin_c_loop(c,t) { /*-------------------------------------------------------------*/ /* udm 0 -> Electric field axial component */ /*-------------------------------------------------------------*/ C_UDMI(c,t,efx) = - C_UDSI_G(c,t,ep)[0] ; /*-------------------------------------------------------------*/ /* udm 1 -> Electric field radial component */ /*-------------------------------------------------------------*/ C_UDMI(c,t,efr) = - C_UDSI_G(c,t,ep)[1] ; /*-------------------------------------------------------------*/ /* udm 2 -> Electric field magnitude */ /*-------------------------------------------------------------*/ C_UDMI(c,t,efmagn) = NV_MAG(C_UDSI_G(c,t,ep)) ; /*-------------------------------------------------------------*/ /* udm 3 -> Current density axial component */ /*-------------------------------------------------------------*/ C_UDMI(c,t,cudx) = C_UDSI_DIFF(c,t,ep) * C_UDMI(c,t,efx) ; if (C_UDMI(c,t,cudx) > -1.0E+3) C_UDMI(c,t,cudx) = 0.0; /*-------------------------------------------------------------*/ /* udm 4 -> Current density radial component */ /*-------------------------------------------------------------*/ C_UDMI(c,t,cudr) = C_UDSI_DIFF(c,t,ep) * C_UDMI(c,t,efr) ; if (C_UDMI(c,t,cudr) > -1.0E+3) C_UDMI(c,t,cudr) = 0.0; /*-------------------------------------------------------------*/ /* udm 5 -> Current density magnitude */ /*-------------------------------------------------------------*/ C_UDMI(c,t,cdmagn) = C_UDSI_DIFF(c,t,ep) * C_UDMI(c,t,efmagn) ; /*-------------------------------------------------------------*/ /* udm 6 -> Magnetic field Azimuthal Component */ /*-------------------------------------------------------------*/ C_UDMI(c,t,mfh) = C_UDSI_G(c,t,pvr)[0] - C_UDSI_G(c,t,pvx)[1] ; /*-------------------------------------------------------------*/ /* udm 7 -> Laplace force axial component */ /*-------------------------------------------------------------*/ C_UDMI(c,t,lpfx) = C_UDMI(c,t,cudr) * C_UDMI(c,t,mfh) ; /*-------------------------------------------------------------*/ /* udm 8 -> Laplace force radial component */ /*-------------------------------------------------------------*/ C_UDMI(c,t,lpfr) = -C_UDMI(c,t,cudx) * C_UDMI(c,t,mfh) ; /*-------------------------------------------------------------*/ /* udm 9 -> Joule heating */ /*-------------------------------------------------------------*/ C_UDMI(c,t,jh) = C_UDSI_DIFF(c,t,ep) * SQR(C_UDMI(c,t,efmagn)) ; /*-------------------------------------------------------------*/ /* udm 10 -> Radiative losses */ /*-------------------------------------------------------------*/ C_UDMI(c,t,rl) = -interp_func( C_T(c,t), eps_x, eps_y, i_max_eps ) ; /*------------------------------------------------------------*/ /* udm 11 -> enthalpy electron */ /*------------------------------------------------------------*/ real KB; real e; KB = 1.3806E-23; e = 1.6e-19; C_UDMI(c,t,addt) = (2.5*KB/e)*(C_T_G(c,t)[0]*C_UDMI(c,t,cudx)*C_CP(c,t)+ C_T_G(c,t)[1]*C_UDMI(c,t,cudr)*C_CP(c,t)); /*-------------------------------------------------------------*/ /* udm 12 -> Energy source term */ /*-------------------------------------------------------------*/ C_UDMI(c,t,est) = C_UDMI(c,t,jh) + C_UDMI(c,t,rl)+ C_UDMI(c,t,addt); } end_c_loop(c,t) } } /*================================================= ===========================*/ /* */ /* Source Terms */ /* */ /*================================================= ===========================*/ /*----------------------------------------------------------------------------*/ /* x-momemtum equation */ /*----------------------------------------------------------------------------*/ DEFINE_SOURCE(udf_source_x, c, t, dS, eqn) { dS[eqn] = 0.0 ; return C_UDMI(c,t,lpfx) ; } /*----------------------------------------------------------------------------*/ /* r-momemtum equation */ /*----------------------------------------------------------------------------*/ DEFINE_SOURCE(udf_source_r, c, t, dS, eqn) { dS[eqn] = 0.0 ; return C_UDMI(c,t,lpfr) ; } /*----------------------------------------------------------------------------*/ /* energy equation */ /*----------------------------------------------------------------------------*/ DEFINE_SOURCE(udf_source_h, c, t, dS, eqn) { dS[eqn] = 0.0 ; return C_UDMI(c,t,est) ; } /*----------------------------------------------------------------------------*/ /* uds 1 equation -> Potential vector axial component equation */ /*----------------------------------------------------------------------------*/ DEFINE_SOURCE(udf_source_pvx, c, t, dS, eqn) { real MU; MU = 4 * M_PI * 1.E-07; /* permittivite du vide */ dS[eqn] = 0. ; return MU * C_UDMI(c,t,cudx) ; } /*----------------------------------------------------------------------------*/ /* uds 2 equation -> Potential vector radial component equation */ /*----------------------------------------------------------------------------*/ DEFINE_SOURCE(udf_source_pvr, c, t, dS, eqn) { real MU; MU = 4 * M_PI * 1.E-07; /* permittivite du vide */ real coord[ND_ND]; C_CENTROID(coord,c,t); dS[eqn] = - 1.0/pow(coord[1],2.0); return MU*C_UDMI(c,t,cudr)- C_UDSI(c,t,pvr)/pow(coord[1],2.0) ; } DEFINE_INIT(udf_init_temp, domain) { cell_t c; Thread *t; real coord[ND_ND]; thread_loop_c(t,domain) { begin_c_loop_all(c,t) { C_CENTROID(coord,c,t); if (coord[1] < 0.0005) C_T(c,t) = 10000.0; } end_c_loop_all(c,t) } } DEFINE_PROFILE(udf_anode_profile, thread, position) { real x[ND_ND]; real y; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]*1e+03; F_PROFILE(f, thread, position) = interp_func( y , ta_x , ta_y , i_max_t ) ; } end_f_loop(f, thread) } DEFINE_PROFILE(udf_cathode_profile, thread, position) { real x[ND_ND]; real J0; real Rmax; face_t f; J0 = -1.061E+9; Rmax = 3.0E-4; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); F_PROFILE(f, thread, position) = (-x[1]/Rmax + 1)*J0 ; } end_f_loop(f, thread) } |
|
July 20, 2009, 10:30 |
|
#7 |
New Member
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17 |
And i use version 6.3.26 (fluent), solver (pessure based)
|
|
July 20, 2009, 10:34 |
|
#8 |
New Member
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17 |
this UDF runs very well without macro C_H_G or C_T_G in udm11, temperature max is 30000 k
|
|
July 20, 2009, 18:19 |
|
#9 |
Member
Akour
Join Date: May 2009
Posts: 79
Rep Power: 17 |
a few things to try,
1. have you set the solve mode to expert? when fluent solves a transport equation it purges all gradient information available (in memory) from other transport equations, so if you have a dT/dx_i term in your momentum equation the gradient wont be in memory (wont be available at all) unless you issue the command: solve/set/expert in the FLUENT window, and answer YES when it asks if you want to free temporary memory. please try issuing this command. 2. if the above doesnt solve the problem, try hooking the adjust UDF one or two iterations after the start of the simulation to assure there is data to calculate a gradient from (but still applying the expert mode solver).
__________________
akour |
|
July 21, 2009, 09:28 |
|
#10 |
New Member
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17 |
Hi akour,
I tried the first sugugestion following the help of fluent, solver>set>expert and answer yes, i have also the same message error, I will try the second propostion and i tell you if it work. Thank you |
|
May 13, 2011, 07:25 |
|
#11 | |
New Member
vishal
Join Date: May 2011
Posts: 2
Rep Power: 0 |
Quote:
what happen with that second option? Pl let me know becaus i m working on same problem. bye vishal.marje@gmail.com |
||
May 13, 2011, 09:45 |
|
#12 |
New Member
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 17 |
hi,
I try the second, but again the same error |
|
May 13, 2011, 12:51 |
Gradient of UDM
|
#13 |
New Member
vishal
Join Date: May 2011
Posts: 2
Rep Power: 0 |
Hi louiza,
Pl help me out as i m having same problem as u had. i need to calculate current density vectors in r and x directions. Jr = delta(H_theta) / Delta(z) Jz = (1/r)*(delta(r*(H_theta)) / Delta(r)) H_theta = Magnetic field intensity r = radius Can i use C_UDMI_G(c,t,0) or something like that.........? I can post my UDF if u r interested. Pl let me know. VISHAL |
|
June 20, 2013, 07:52 |
|
#14 |
Member
Yash Ganatra
Join Date: Mar 2013
Posts: 67
Rep Power: 13 |
Hi Louiza, did the problem get solved?
Yash |
|
June 24, 2013, 08:45 |
|
#15 |
Member
Yash Ganatra
Join Date: Mar 2013
Posts: 67
Rep Power: 13 |
@ Louiza: was the problem solved?
I know its late |
|
January 9, 2014, 13:57 |
|
#16 |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 18 |
I receive the same error message when I import the mesh that is of course seems to be not a very heavy kind of mesh since it only has about 57000 elements.
any luck finding out why this error message shows up? Thanks |
|
June 27, 2017, 16:41 |
segmentation fault
|
#17 |
Member
sebastian bergman
Join Date: Mar 2017
Location: seattle
Posts: 52
Rep Power: 9 |
In my momentum equation owing to density difference i have to write a source term udf. the source term is,
source term= - ρl.(1+∝).u ⃗ .∂fl/∂t where ∝ = the volume of fraction variable fl = liquid fraction ul = Velocity vector ρl and ρs = liquid and solid density respectively I did write a udf for it -----for x-momentum---- #include "udf.h" #define rho_l 1544.0 #define rho_s 1648.0 DEFINE_SOURCE(x_momentum_source,c,t,dS,eqn) { real source; source = -(rho_l*(1+C_VOF(c,t))*C_U(c,t)*((C_LIQF(c,t)-C_LIQF_M1(c,t))/CURRENT_TIMESTEP)); dS[eqn] = 0; return source; } ----for y-momentum----- #include "udf.h" #define rho_l 1544.0 #define rho_s 1648.0 DEFINE_SOURCE(y_momentum_source,c,t,dS,eqn) { real source; source = -(rho_l*(1+C_VOF(c,t))*C_V(c,t)*((C_LIQF(c,t)-C_LIQF_M1(c,t))/CURRENT_TIMESTEP)); dS[eqn] = 0; return source; } i hooked it in the cell zone section. i was using the VOF module. IT is giving me a segmentation fault. I am not able to understand the mistake here. can anybody help? |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
udf wall distance segmentation violation | gento | FLUENT | 1 | April 15, 2016 16:59 |
Segmentation Violation | Corentin | FLUENT | 1 | February 13, 2011 02:07 |
Defining Multiphase by text and by gui = different result and Segmentation Violation | RPJones | FLUENT | 0 | June 9, 2009 17:24 |
segmentation violation | wasan | FLUENT | 0 | December 23, 2008 12:37 |
segmentation violation | Domi | FLUENT | 1 | November 10, 2004 19:31 |