|
[Sponsors] |
Injection initialization generate a segmentation fault!! |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 3, 2019, 17:28 |
Injection initialization generate a segmentation fault!!
|
#1 |
Member
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 7 |
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); } } Last edited by zahrae; July 5, 2019 at 16:36. |
|
|
|
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 |