# Boundary condition temperature interpolation along a curve

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 26, 2017, 07:22 Boundary condition temperature interpolation along a curve #1 New Member   Join Date: Apr 2017 Posts: 1 Rep Power: 0 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

 June 6, 2018, 09:08 #2 New Member   Felipe Join Date: Nov 2017 Location: Brazil Posts: 16 Rep Power: 8 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.

 June 15, 2018, 13:40 #3 New Member   Join Date: Apr 2018 Posts: 5 Rep Power: 7 Hi Did you solved it? i do have the same problem. Would be good to see your UDF. Regards

June 15, 2018, 20:21
#4
Senior Member

Join Date: Mar 2015
Posts: 892
Rep Power: 17
Quote:
 Originally Posted by L.Gordo Did you solved it? i do have the same problem.
What geometry do you have and what boundary condition are you trying to apply?

June 17, 2018, 10:49
#5
New Member

Join Date: Apr 2018
Posts: 5
Rep Power: 7
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?

Attached Images
 Geometry.JPG (14.5 KB, 12 views)

June 17, 2018, 22:49
#6
Senior Member

Join Date: Mar 2015
Posts: 892
Rep Power: 17
Quote:
 Originally Posted by L.Gordo 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 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).

 June 18, 2018, 12:48 #7 New Member   Join Date: Apr 2018 Posts: 5 Rep Power: 7 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?

 June 18, 2018, 19:08 #8 Senior Member   Join Date: Mar 2015 Posts: 892 Rep Power: 17 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).

 Thread Tools Search this Thread Search this Thread: Advanced Search 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 Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Mike_Tom CFX 6 September 29, 2016 02:27 Moinul Haque CFX 4 November 25, 2014 18:30 ajinkya201991 FLUENT 1 July 11, 2014 12:29 suitup OpenFOAM Bugs 15 October 14, 2010 23:18 J.D.Yoon FLUENT 1 August 29, 2000 05:08

All times are GMT -4. The time now is 20:57.

 Contact Us - CFD Online - Privacy Statement - Top