|
[Sponsors] |
udf to get pressure of the cell with the minimum temperature |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 8, 2023, 11:24 |
udf to get pressure of the cell with the minimum temperature
|
#1 |
New Member
Springyuu
Join Date: Nov 2019
Posts: 14
Rep Power: 7 |
Hi, everyone!I'm trying to write an udf to get the minimum temperature of cell, then get pressure and coordinates of that cell.
The udf I wrote can be load and built, but when execute on demand, an error message occurs,"Node 999999: Process 98196: Received signal SIGSEGV. The fl process could not be started.". Can anyone give me some advice or help me fix the code? thanks~ #include "udf.h" DEFINE_ON_DEMAND(on_demand_calc) { Domain *d; real tmin = 0; real temp, press, tmin_x,tmin_y; Thread *t; cell_t c; cell_t tmin_cell; Thread *tmin_t; real xc[ND_ND]; d = Get_Domain(1); thread_loop_c(t, d) { begin_c_loop(c, t) { temp = C_T(c, t); if (temp < tmin || tmin == 0.0) { tmin = temp; tmin_cell = c; tmin_t = t; } } end_c_loop(c, t) } C_CENTROID(xc,tmin_cell,tmin_t); tmin_x = xc[0]; tmin_y = xc[1]; printf("\n Xtmin=%g Ymin=%g\n", tmin_x, tmin_y); press = C_P(tmin_cell, tmin_t); printf("\n Tmin=%g Press=%g\n",tmin, press); } |
|
November 9, 2023, 00:33 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
#include "udf.h" DEFINE_ON_DEMAND(on_demand_calc) { Domain *d; real tmin = 0; real temp, press, tmin_x,tmin_y; Thread *t; cell_t c; cell_t tmin_cell; Thread *tmin_t; real xc[ND_ND]; d = Get_Domain(1); thread_loop_c(t, d) { begin_c_loop(c, t) { temp = C_T(c, t); if (temp < tmin || tmin == 0.0) { tmin = temp; tmin_cell = c; tmin_t = t; } } end_c_loop(c, t) } C_CENTROID(xc,tmin_cell,tmin_t); tmin_x = xc[0]; tmin_y = xc[1]; Message0("\n Xtmin=%g Ymin=%g\n", tmin_x, tmin_y); press = C_P(tmin_cell, tmin_t); Message0("\n Tmin=%g Press=%g\n",tmin, press); }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
November 9, 2023, 08:29 |
|
#3 |
New Member
Springyuu
Join Date: Nov 2019
Posts: 14
Rep Power: 7 |
thanks, it's useful to use Message0 or Message instead of printf.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Temperature anomoly at pressure reference cell | will.logie | OpenFOAM Running, Solving & CFD | 22 | July 17, 2021 00:26 |
UDF in case with DPM modle | POSTHU | Fluent UDF and Scheme Programming | 0 | March 3, 2021 08:21 |
UDF for pressure outlet backflow total temperature | MrDaimon | FLUENT | 13 | June 23, 2017 01:45 |
UDF: Pointing Cell Pressure | Jim87 | Fluent UDF and Scheme Programming | 4 | October 20, 2013 14:56 |
Cells with t below lower limit | Purushothama | Siemens | 2 | May 31, 2010 22:58 |