CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   received a fatal signal(segmentation fault) (https://www.cfd-online.com/Forums/fluent-udf/170141-received-fatal-signal-segmentation-fault.html)

kihoon1214 April 25, 2016 07:01

received a fatal signal(segmentation fault)
 
I'm now simulating the porous media flow (adsorption). I have written UDF including adjust function and mass source. But the simulation is stop by error message(=segmentation fault).
This message was shown when I do initialization and Run calculation

1.only hook adjust function
=>Initialization: No error
Run calculation: error
2. hook adjust function and apply mass source
=>Initialization: error
Run calculation: error

This is my code

#include "udf.h"
#include "mem.h"
/* k = 0.15;e = 0.37; q = 730;*/
/* q=density-kg/m^3 */
/* e=porosity */
/* ldf model constant(k) is assume as 0.15(need to change) */

enum
{
ads,
X,
Sm,
source,
};


DEFINE_ADJUST(adsorption,domain)
{
Thread *t;
cell_t c;
/*real A;
real P;
real tem;*/

thread_loop_c (t, domain)
{
begin_c_loop(c,t)
{
/*tem=C_T(c,t);
P=C_P(c,t)+RP_Get_Real("operating-pressure");
A=tem*log(2339.3/P); /* Psat=fix */
C_UDSI(c,t,ads) = 0.15; /*0.35/0.01801534*exp(-0.000006*(pow(A,1.7)));*/
}
end_c_loop(c,t)
}
}
/* da equation included*/
/*P=C_P(c,t);*/
/*Psat, P is constant(25,20)*/
/*x_m=0.35, D=0.000006,n=1.7*/
/*0.01801534*/
DEFINE_ADJUST(X_ads,domain)
{
Thread *t;
cell_t c;
real dt;

thread_loop_c(t, domain)
{
begin_c_loop(c, t)
{
dt = RP_Get_Real("physical-time-step");
C_UDSI(c, t, X) = C_UDSI_M1(c, t, X) + 0.15*dt*(C_UDSI_M1(c, t, ads) - C_UDSI_M1(c, t, X));
}
end_c_loop(c, t)
}
}

DEFINE_ADJUST(masssource,domain)
{
Thread *t;
cell_t c;

thread_loop_c(t, domain)
{
begin_c_loop(c, t)
{
C_UDSI(c, t, Sm) = -0.63*730*0.01801534*0.15*(C_UDSI(c, t, ads) - C_UDSI(c,t,X));
}
end_c_loop(c, t)
}
}

DEFINE_SOURCE(m_source,c,t,dS,eqn)
{
dS[eqn] = 0.0;
return C_UDSI_M1(c,t,Sm);
}

I do not know about solution of the error message. please help me.
#I applied porous zone

thank you

vasava April 28, 2016 08:26

How about if you initialize first and then hook the UDF? Also if you initialize and run for few time-steps (at-least 2) and then hook UDF?

Since the error is too general it is difficult to judge just on basis of UDF.


All times are GMT -4. The time now is 09:51.