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

UDF for a time varying heat flux boundary condition

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2013, 14:38
Question UDF for a time varying heat flux boundary condition
  #1
Member
 
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 46
Rep Power: 15
B.Hamada is on a distinguished road
Hello,

I'm VERY new to Fluent and I'm attempting to write a UDF that will make the heat flux at a wall a function of time. I've never programmed in C before either so I'm having some trouble getting the correct sytax

My function in Attach Files:

Please help me to witre it

I : Heat flux.
A : area of the front surface.
t : Time.
T : Temperature.
h : heat transfer coefficient.
\DeltaX : depth.
Cp: specific heat
\rho: density.

Thank you.
Attached Images
File Type: jpg udf.jpg (7.7 KB, 184 views)
B.Hamada is offline   Reply With Quote

Old   November 21, 2013, 16:44
Default
  #2
Senior Member
 
Join Date: Jan 2010
Location: Germany
Posts: 268
Rep Power: 17
Zaktatir is on a distinguished road
Please look into the UDF documentation there are some examples how to define a profile.

Macro to use is DEFINE_PROFILE(name,thread,nv) and then the function would be over F_PROFILE through the face_centroids in the face thread.
Zaktatir is offline   Reply With Quote

Old   November 21, 2013, 18:19
Talking
  #3
Member
 
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 46
Rep Power: 15
B.Hamada is on a distinguished road
Quote:
Originally Posted by Zaktatir View Post
Please look into the UDF documentation there are some examples how to define a profile.

Macro to use is DEFINE_PROFILE(name,thread,nv) and then the function would be over F_PROFILE through the face_centroids in the face thread.
Thank you, but can you give me an idea how write it please.
B.Hamada is offline   Reply With Quote

Old   November 22, 2013, 13:38
Default
  #4
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17
macfly is on a distinguished road
here is an example, I guess you can just apply the profile on your boundary as a heat flux: http://www.cfd-online.com/Forums/flu...tml#post463127
macfly is offline   Reply With Quote

Old   November 27, 2013, 03:44
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by B.Hamada View Post
Thank you, but can you give me an idea how write it please.
As Zaktatir said, there are examples in the Help. They show you how to write it, you only have to make the appropriate changes.
pakk is offline   Reply With Quote

Old   August 5, 2018, 04:32
Default
  #6
Member
 
Join Date: Oct 2017
Posts: 52
Rep Power: 8
gouravjee is on a distinguished road
Quote:
Originally Posted by pakk View Post
As Zaktatir said, there are examples in the Help. They show you how to write it, you only have to make the appropriate changes.
I have to calculate heat transfer losses from radial surface of the cylinder.
I have written a udf for this but it is showing "segmentation fault".
can you tell me where might be the problem ?

Code:
#include "udf.h"


DEFINE_PROFILE(fluxloss,thread,position)
{
real h;
real T_ext;
face_t f;
begin_f_loop(f,thread)
{
h = 10;
T_ext = 300;
F_PROFILE(f,thread,position) =-10*(WALL_TEMP_INNER(f,thread)-T_ext);
}
end_f_loop(f,thread)

}
gouravjee is offline   Reply With Quote

Old   August 5, 2018, 22:06
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
try this code
Code:
#include "udf.h"
DEFINE_PROFILE(fluxloss,thread,position)
{
real h;
real T_ext;
face_t f;
Thread *t0=thread->t0;
/* Do nothing if areas are not computed yet or not next to fluid. */
if (!Data_Valid_P() || !FLUID_THREAD_P(t0)) return;
begin_f_loop(f,thread)
{
h = 10;
T_ext = 300;
F_PROFILE(f,thread,position) =-10*(WALL_TEMP_INNER(f,thread)-T_ext);
}
end_f_loop(f,thread)
}
best regards
AlexanderZ is offline   Reply With Quote

Old   August 7, 2018, 12:44
Default
  #8
Member
 
Join Date: Oct 2017
Posts: 52
Rep Power: 8
gouravjee is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
try this code
Code:
#include "udf.h"
DEFINE_PROFILE(fluxloss,thread,position)
{
real h;
real T_ext;
face_t f;
Thread *t0=thread->t0;
/* Do nothing if areas are not computed yet or not next to fluid. */
if (!Data_Valid_P() || !FLUID_THREAD_P(t0)) return;
begin_f_loop(f,thread)
{
h = 10;
T_ext = 300;
F_PROFILE(f,thread,position) =-10*(WALL_TEMP_INNER(f,thread)-T_ext);
}
end_f_loop(f,thread)
}
best regards
can it be used for user defined scalar transport equation as i am not using the default energy equation of fluent?
gouravjee is offline   Reply With Quote

Old   August 7, 2018, 21:56
Default
  #9
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
DEFINE_PROFILE macro is using to define user-defined boundary condition. You may use it anywhere.

to set this profile as BC for UDS go to boundary conditions-> select face you are interested in -> select UDS tab -> select specified value -> select this profile instead of "constant"

best regards
AlexanderZ is offline   Reply With Quote

Old   August 8, 2018, 12:51
Default
  #10
Member
 
Join Date: Oct 2017
Posts: 52
Rep Power: 8
gouravjee is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
DEFINE_PROFILE macro is using to define user-defined boundary condition. You may use it anywhere.

to set this profile as BC for UDS go to boundary conditions-> select face you are interested in -> select UDS tab -> select specified value -> select this profile instead of "constant"

best regards
thanks for your help!!
it is working fine.
but i have a doubt that the following expression is for heat flux, should i use specified flux instead of specified value?
gouravjee is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 7 December 15, 2020 13:06
Constant Heat Flux Boundary Condition on Long Thin Pipe CGramlich SU2 3 April 22, 2013 08:25
Enforce bounds error with heat loss boundary condition at solid walls Chander CFX 2 May 1, 2012 20:11
time varying boundary condition cfd-student CFX 0 April 15, 2008 08:31
UDF for time dependent heat flux Rameshwar Ajja FLUENT 0 February 16, 2006 00:26


All times are GMT -4. The time now is 11:26.