|
[Sponsors] |
January 31, 2018, 03:57 |
How to use UDF about adjacent cell ?
|
#1 |
New Member
JuBong
Join Date: Jan 2018
Posts: 16
Rep Power: 8 |
In a square module with one cell of 0.001 m2, if the temperature T1 at the inlet is a function of T2 (the temperature of the next cell in the direction of exit), how to use UDF code to express T1 (y) = T2 (y) + 100 ?
example #include "udf.h" DEFINE_PROFILE(temperature, thread, position) { real x[ND_ND]; real y; face_t f; C_T(c,t); begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; F_PROFILE(f, thread, position) = C_T(c,t) + 100; } end_f_loop(f, thread) } |
|
February 23, 2018, 03:17 |
|
#2 |
New Member
Doruk Yelkenci
Join Date: Apr 2017
Posts: 20
Rep Power: 9 |
Hello,
I have never done anything like this but I changed your code hope this works for you. DEFINE_PROFILE(temperature, thread, position) { Thread *t0; face_t f; cell_t c0; begin_f_loop (f,thread) { c0=F_C0(f,thread); // adjacent cell id t0 = F_C0_THREAD(f,thread); // adjacent cell thread F_T(f,thread)=C_T(c0,t0)+100; } end_f_loop (f,thread) } Problem with your code is you are trying to use the cell values in face loop. There are some specific macros designed to be used for cases likes yours such as the adjacent macros I wrote above. You can check the user guide if you want to know more about adjacent cells. I hope this fixes your issues. Best Regards Doruk |
|
Tags |
udf, udf code, udf temperature |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
cell wall distance using C_WALL_DIST(c,t) or other udf | zhixin | Fluent UDF and Scheme Programming | 11 | April 18, 2016 11:17 |
Using UDF in fuel cell addon module | qwe2077 | FLUENT | 5 | February 12, 2015 04:25 |
how to find the index of the adjacent cell of one cell? | jing113cn | Fluent UDF and Scheme Programming | 2 | July 8, 2010 04:26 |
Adjacent cell number | Jing | Siemens | 5 | October 21, 2002 07:29 |