|
[Sponsors] |
February 7, 2018, 22:45 |
What is Problem with F_C0 (f, t)...?
|
#1 |
New Member
JuBong
Join Date: Jan 2018
Posts: 16
Rep Power: 8 |
Hi,
By reflecting the sun and measuring the heat flux of the air entering the channel, I will try to use the heat flux using temperature at the inlet. I’m trying to use a UDF with velocity of 1.06 m/s in a velocity-inlet at the inlet to a rectangle of 0.075 * 0.1 m2 with the upper and lower walls as the fluent 2D, the inlet at the left, and the oulet at the right. I want to use the temperature of the next cell in the flow direction to give a temperature 30K higher than that cell at inlet. To use data of adjacent cells, I want to use c0 = F_C0 (f, t) and C_T (c0, t). However, if my UDF code that worked well without any problems adds only a macro called c0 = F_C0 (f, t), it will not work and the program will end. Can you see what's wrong? Can you fix it? Thank you very much for your reply. This is my code. It works well. but If I enter only 16 lines, the program will not work. ------------------------------------------------------------------------------ #include "udf.h" DEFINE_PROFILE(temperature, thread, position) { real x[ND_ND]; real y; Thread *t; face_t f; cell_t c, c0; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; c0=F_C0(f,t); /* line 16 */ F_PROFILE(f, thread, position) = -71111.111*y*y+5333.333*y+300; } end_f_loop(f, thread) } ------------------------------------------------------------------- |
|
February 8, 2018, 07:55 |
|
#2 |
Member
ehsan
Join Date: Sep 2014
Posts: 38
Rep Power: 12 |
Hi,
I am not sure if your boundary is a wall BC or not. Last edited by e_cfd; February 12, 2018 at 07:05. |
|
February 8, 2018, 21:41 |
|
#3 |
New Member
JuBong
Join Date: Jan 2018
Posts: 16
Rep Power: 8 |
Hi, e_cfd
Thank you very much. That was the problem. Is there any way to know the data of neighboring cells outside of the wall? Thank you for your reply. |
|
February 8, 2018, 22:16 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
use this code for line 16.
Code:
c0=F_C0(f,thread); /* line 16 */ |
|
February 9, 2018, 01:24 |
|
#5 |
New Member
JuBong
Join Date: Jan 2018
Posts: 16
Rep Power: 8 |
Hi, AlexanderZ.
Thank you. I changed it to what you said and it worked. But then the program stops working If I enter the code F_PROFILE (f, thread, position) = C_T (c, t); /* line 17 */ Can we see what's wrong here? Is the flow of the fluid not determined? Thank you for your reply. This is my code. ----------------------------------------------------------------------- #include "udf.h" DEFINE_PROFILE(temperature, thread, position) { real x[ND_ND]; real y; face_t f; Thread *t; cell_t c, c0; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; c0=F_C0(f,thread); F_PROFILE(f, thread, position) = C_T(c0,t); /* line 17*/ } end_f_loop(f, thread) } ----------------------------------------------------------------------- |
|
February 9, 2018, 03:52 |
|
#6 |
Member
annan
Join Date: Nov 2016
Posts: 72
Rep Power: 10 |
Hi JuBong,
Isn't it the thread in F_PROFILE(f, thread, position) = C_T(c0,t); ? if you need the thread related to cell c0 then you need to add this line (in bold) to your code : begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; c0=F_C0(f,thread); t = THREAD_T0(thread); F_PROFILE(f, thread, position) = C_T(c0,t); /* line 17*/ } end_f_loop(f, thread) } hope this will help. good luck |
|
February 9, 2018, 04:58 |
|
#7 |
Member
ehsan
Join Date: Sep 2014
Posts: 38
Rep Power: 12 |
Hi JuBong,
If I am not mistaken you want to change your inlet T (which is a boundary and definitely it or its gradient should be known) based on the next cells (which are generally unknown and are calculated based on the boundary conditions). You probably can define a gradient of T at the inlet (Neumann condition) as a heat flux (very similar to what you are looking for but in fact is different). On the other hand, it seems to me that your problem would not converge to a correct and stable solution because the problem seems to be ill-posed and undetermined (defining the bondary based on unknown T of adjacent cells ) Anyway, you always have access to the gradient of T (and other information linked to the adjacent cells) in any cells by using C_T_G(c,t) and C_T_RG(c,t)macro. Pay attention thatC_T_G(c,t) and C_T_RG(c,t) are avalable only when the energy equation is solved! Last edited by e_cfd; February 9, 2018 at 06:12. |
|
February 11, 2018, 23:29 |
|
#8 |
New Member
JuBong
Join Date: Jan 2018
Posts: 16
Rep Power: 8 |
Hello annan.
Thank you for your reply. I put t = THREAD_T0 (thread) in your code as you told me. However, the program will terminate with the following message. "MPI Application rank 0 exited before MPI_Finalize () with status 2" Can you see what's wrong? please answer about my question. This is my code. --------------------------------------------------------------------- #include "udf.h" DEFINE_PROFILE(temperature, thread, position) { real x[ND_ND]; real y; face_t f; Thread *t; cell_t c, c0; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; c0=F_C0(f,thread); t=THREAD_T0(thread); F_PROFILE(f, thread, position) = C_T(c0,t)+30; } end_f_loop(f, thread) } --------------------------------------------------------------------- |
|
February 11, 2018, 23:36 |
|
#9 |
New Member
JuBong
Join Date: Jan 2018
Posts: 16
Rep Power: 8 |
Hello e_cfd.
What you want to say is that I can directly input the temperature gradient into the inlet? If so, it is really good news. Can you give me an example of a code that can be used to enter temperature gradients in the inlet? I would really appreciate your reply. |
|
August 1, 2018, 09:30 |
|
#10 |
New Member
Hoang Nhu Quynh
Join Date: Jul 2016
Posts: 6
Rep Power: 10 |
Hi JuBong,
Did you find the solution for this? For me, each time I used c0=F_C0(f,t), the program will end as well. |
|
Tags |
udf code, udf temperature |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF compiling problem | Wouter | Fluent UDF and Scheme Programming | 6 | June 6, 2012 05:43 |
Gambit - meshing over airfoil wrapping (?) problem | JFDC | FLUENT | 1 | July 11, 2011 06:59 |
natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |
Is this problem well posed? | Thomas P. Abraham | Main CFD Forum | 5 | September 8, 1999 15:52 |