|
[Sponsors] |
Error: received a fatal signal (Segmentation fault). |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 12, 2014, 13:08 |
Error: received a fatal signal (Segmentation fault).
|
#1 |
New Member
xxx
Join Date: Dec 2014
Posts: 3
Rep Power: 12 |
Hi, I am trying to read the pressure values at given times by interpolating the table values [t, p] (t - time, p - pressure) in order to obtain transient pressure outlet boundary condition. Thus far the simplest varsion of the code I have looks like this:
#include "udf.h" int NPts = 58; float *time_vec, *pressure_vec; float get_pressure_from_t(float xdata) { int i = 0; int j = 0; float xL, xU, ydata; for (i = 1; i<NPts; i++) { xL = time_vec[i]; xU = time_vec[i + 1]; if ((xdata >= xL) && (xdata <= xU)) { ydata = pressure_vec[i] + (xdata - xL) / (xU - xL)*(pressure_vec[i + 1] - pressure_vec[i]); break; } } if (xdata>time_vec[NPts]) { ydata = pressure_vec[NPts]; } if (xdata<time_vec[1]) { ydata = pressure_vec[1]; } return ydata; } DEFINE_ON_DEMAND(read_pressure) { int i; time_vec = (float *)malloc(NPts*sizeof(float)); pressure_vec = (float *)malloc(NPts*sizeof(float)); for (i = 1; i <= NPts; i++) { time_vec[i] = 1.98E-006*(i - 1); } pressure_vec[1] = -5253.4; pressure_vec[2] = -2740.3; pressure_vec[3] = -402; pressure_vec[4] = 2705; pressure_vec[5] = 4537; pressure_vec[6] = 1905; pressure_vec[7] = -404; pressure_vec[8] = -153; pressure_vec[9] = -2143.1; pressure_vec[10] = -5998; pressure_vec[11] = -9295.9; pressure_vec[12] = -9365.5; pressure_vec[13] = -6801.4; pressure_vec[14] = -2888.3; pressure_vec[15] = 1368; pressure_vec[16] = 6109; pressure_vec[17] = 3837; pressure_vec[18] = -1478.2; pressure_vec[19] = -6015.7; pressure_vec[20] = -6496.4; pressure_vec[21] = -5330; pressure_vec[22] = -4987.1; pressure_vec[23] = -5866.3; pressure_vec[24] = -6786.2; pressure_vec[25] = -6522.5; pressure_vec[26] = -5002.9; pressure_vec[27] = -3634.3; pressure_vec[28] = -2718.7; pressure_vec[29] = -2205.4; pressure_vec[30] = -3768.6; pressure_vec[31] = -6193.9; pressure_vec[32] = -7412.6; pressure_vec[33] = -6739.2; pressure_vec[34] = -4902.5; pressure_vec[35] = -1789.4; pressure_vec[36] = -380; pressure_vec[37] = 269; pressure_vec[38] = -30; pressure_vec[39] = -960; pressure_vec[40] = -1321; pressure_vec[41] = -926; pressure_vec[42] = -901; pressure_vec[43] = -1395.1; pressure_vec[44] = -1092; pressure_vec[45] = 1085; pressure_vec[46] = 3828; pressure_vec[47] = 5608; pressure_vec[48] = 6157; pressure_vec[49] = 3446; pressure_vec[50] = 230; pressure_vec[51] = -2499.2; pressure_vec[52] = -4046.2; pressure_vec[53] = -3982; pressure_vec[54] = -3855; pressure_vec[55] = -3413.4; pressure_vec[56] = -2941.6; pressure_vec[57] = -1750.1; pressure_vec[58] = 2632; } DEFINE_PROFILE(unsteady_pressure, thread, position) { float t, pressure; face_t f; t = RP_Get_Real("flow-time"); pressure = get_pressure_from_t(t); begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = pressure; } end_f_loop(f, thread) } Still I get this error: "Error: received a fatal signal (Segmentation fault)." Does anyone have any idea why? |
|
December 12, 2014, 14:18 |
|
#2 |
New Member
xxx
Join Date: Dec 2014
Posts: 3
Rep Power: 12 |
The answer is use execute on demand in menu Define -> User Defined -> Execute on Demand afer compiling and loading the udf. Topic closed.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
fluentError: received a fatal signal (Segmentation fault). | thomaszhangjing | Fluent UDF and Scheme Programming | 11 | January 13, 2021 10:37 |
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel | francesco | OpenFOAM Bugs | 4 | May 2, 2017 22:59 |
Fluent15: received a fatal signal (Segmentation fault) | lcg44 | FLUENT | 4 | August 29, 2016 13:19 |
Fluent.6.2.received a fatal signal (SEGMENTATION ) | Jungfeng | FLUENT | 0 | October 8, 2007 12:05 |
error while compiling the USER Sub routine | CFD user | CFX | 3 | November 25, 2002 16:16 |