CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

Segmentation violation

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By louiza

Reply
 
LinkBack Thread Tools Display Modes
Old   July 17, 2009, 09:25
Default Segmentation violation
  #1
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 8
louiza is on a distinguished road
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.
louiza is offline   Reply With Quote

Old   July 17, 2009, 11:52
Default
  #2
Member
 
Akour
Join Date: May 2009
Posts: 79
Rep Power: 8
ak6g08 is on a distinguished road
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
ak6g08 is offline   Reply With Quote

Old   July 20, 2009, 04:49
Default
  #3
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 8
louiza is on a distinguished road
Hi

Thank you for your repley, i tested this written, but i have also the same error message "segmentation violation".
Good day
louiza is offline   Reply With Quote

Old   July 20, 2009, 09:18
Default
  #4
Member
 
Akour
Join Date: May 2009
Posts: 79
Rep Power: 8
ak6g08 is on a distinguished road
hi again
do you mind posting the entire UDF?
__________________
akour
ak6g08 is offline   Reply With Quote

Old   July 20, 2009, 09:20
Default
  #5
Member
 
Akour
Join Date: May 2009
Posts: 79
Rep Power: 8
ak6g08 is on a distinguished road
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
ak6g08 is offline   Reply With Quote

Old   July 20, 2009, 09:27
Default
  #6
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 8
louiza is on a distinguished road
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)
}
mm.abdollahzadeh likes this.
louiza is offline   Reply With Quote

Old   July 20, 2009, 09:30
Default
  #7
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 8
louiza is on a distinguished road
And i use version 6.3.26 (fluent), solver (pessure based)
louiza is offline   Reply With Quote

Old   July 20, 2009, 09:34
Default
  #8
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 8
louiza is on a distinguished road
this UDF runs very well without macro C_H_G or C_T_G in udm11, temperature max is 30000 k
louiza is offline   Reply With Quote

Old   July 20, 2009, 17:19
Default
  #9
Member
 
Akour
Join Date: May 2009
Posts: 79
Rep Power: 8
ak6g08 is on a distinguished road
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
ak6g08 is offline   Reply With Quote

Old   July 21, 2009, 08:28
Default
  #10
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 8
louiza is on a distinguished road
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
louiza is offline   Reply With Quote

Old   May 13, 2011, 06:25
Smile
  #11
New Member
 
vishal
Join Date: May 2011
Posts: 2
Rep Power: 0
vishal.marje is on a distinguished road
Quote:
Originally Posted by louiza View Post
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
hey louiza,
what happen with that second option?
Pl let me know becaus i m working on same problem.
bye
vishal.marje@gmail.com
vishal.marje is offline   Reply With Quote

Old   May 13, 2011, 08:45
Default
  #12
New Member
 
hameurlaine
Join Date: Jul 2009
Posts: 27
Rep Power: 8
louiza is on a distinguished road
hi,

I try the second, but again the same error
louiza is offline   Reply With Quote

Old   May 13, 2011, 11:51
Smile Gradient of UDM
  #13
New Member
 
vishal
Join Date: May 2011
Posts: 2
Rep Power: 0
vishal.marje is on a distinguished road
Quote:
Originally Posted by louiza View Post
hi,

I try the second, but again the same error
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
vishal.marje is offline   Reply With Quote

Old   June 20, 2013, 06:52
Default
  #14
Member
 
Yash Ganatra
Join Date: Mar 2013
Posts: 67
Rep Power: 4
yashganatra is on a distinguished road
Hi Louiza, did the problem get solved?

Yash
yashganatra is offline   Reply With Quote

Old   June 24, 2013, 07:45
Default
  #15
Member
 
Yash Ganatra
Join Date: Mar 2013
Posts: 67
Rep Power: 4
yashganatra is on a distinguished road
@ Louiza: was the problem solved?

I know its late
yashganatra is offline   Reply With Quote

Old   January 9, 2014, 13:57
Default
  #16
Senior Member
 
ali
Join Date: Oct 2009
Posts: 157
Rep Power: 7
alinik is on a distinguished road
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
alinik is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
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 16:24
segmentation violation wasan FLUENT 0 December 23, 2008 12:37
udf wall distance segmentation violation gento FLUENT 0 March 6, 2008 14:24
segmentation violation Domi FLUENT 1 November 10, 2004 19:31


All times are GMT -4. The time now is 16:46.