CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

How to use UDF about adjacent cell ?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By bigfish_1023

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 31, 2018, 05:02
Post How to use UDF about adjacent cell ?
  #1
New Member
 
JuBong
Join Date: Jan 2018
Posts: 16
Rep Power: 8
JuBong is on a distinguished road
Hi everyone,

To give the temperature because it can not give heat flux conditions to the inlet.

I want to change the heat flux condition to the temperature equation.

For example, When T2 is the temperature of the side cell in the flow direction, try to give T1 = T2 - dx / k * q ''.

for example,
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 flow), 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)
}


Could you give me some advice on how to change the code?
Or is there another way of giving heat?
JuBong is offline   Reply With Quote

Old   January 31, 2018, 21:12
Default
  #2
New Member
 
BigZ
Join Date: Jan 2018
Posts: 11
Rep Power: 8
bigfish_1023 is on a distinguished road
Quote:
Originally Posted by JuBong View Post
Hi everyone,

To give the temperature because it can not give heat flux conditions to the inlet.

I want to change the heat flux condition to the temperature equation.

For example, When T2 is the temperature of the side cell in the flow direction, try to give T1 = T2 - dx / k * q ''.

for example,
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 flow), 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)
}


Could you give me some advice on how to change the code?
Or is there another way of giving heat?
Hi, JuBong. Maybe you can use c0 = F_C0(f, t) and t0=THREAD_T0(t) to get the adjacent cell pointer and retrieve the value you want.
JuBong likes this.
bigfish_1023 is offline   Reply With Quote

Old   February 2, 2018, 04:16
Post Thank you bigfish_1023
  #3
New Member
 
JuBong
Join Date: Jan 2018
Posts: 16
Rep Power: 8
JuBong is on a distinguished road
Hello bigfish_1023

Thank you very much for your reply.

I tried using the information you gave me. ( c0=F_C0(f,t) )

The temperature of the inlet was 30K higher than the temperature of the adjacent cell.
However, the fluent does not work and the program is turned off.
Can I see what's wrong with my code?
Can you fix it?
Thank you very much for your reply.

This is my code.

------------------------------------------------
#include "udf.h"

DEFINE_PROFILE(temperature, thread, position)
{
real x[ND_ND];
real y;
Thread *t;
face_t f;
cell_t c,c0;
c0=F_C0(f,t);

begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
y = x[1];
F_PROFILE(f, thread, position) = c0+30;
}
end_f_loop(f, thread)
}
-----------------------------------------------------
JuBong is offline   Reply With Quote

Reply

Tags
udf, udf code, udf temperature


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 13:50.