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

Boundary condition temperature interpolation along a curve

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 26, 2017, 06:22
Default Boundary condition temperature interpolation along a curve
  #1
New Member
 
Join Date: Apr 2017
Posts: 1
Rep Power: 0
Rodolf_G is on a distinguished road
Hi everyone,

I am working on a 2D Fluent model. My input data is among other things the temperature at various points on the boundary of the domain. But between those points on the boundary I don't know what the temperature is and I would like to interpolate temperature (linearly) inbetween. Since the boundary curve

1) Is there already an existing udf macro that does this for Fluent ?

2) Since I haven't found any for the moment, I am trying to do this defining my own udf. I have tried to interpolate the temperature based on the length of the curve using the face looping macro begin_f_loop/end_f_loop. The problem seems to be that the macro loops over the faces of the curve from one extremity to the other continuously. It appears to go back and forth, which is why the code below is not appropriate. Does anyone has a suggestion ?

Here is what I started with

#include "udf.h"

FILE *fp;

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

real T1 = 300;
real T2 = 500;

real l_tot = 0.0;
real l = 0.0;
real y_old_tot = 0.0;
real y_old = 0.0;
real x_old_tot = 0.0;
real x_old = 0.0;

begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];
l_tot = l_tot + sqrt(SQR(x[0] - x_old_tot) + SQR(x[1] - y_old_tot));
x_old_tot = x[0];
y_old_tot = x[1];
}
end_f_loop(f,t)

begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];
l = l + sqrt(SQR(x[0] - x_old) + SQR(x[1] - y_old));
F_PROFILE(f,t,i) = T1 + (T2-T1)*l/l_tot;
x_old = x[0];
y_old = x[1];
}
end_f_loop(f,t)
}

Any help will be welcome
Rodolf_G is offline   Reply With Quote

Old   June 6, 2018, 08:08
Default
  #2
FSM
New Member
 
Felipe
Join Date: Nov 2017
Location: Brazil
Posts: 16
Rep Power: 8
FSM is on a distinguished road
Hello,

Did you figure it out? I am having a similar issue, but in my case I have velocity values at some point in the horizontal direction of the inlet face. I would need to know the velocity values for the points between those, and I am trying to interpolate.
Maybe your UDF could help.
Thanks.
FSM is offline   Reply With Quote

Old   June 15, 2018, 12:40
Default
  #3
New Member
 
Join Date: Apr 2018
Posts: 5
Rep Power: 8
L.Gordo is on a distinguished road
Hi

Did you solved it? i do have the same problem.

Would be good to see your UDF.

Regards
L.Gordo is offline   Reply With Quote

Old   June 15, 2018, 19:21
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Quote:
Originally Posted by L.Gordo View Post
Did you solved it? i do have the same problem.
What geometry do you have and what boundary condition are you trying to apply?
`e` is offline   Reply With Quote

Old   June 17, 2018, 09:49
Default
  #5
New Member
 
Join Date: Apr 2018
Posts: 5
Rep Power: 8
L.Gordo is on a distinguished road
Hello,

A picture of the geometry is attached.

The inlet boundary is the pink surface, and Im trying to apply velocity inlet condition. I already have a function (V = f(x,y)) of the surface which I made using MATLAB and the meassured data, but dont know exactly how to set it in fluent

I have two main problems:

-I dont know (and cant find in the users guide) where does fluent set the coordinates origin. And I need it to set a proper velocity function.

-This function is not quite accurate, so would be better to make an interpolation with the own UDF i think.

Outlet boundaries are the green surfaces and I set a preassure outlet as boundary condition. I have no problem with them.

Any idea about how to solve it?

Thanks in advance
Attached Images
File Type: jpg Geometry.JPG (14.5 KB, 12 views)
L.Gordo is offline   Reply With Quote

Old   June 17, 2018, 21:49
Default
  #6
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Quote:
Originally Posted by L.Gordo View Post
I dont know (and cant find in the users guide) where does fluent set the coordinates origin. And I need it to set a proper velocity function.
The origin of the coordinates are set in your geometry software such as Design Modeler in ANSYS Workbench. The entire mesh can also be translated, rotated and scaled within Fluent.

Quote:
Originally Posted by L.Gordo View Post
This function is not quite accurate, so would be better to make an interpolation with the own UDF i think.
If you have a function which describes the velocity across the inlet boundary, then you could use the face loop inside a DEFINE_PROFILE macro and apply this function (see the examples in the UDF manual). If instead you have a series of discrete points then use an interpolation algorithm (there are many articles and examples of interpolating on the internet).
`e` is offline   Reply With Quote

Old   June 18, 2018, 11:48
Default
  #7
New Member
 
Join Date: Apr 2018
Posts: 5
Rep Power: 8
L.Gordo is on a distinguished road
Thanks for your time e!

I already had the function implemented in a UDF, and now that i have translated the mesh it's running properly!

But as i said, that function is not quite accurate, I'll look forward an interpolation algorithm. Do you know any book or page where i could find it?
L.Gordo is offline   Reply With Quote

Old   June 18, 2018, 18:08
Default
  #8
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
There are many methods available for interpolating in multiple dimensions (you have two dimensions from two spatial coordinates). Each method has varying degrees of accuracy, with the nearest neighbour being the most approximate.

Fluent has options for interpolating from points using some simple methods such as the nearest neighbour (see the "Profiles" section in the users guide). Note that the accuracy of the velocity at the boundary faces is dependent on the density of points in your profile data; you could increase this density with interpolation methods in a script (using standard libraries/functions).
`e` is offline   Reply With Quote

Reply


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
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 01:27
Difficulty In Setting Boundary Conditions Moinul Haque CFX 4 November 25, 2014 17:30
To change temperature in mass flow inlet boundary condition per iteration ajinkya201991 FLUENT 1 July 11, 2014 11:29
(Heattransfer) Temperature boundary condition problem suitup OpenFOAM Bugs 15 October 14, 2010 22:18
boundary condition : temperature J.D.Yoon FLUENT 1 August 29, 2000 04:08


All times are GMT -4. The time now is 07:31.