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

UDF doesn't work how I need it to - problems with the coordinate system in Fluent

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 21, 2015, 07:28
Default UDF doesn't work how I need it to - problems with the coordinate system in Fluent
  #1
New Member
 
Sarah Garden
Join Date: Sep 2014
Posts: 10
Rep Power: 12
SarahG is on a distinguished road
Hi. I am comparing the case of an oscillating aerofoil in a constant freeflow to the case of stationary aerofoil and oscillating flow. The first case is complete though I noticed something strange about the UDF and how it works...

Now I have this UDF to oscillate my x velocity and y velocity components;

#include "udf.h"
#define PI 3.14159

DEFINE_PROFILE(unsteady_xvelocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) =-cos((0.2321)+(0.1815)*sin((2*PI*0.6*t)+(PI/2)+((3*PI)/2)));
}
end_f_loop(f, thread)
}


DEFINE_PROFILE(unsteady_yvelocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) =sin((0.2321)+(0.1815)*sin((2*PI*0.6*t)+(PI/2)+((3*PI)/2)));
}
end_f_loop(f, thread)
}

This is to give a pitching amplitude of A= 20.8/2 (starting at 2.9 degrees and going up to 23.7 in an oscillatory manner) and mean angle of attack is 13.3 degrees.

I've messed around a bit with introduction of a phase change in different places. It seems to me as though Fluent picks a different axis each time. Last time I wrote an UDF for a sliding mesh it would not rotate below the x axis until I had introduced an arbitrary pi/2 in the function.

What I would like to know is; is there a kind of different coordinate system in Fluent ? My function does as I expect when it's calculated somewhere else, like in Excel.

Thanks in advance
SarahG is offline   Reply With Quote

Old   January 21, 2015, 10:01
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I read your question, but I can not see the difference between what your UDF does and what you want your UDF to do.

Quote:
This is to give a pitching amplitude of A= 20.8/2 (starting at 2.9 degrees and going up to 23.7 in an oscillatory manner) and mean angle of attack is 13.3 degrees.
And? Did you get it? If no, what did you get instead? If yes, what is the problem?
pakk is offline   Reply With Quote

Old   January 21, 2015, 11:48
Default
  #3
New Member
 
Sarah Garden
Join Date: Sep 2014
Posts: 10
Rep Power: 12
SarahG is on a distinguished road
Hello and thanks for your reply.
I want it to oscillate the flow so that the y velocity component is always positive and the x velocity component is always negative. The x works this way but the y velocity becomes negative. I can show you the aerofoil lift curve so you can maybe infer what is happening;
http://tinypic.com/m/igdf9x/3
SarahG is offline   Reply With Quote

Old   January 21, 2015, 11:59
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
For me it is more useful if you could show the y-velocity, if that is the one that is wrong. I am more an expert in UDFs than in aerofoils, I don't know what the aerofoil lift curve shows...
pakk is offline   Reply With Quote

Old   January 21, 2015, 16:45
Default
  #5
New Member
 
Sarah Garden
Join Date: Sep 2014
Posts: 10
Rep Power: 12
SarahG is on a distinguished road
Here is a time history of the y velocity at a point just before the aerofoil nose;

http://tinypic.com/m/igdi0h/3
SarahG is offline   Reply With Quote

Old   January 22, 2015, 04:20
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Is that the location where you apply "unsteady_yvelocity"?
pakk is offline   Reply With Quote

Old   January 22, 2015, 11:07
Default
  #7
New Member
 
Sarah Garden
Join Date: Sep 2014
Posts: 10
Rep Power: 12
SarahG is on a distinguished road
Ahh, okay. It is doing what is expected at the inlet;
http://tinypic.com/m/igdxyb/3
but at the same time I got the same graph as before for just before the aerofoil;
http://tinypic.com/m/igdi0h/3

I have an interface, because I'm comparing the case of oscillating aerofoil to oscillating flow, and for a direct comparison I need to keep the mesh the same.
The mesh looks like this with the interface.
http://s46.photobucket.com/user/merl...4ded6.jpg.html
SarahG is offline   Reply With Quote

Old   January 22, 2015, 11:15
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
If the velocity at the inlet is what it should be, then the UDF is behaving correctly.

I understand that the flow at point 11 is not what you expect. I can't help you with that; I don't know what you expect there, and if I knew what you were expecting there, I would not know if your expectation was wrong or if the simulation was wrong, and if I knew that the simulation would be wrong, I would have no idea which aspect of the simulation is wrong.
All I can say is that the UDF works as you want, but you also saw that, so I am useless for you, I'm afraid...
pakk is offline   Reply With Quote

Old   January 22, 2015, 11:26
Default
  #9
New Member
 
Sarah Garden
Join Date: Sep 2014
Posts: 10
Rep Power: 12
SarahG is on a distinguished road
I want it to do the same at that point-11 as it does at the inlet, except with a bit of a phase delay obviously because the flow has to get from the inlet to the aerofoil.
I'm running a simulation with another mesh without an interface to see if it might have to do with the interface
SarahG is offline   Reply With Quote

Old   January 22, 2015, 11:38
Default
  #10
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I don't know where your inlet is, and where your point 11 is, so I don't know how reasonable it is to expect that the flow at point 11 is the same as the flow at the inlet.
pakk is offline   Reply With Quote

Old   January 25, 2015, 17:51
Default
  #11
New Member
 
Sarah Garden
Join Date: Sep 2014
Posts: 10
Rep Power: 12
SarahG is on a distinguished road
Hello again. I will try to illustrate my problem with a bit more clarity (although not a problem with the UDF after all).
Here is where 'point-11' is, now called nose-point
http://s46.photobucket.com/user/merl...0f48f.jpg.html

This is the Y velocity that is desired at the nose-point, which is okay at the inlet
http://s46.photobucket.com/user/merl...65c74.jpg.html

This was the Y velocity at the nose;
http://s46.photobucket.com/user/merl...a2601.jpg.html

It has overshot the amplitude, and this is what the velocity vectors look like, to show the interface works properly
http://s46.photobucket.com/user/merl...244dd.jpg.html


I found out that I got a better match if I made the slip walls into a periodic boundary;
http://s46.photobucket.com/user/merl...de312.jpg.html
but there is still a problem in that it overshoots the amplitude in the -y axis direction.

Edit: I think I have it working now with periodic boundary conditions and reducing the distance between the inlet and the aerofoil.

Thanks

Last edited by SarahG; January 25, 2015 at 19:02.
SarahG 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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 07:05
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 08:26
compiling my UDF Seyed Farid Hosseinizadeh FLUENT 22 February 14, 2006 11:19
UDF of Zimont model in fluent Z Main CFD Forum 0 February 17, 2005 04:07
On Coordinate system used in Fluent varghese FLUENT 9 March 22, 2002 12:16


All times are GMT -4. The time now is 23:08.