CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Injection initialization generate a segmentation fault!!

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   July 3, 2019, 17:28
Default Injection initialization generate a segmentation fault!!
  #1
Member
 
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 7
zahrae is on a distinguished road
Hello!
I am trying to track the particle trajectory by DPM model using unsteady tracking.
First I simulate steady flow for my continuous phase without activating DPM model, after convergence, I import the profile of velocity and temperature at the outlet for using it as inlet conditions for the new simulation with the DPM.
Now I want to assign the velocity and temperature of the fluid to particles in each injection. However, my domain is a cylinder so I have to work with the cylindrical coordinates.
I used this UDF to impose to particles the velocity of the flow when they will be injected(initialization). The code was compiled successfully but when calculation started I get a Segmentation fault.
Code:
#include "mem.h"
#define Boltzmann 1.3806505e-23
#define pi 3.14159265358979323846
#define nu_f  0.001075
#define b1 0.186
#define b2 0.653
#define b3 0.437
#define b4 7178.74

Domain *d;
/******initializes particle injection properties********/
/************************************************** *****/
DEFINE_DPM_INJECTION_INIT(inj_vel,I)
{
Particle *p;
cell_t c=RP_CELL(&(p->cCell));
Thread *t=RP_THREAD(&(p->cCell));
real NV_VEC(origin), NV_VEC(axis),NV_VEC(V), NV_VEC(r), NV_VEC(R), NV_VEC(B),NV_VEC(W),NV_VEC(del),NV_VEC(delT),NV_VEC(er), NV_VEC(et),NV_VEC(M),NV_VEC(J);
real xc[ND_ND];
real Bmag, rmag,pver,pvet,pvaxis;
real ua, ur, ut;
///transforme the coordinates into cylindrical field///////
/* Get origin vector of fluid region */
NV_V(origin, =, THREAD_VAR(t).cell.origin);   
/* Get axis of fluid region */
NV_V (axis, =, THREAD_VAR(t).cell.axis);  
/* Store the 3 cartesian velocity components in vector V */
N3V_D(V, =, C_U(c,t),C_V(c,t),C_W(c,t));   
/* Get current cell coordinate */
C_CENTROID(xc,c,t);     
/* Calculate (R) = (Xc)-(Origin) */
NV_VV(R, =, xc, -, origin);    
/* Calculate |B| = (R) dot (axis)*/
Bmag = NV_DOT(R,axis);    
 /* Calculate (B) = |B|*axis */
NV_VS(B,=,axis,*,Bmag);     
/* Calculate (r) = (R)-(B) This is the local radial vector*/
NV_VV(r, =, R, -, B);      
/* Calculate |r|*/
rmag = NV_MAG(r);   

if (rmag != 0.)
{
NV_VS (er,=,r,/,rmag);
NV_CROSS(et, axis, er);
ur = NV_DOT(V,er);
ut = NV_DOT(V,et);
ua = NV_DOT(V,axis);
}
else
{
ur = 0.0;
ut = 0.0;
ua = NV_DOT(V,axis);
}
N3V_D(M, =,P_VEL(p)[0],P_VEL(p)[1],P_VEL(p)[2]);   
NV_VS (er,=,r,/,rmag);
NV_CROSS(et, axis, er);
pver = NV_DOT(M,er); 
pvet = NV_DOT(M,et);
pvaxis = NV_DOT(M,axis);
loop(p,I->p_init)
{
cell_t c=RP_CELL(&(p->cCell));
Thread *t=RP_THREAD(&(p->cCell));
pver=ur;
pvet =ut;
pvaxis=ua;
P_T(p)=C_T(c,t);
}
}
Thanks for your help in advance.

Last edited by zahrae; July 5, 2019 at 16:36.
zahrae is offline   Reply With Quote

 


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Segmentation fault Tushar_Telmasre Fluent UDF and Scheme Programming 4 June 1, 2017 16:19
injection problem Mark New FLUENT 0 August 4, 2013 01:30
segmentation fault when installing OF-2.1.1 on a cluster Rebecca513 OpenFOAM Installation 9 July 31, 2012 15:06
Segmentation Fault Shawn_A OpenFOAM Running, Solving & CFD 6 October 31, 2011 14:38
KIVA and Segmentation Fault Felix Main CFD Forum 2 January 18, 2006 01:24


All times are GMT -4. The time now is 07:29.