# Modify inlet B.C.

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

 October 21, 2011, 03:23 Modify inlet B.C. #1 New Member   Yu-Pei Chen Join Date: Jun 2011 Posts: 26 Rep Power: 7 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.

 October 21, 2011, 04:03 #2 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 739 Blog Entries: 1 Rep Power: 15 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

 October 21, 2011, 09:17 #3 New Member   Yu-Pei Chen Join Date: Jun 2011 Posts: 26 Rep Power: 7 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.

October 21, 2011, 13:04
#4
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by ypchen 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

 October 23, 2011, 21:27 #5 New Member   Yu-Pei Chen Join Date: Jun 2011 Posts: 26 Rep Power: 7 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.

 October 24, 2011, 23:40 #6 New Member   Yu-Pei Chen Join Date: Jun 2011 Posts: 26 Rep Power: 7 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 !

October 25, 2011, 03:50
#7
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by ypchen 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 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

 October 31, 2011, 11:05 #9 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 739 Blog Entries: 1 Rep Power: 15 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

 October 31, 2011, 12:03 #10 New Member   Yu-Pei Chen Join Date: Jun 2011 Posts: 26 Rep Power: 7 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.```

November 1, 2011, 03:07
#11
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by ypchen 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"
{
real temp_in;
cell_t c0;
face_t f;
{
temp_in = C_T(c0,t0);
}
}```
Bests,
__________________
Amir

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post Ozgur_ FLUENT 5 August 25, 2015 04:58 johndeas OpenFOAM 5 May 21, 2014 07:11 lorenz FLUENT 3 March 15, 2012 08:26 kamp CFX 1 June 21, 2006 11:08 ROOZBEH FLUENT 3 September 25, 2003 07:07

All times are GMT -4. The time now is 00:51.