|
[Sponsors] |
October 21, 2011, 04:23 |
Modify inlet B.C.
|
#1 |
New Member
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 14 |
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, 05:03 |
|
#2 |
Senior Member
|
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, 10:17 |
|
#3 |
New Member
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 14 |
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, 14:04 |
|
#4 | |
Senior Member
|
Quote:
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, 22:27 |
|
#5 |
New Member
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 14 |
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 05:50. |
|
October 25, 2011, 00:40 |
|
#6 |
New Member
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 14 |
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, 04:50 |
|
#7 | |
Senior Member
|
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:
Bests,
__________________
Amir |
||
October 31, 2011, 10:51 |
|
#8 |
New Member
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 14 |
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 ! |
|
October 31, 2011, 11:05 |
|
#9 |
Senior Member
|
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) }
__________________
Amir |
|
October 31, 2011, 12:03 |
|
#10 |
New Member
Yu-Pei Chen
Join Date: Jun 2011
Posts: 26
Rep Power: 14 |
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
|
Quote:
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) }
__________________
Amir |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 05:58 |
TimeVaryingMappedFixedValue for Direct Numerical Simulation inlet | johndeas | OpenFOAM | 5 | May 21, 2014 08:11 |
Species mass flow inlet | lorenz | FLUENT | 3 | March 15, 2012 08:26 |
transitional inlet boundary condition | kamp | CFX | 1 | June 21, 2006 12:08 |
inlet turbulent B.C. | ROOZBEH | FLUENT | 3 | September 25, 2003 08:07 |