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

Modify inlet B.C.

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 21, 2011, 03:23
Default Modify inlet B.C.
  #1
New Member
 
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 6
ypchen is on a distinguished road
Hi, everybody.
I want to get some position's data to be using at the inlet, for example, I take the temperature value at x = 0.01 m(my model is 2D), and the inlet temperature is also the value at x = 0.01m. I know I should use the UDF, but how can I do it by using UDF code ?

Thank you very much.
ypchen is offline   Reply With Quote

Old   October 21, 2011, 04:03
Default
  #2
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Hi,
you can use DEFINE_PROFILE macro!
There, you can provide your temperature as a function of space. (it's more efficient to fit a curve with your data)

Bests,
__________________
Amir
Amir is offline   Reply With Quote

Old   October 21, 2011, 09:17
Default
  #3
New Member
 
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 6
ypchen is on a distinguished road
Hi,Amir
I had used DEFINE_PROFILE macro in my code, actually, my original inlet BC is dT/dX=0, but I don't know how to set it, so I want to get temperature value that near the inlet, creating a small temperature difference.
ypchen is offline   Reply With Quote

Old   October 21, 2011, 13:04
Default
  #4
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Quote:
Originally Posted by ypchen View Post
Hi,Amir
I had used DEFINE_PROFILE macro in my code, actually, my original inlet BC is dT/dX=0, but I don't know how to set it, so I want to get temperature value that near the inlet, creating a small temperature difference.
Hi,

I know 3 procedures for your purpose:

1) the easiest one is to use UDS equation instead of energy equation (there are similar with some modifications); then you can easily set d/dn over boundaries.
2) use a UDF with DEFINE_PROFILE macro for your inlet and set temperature of each face equal to adjacent cell center value; it would be accurate for fine mesh near inlet.
3) you can also write a UDF for heat flux over your boundary; as you know, @ your inlet, heat flux is consist of convective and diffusive flux; with dT/dX=0, you have ignored diffusive flux, so you can set heat flux to convective one.

Bests,
__________________
Amir
Amir is offline   Reply With Quote

Old   October 23, 2011, 21:27
Default
  #5
New Member
 
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 6
ypchen is on a distinguished road
Thank for your help, Amir.

I'll try your ways, it seems very helpful for me.

Thank you again !

Last edited by ypchen; October 24, 2011 at 04:50.
ypchen is offline   Reply With Quote

Old   October 24, 2011, 23:40
Default
  #6
New Member
 
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 6
ypchen is on a distinguished road
Hi, Amir, I have some question about your suggestion :


2) use a UDF with DEFINE_PROFILE macro for your inlet and set temperature of each face equal to adjacent cell center value; it would be accurate for fine mesh near inlet.
---- How to get the adjacent cell value in UDF code ?
3) you can also write a UDF for heat flux over your boundary; as you know, @ your inlet, heat flux is consist of convective and diffusive flux; with dT/dX=0, you have ignored diffusive flux, so you can set heat flux to convective one.

---- My B.C. type is pressure inlet, can I use DEFINE_HEAT_FLUX at the inlet ? If it can work, how to ignored diffusive flux in UDF code ?


thank you very much !
ypchen is offline   Reply With Quote

Old   October 25, 2011, 03:50
Default
  #7
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Quote:
Originally Posted by ypchen View Post
How to get the adjacent cell value in UDF code ?
use:
F_C0(f,t) , THREAD_T0(t) to access cell and its thread index. (refer to UDF manual table 3.2.24-25).

Quote:
Originally Posted by ypchen View Post
My B.C. type is pressure inlet, can I use DEFINE_HEAT_FLUX at the inlet ? If it can work, how to ignored diffusive flux in UDF code ?
Oops! you're right; this can be done over wall boundaries. So you can use suggestions 1 or 2.

Bests,
__________________
Amir
Amir is offline   Reply With Quote

Old   October 31, 2011, 10:51
Default
  #8
New Member
 
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 6
ypchen is on a distinguished road
Hi,Amir
I follow your suggestion to useF_C0(f,t) and THREAD_T0(t) to access cell and its thread index. When I interpreted my udf, it's OK, but the error occured after I initialize my system. I post my code below :


DEFINE_PROFILE(inlet_temp,thread,position)
{
real temp_in ;
Thread *t ;
cell_t c0 ;
Thread *t0 ;
face_t f ;
begin_f_loop(f,thread)
{
c0 = F_C0(f,t);
t0 = THREAD_T0(f,t);
temp_in = C_T(c0,t0);
F_PROFILE(f,thread,position) =temp_in;
}
end_f_loop(f,thread)

}

can you see something wrong in my code ? thank you !
ypchen is offline   Reply With Quote

Old   October 31, 2011, 11:05
Default
  #9
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Hi,

check this and inform me:

Code:
DEFINE_PROFILE(inlet_temp,thread,position)
{
 real temp_in;
 cell_t c0;
 Thread *t0;
 face_t f;
 begin_f_loop(f,thread) 
 {
 c0 = F_C0(f,thread);
 t0 = THREAD_T0(f,thread);
 temp_in = C_T(c0,t0); 
 F_PROFILE(f,thread,position) =temp_in;
 }
 end_f_loop(f,thread)
}
Bests,
__________________
Amir
Amir is offline   Reply With Quote

Old   October 31, 2011, 12:03
Default
  #10
New Member
 
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 6
ypchen is on a distinguished road
Hi, Amir

I try the new code, but the same error still happend. The error was :

Code:
 
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
ypchen is offline   Reply With Quote

Old   November 1, 2011, 03:07
Default
  #11
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Quote:
Originally Posted by ypchen View Post
Hi, Amir

I try the new code, but the same error still happend. The error was :

Code:
 
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Dear friend,

you have a bug in your code; I correct it for you but you said that ther is not any problem in compilation before!!!
try this code: (I checked that as compiled UDF) .... there was extra argument for THREAD_T0. Also ensure you've activated energy equation and initialize that.
Code:
# include "udf.h"
DEFINE_PROFILE(inlet_temp,thread,position)
{
 real temp_in;
 cell_t c0;
 Thread *t0;
 face_t f;
 begin_f_loop(f,thread) 
 {
 c0 = F_C0(f,thread);
 t0 = THREAD_T0(thread);
 temp_in = C_T(c0,t0); 
 F_PROFILE(f,thread,position) =temp_in;
 }
 end_f_loop(f,thread)
}
Bests,
__________________
Amir
Amir is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with assigned inlet velocity profile as a boundary condition Ozgur_ FLUENT 5 August 25, 2015 04:58
TimeVaryingMappedFixedValue for Direct Numerical Simulation inlet johndeas OpenFOAM 5 May 21, 2014 07:11
Species mass flow inlet lorenz FLUENT 3 March 15, 2012 08:26
transitional inlet boundary condition kamp CFX 1 June 21, 2006 11:08
inlet turbulent B.C. ROOZBEH FLUENT 3 September 25, 2003 07:07


All times are GMT -4. The time now is 18:09.