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

How to do UDF for temperature profile on a semi-disc?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 25, 2015, 17:13
Question How to do UDF for temperature profile on a semi-disc?
  #1
New Member
 
Xavier
Join Date: Mar 2015
Posts: 4
Rep Power: 11
Reivax is on a distinguished road
Hello everyone,
I'm new in the world of CFD, started it for a school project and I'm struggling with UDFs right now. I've been through the Ansys Fluent UDF Manual (release 14.5 from October 2012) and I still don't get how it works.

Here's my problem:
I've got this model ; a fluid enter by the inlet and exit by the outlet, the other faces are walls except for the back which is defined as a symmetry.

The upside Wall is set to a temperature of 700K and 270K for the downside.
What I want to do is to apply a linear variation of the temperature to the front face following the radii. So whichever radius you chose the variation will be the same.


I've seen there are define_profile function examples in the manual and managed to use one of theme for a simpler case, but I don't know how to adapt it to my present case.
I was thinking of something like : for each point, measure the distance to the origin, using this value to find the equivalent point on a lane for wich I can easily write the temperature profile (for example y=0) and apply the same temperature. But I don't know how to proceed.

Does anyone can help me ?
Thank you in advance.


Note
Here the UDF I adapted from the manual for this geometry


Quote:
#include "udf.h"

DEFINE_PROFILE (gradient_temp1,t,i)
{
real x[ND_ND];
real y;
face_t f;

begin_f_loop (f,t)
{
F_CENTROID(x,f,t);
y = x[0];
F_PROFILE(f,t,i) = -150*y - 200;
}
end_f_loop (f,t)
}
Reivax is offline   Reply With Quote

Old   March 25, 2015, 17:32
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
The DEFINE_PROFILE macro is for defining custom boundary conditions, not initialising your domain. It sounds like you're trying to input the expected result into Fluent, whereas Fluent computes the temperature with the energy equation!

Set the inner and outer faces with constant temperatures (270 K and 700 K, respectively, as you've stated) and initialise the domain with the average temperature (485 K). Next, enable the energy equation and solve.

If you're having convergence issues and/or really want to initialise the domain with the expected temperature profile, then look into patching.
`e` is offline   Reply With Quote

Old   March 25, 2015, 17:39
Default
  #3
New Member
 
Xavier
Join Date: Mar 2015
Posts: 4
Rep Power: 11
Reivax is on a distinguished road
Hi, thank you for your reply.
Actually I'm asked by my professor to set up a linear variation of the temperature as an input parameter. I know it's possible since I've done it in the simple case I talked about in my previous post but I don't know how to write properly the UDF for the present model.
Reivax is offline   Reply With Quote

Old   March 25, 2015, 17:58
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Well I suppose if you must initialise the temperature within the domain then you could use the DEFINE_INIT macro (set the temperature as you loop through all cells). Furthermore, if you want to force this temperature field at every iteration, then you could use the DEFINE_ADJUST macro (although forcing this temperature field could cause convergence issues).
`e` is offline   Reply With Quote

Old   March 26, 2015, 05:39
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
The way I read Reivax' question, it is not an initialization problem, but he really wants a boundary condition.

This is possible, and conceptually not so difficult: instead of
Code:
y = x[0];
which gives "y" the value of the x-coordinate, you need to calculate the distance to the center of your disc, something like
Code:
y = sqrt(x[0]*x[0]+x[1]*x[1]);
But, although it is possible to implement it, I think it is smarter to take a step back. Why does your professor ask you to do this? Is it really a boundary condition that the temperature is linear? Or is it more an expected result? Ask your professor about this. Try to understand why he asks you to do things.
In your case, I would say it is much better to put a adiabatic boundary condition on the front wall. So that there is no heat flux through the wall. The outcome will be that the temperature profile is (nearly) linear.

And it is much more logical to assume an adiabatic wall than to assume a linear temperature profile.
pakk is offline   Reply With Quote

Old   April 7, 2015, 23:54
Default
  #6
New Member
 
Xavier
Join Date: Mar 2015
Posts: 4
Rep Power: 11
Reivax is on a distinguished road
Thank you Pakk, your anwser help me solve the problem.
To anwser your question, we simulate a linear variation of the temperature on the to observe its impact on the fluid flow and the htc.
Reivax is offline   Reply With Quote

Reply

Tags
define profile, help needed, udf, udf and programming


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
Accessing profile data from a UDF ral007 Fluent UDF and Scheme Programming 1 October 14, 2015 10:21
UDF : velocity, k and epsilon (radial profile) cdiako Fluent UDF and Scheme Programming 23 July 30, 2013 09:29
defining temperature profile with UDF mohammadkm Fluent UDF and Scheme Programming 11 July 3, 2013 01:15
Read profile file from UDF DonQuijote Fluent UDF and Scheme Programming 0 February 18, 2013 12:56
Help please! UDF for Temperature profile in 3D subhankar_bhandari Fluent UDF and Scheme Programming 2 August 16, 2010 09:37


All times are GMT -4. The time now is 21:32.