|
[Sponsors] |
September 26, 2018, 13:00 |
Error at host: floating point exception
|
#1 |
New Member
christoph irrenfried
Join Date: Feb 2014
Posts: 8
Rep Power: 12 |
Hi,
i have a problem when I run an UDF in paralell and write data to a file, here is the code: Code:
DEFINE_EXECUTE_AT_END(execute_at_end) { #if !RP_HOST /* cell_t c; */ face_t face; Thread *t; Domain *d; real position[ND_ND]; real Avec[ND_ND]; float x, y, z; float temp; #else int i; #endif #if PARALLEL int size; /* data passing variables */ real *array; int pe; #endif #if !RP_NODE /* SERIAL or HOST */ FILE *f_file; char filename[32]; int i_curr_ts; snprintf(filename, sizeof(char) * 32, "ts_%d.txt", i_curr_ts); if ((f_file = fopen(filename, "w"))==NULL) Message("\n Warning: Unable to open %s for writing\n",filename); else Message("\nWriting Pressure to %s...\n",filename); #endif i_curr_ts =i_curr_ts+1; if(time_ges>=30) { #if RP_NODE /* This is now for parallel */ d = Get_Domain(1); t = Lookup_Thread(d, 11); size=THREAD_N_ELEMENTS_INT(t); array = (real *)malloc(7 * size * sizeof(real)); /* 7 rows */ begin_f_loop(face, t) { F_CENTROID(position, face, t); F_AREA(Avec, face, t); /* vol = C_VOLUME(c,t); */ temp = F_T(face, t); x = position[0]; y = position[1]; z = position[2]; array[face]= x; array[face+size]= y; array[face+size*2]= z; array[face+size*3]= temp; array[face+size*4]= Avec[0]; array[face+size*5]= Avec[1]; array[face+size*6]= Avec[2]; } end_f_loop(face, t) pe = (I_AM_NODE_ZERO_P) ? node_host : node_zero; PRF_CSEND_INT(pe, &size, 1, myid); free(array);/* free array on nodes once data sent */ if (I_AM_NODE_ZERO_P) compute_node_loop_not_zero (pe) { PRF_CRECV_INT(pe, &size, 1, pe); Message("aaaaaaaaaaaaaaaa %d\n",size); } #endif /* RP_NODE */ } } |
|
Tags |
fluent, parallel, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
icoFoam floating point exception (8) | leizhao512 | OpenFOAM Running, Solving & CFD | 7 | November 1, 2018 12:43 |
Floating point exception from twoPhaseEulerFoam | openfoammaofnepo | OpenFOAM Running, Solving & CFD | 1 | March 19, 2016 14:56 |
[blockMesh] checkMesh Floating point exception error | daniel.almeida | OpenFOAM Meshing & Mesh Conversion | 0 | July 31, 2015 15:26 |
Floating point exception (core dumped) for GAMG solver | yuhou1989 | OpenFOAM Running, Solving & CFD | 2 | March 24, 2015 20:28 |
simpleFoam Floating point exception error -help | sudhasran | OpenFOAM Running, Solving & CFD | 3 | March 12, 2012 17:23 |