|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Roshan Shanmughan
Join Date: Jun 2017
Posts: 3
Rep Power: 9 ![]() |
Hello all, I've compiled a udf which reads velocity data with corresponding time stamp from a .csv file using DEFINE_ON_DEMAND macro. Then, I use DEFINE_PROFILE to define an inlet velocity profile at flow-times corresponding to the time stamp. The udf works well on local machine but when I try to run it on a cluster, it crashes giving me the error "Node XX: Process XXXXX: Received signal SIGSEGV." I've tried to modify the udf by inserting "host_to_node_float" once the data is read using the DEFINE_ON_DEMAND udf. But, still the problem exists. Can anyone give me suggestions or ideas ? I'm posting the sample udf here.
" #include "udf.h" #define NPts 28 /* Number of data points */ /* Arrays for data */ float tDat[NPts], Uvel[NPts]; static int index = 0; DEFINE_ON_DEMAND(VelRead) { FILE* fp; char name[500] = "WeatherData.csv"; int i; fp = fopen(name, "r"); if (fp == NULL) { #if RP_HOST Message("\nError opening file: %s\n\n", name); // Dynamic file name in error message #endif return; // Exit if file is not opened } else { #if RP_HOST Message("\nSuccessfully opened file: %s\n", name); // Confirm file opened successfully #endif } // Skip the header if (fscanf(fp, "%*[^\n]\n") == EOF) { fclose(fp); #if RP_HOST Message("\nFailed to skip header in file: %s\n", name); #endif return; } for (i = 0; i < NPts; i++) { if (fscanf(fp, "%f %f \n", &tDat[i], &Uvel[i]) != 2) { #if RP_HOST Message("\nError reading data at line %d in file: %s\n", i + 2, name); // +2 considering the header and 0-index #endif break; // Exit if data reading fails } #if RP_HOST // Print each set of values read from the file Message("Read values at line %d: Time = %f, Uvel = %f\n", i + 2, tDat[i], Uvel[i]); #endif } fclose(fp); // Always close the file host_to_node_float(tDat, NPts); host_to_node_float(Uvel, NPts); Message("\nFinished reading data from file: %s\n", name); } DEFINE_PROFILE(vel_inlet_x, t, var) { real x[ND_ND]; real y; real usX; real time = CURRENT_TIME; int newindex = -1; face_t f; for (int i = 0; i < NPts; i++) { if (tDat[i] == time) { newindex = i; Message("\n index is %d\n", index); } } if (newindex != -1) { index = newindex; } Message("Uvel is %f ", Uvel[index]); begin_f_loop(f, t) { F_CENTROID(x, f, t); y = x[1]; // Assuming the y-coordinate is the second component usX = Uvel[index]; F_PROFILE(f, t, var) = usX; } end_f_loop(f, t) } " Last edited by roshan6890; June 14, 2024 at 09:16. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
hasnaa hasnaa
Join Date: Jun 2024
Posts: 5
Rep Power: 2 ![]() |
I am doing a CFD study on an electric car.
Currently, I am in the setup phase. I tried to integrate solar radiation using a function in the "User Defined" interface with C code. I tried to use the "Interpreted" extension, but I still encounter an error. When I try to use the "Compiled" extension, another error occurs. Can you send me an example of a udf function that you have already used in your studies and that can be used in ansys? Thank you in advance for your help. |
|
![]() |
![]() |
![]() |
Tags |
define_on_demand, parallel udf, sigsegv fault |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Node 0: Process xxxx: Received signal SIGSEGV | jmjohansen | FLUENT | 42 | March 18, 2024 01:23 |
Installation error with SU2 - Adjoint | cfd-jg | SU2 Installation | 0 | December 18, 2023 06:55 |