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/)
-   -   Error SIGSEGV for a simulation with UDF (https://www.cfd-online.com/Forums/fluent-udf/218955-error-sigsegv-simulation-udf.html)

francescolab July 10, 2019 03:29

Error SIGSEGV for a simulation with UDF
 
Hi, i wrote an UDF for the control of the adaptive time step, i have the error in the picture from fluent. How can i solve?

Quote:

#include "udf.h"
#include"udf.h"
#include"metric.h"
#include"stdio.h"
#include"math.h"
#include"stdlib.h"
#include"mem.h"

DEFINE_DELTAT(deltat,d)
{
real time_step;
real tx=CURRENT_TIME;
Thread *t,*t0, *t1 =NULL;
cell_t c0, c1 =-1;
face_t f;
real x0[ND_ND];
real x1[ND_ND];
real time_step_x;
real time_step_y;
int n =0;
real dx =0.0, dy =0.0;
real cent[2];
double centr_x, centr_y;
double vel_x, vel_y;
n =0;
Domain *domain;
domain = Get_Domain(1);
time_step=0.01;
if ( tx<=0 ) {
time_step=0.01;
} else {
thread_loop_f(t,domain)
{
begin_f_loop (f,t)
{
c0 = F_C0(f,t);
t0 = F_C0_THREAD(f,t);
if (BOUNDARY_FACE_THREAD_P(t))
{}
else
{
n+=1;
t1 = F_C1_THREAD(f,t);
c1 = F_C1(f,t);
C_CENTROID(x0,c0,t0);
C_CENTROID(x1,c1,t1);
dx = x1[0]-x0[0];
dy = x1[1]-x0[1];

F_CENTROID(cent,f,t);

centr_x = cent[0];
centr_y = cent[1];
vel_x = F_U(f,t);
vel_y = F_U(f,t);
if(time_step<0)
{
time_step_x=abs((dx / vel_x) *0.8);
time_step_y=abs((dy / vel_y) *0.8);
time_step=MIN(time_step_x,time_step_y);
}
else
{
time_step=MIN (time_step, abs(dx / vel_x) *0.8);
time_step=MIN (time_step, abs(dy / vel_y) *0.8);
}
}
end_f_loop(f,t)
}

}
}
return time_step;
}

https://ibb.co/jWnyrgB

https://ibb.co/jWnyrgB

AlexanderZ July 10, 2019 03:50

stop copy/paste threads!
use your previous one https://www.cfd-online.com/Forums/fl...rror-loop.html

best regards


All times are GMT -4. The time now is 17:19.