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

Airfoil AoA steped increment

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 26, 2018, 02:46
Default Airfoil AoA steped increment
  #1
New Member
 
Join Date: Jan 2018
Posts: 4
Rep Power: 8
van_Attre is on a distinguished road
Dear All,

I am fairly new to Fluent and UDF, therefore i would like to request some help on the following matter.

I intend to perform a simulation on a 2D airfoil. The airfoil will remain stationary until the solution approaches convergence. After that it should update the angle of attack by 1 degree every, let's say t = c/U, where c is the chord length and U the freestream velocity. The range of angles of attack would be from -180 to 180 degrees. However it is ok for each simulation to go from 0 until the extreme angle.

I have tried to create a '' for loop'' however it seems that something like that doesn't work.
Also regarding the rotation function: can i simply use axis rotation equations?
x'=x\cos \theta +y\sin \theta
y'=-x\sin \theta +y\cos \theta .}

These also didn't seem to work, but i'm guessing it's more of a coding issue.

Thank you in advance for all the help on the matter.

Best regards
van_Attre is offline   Reply With Quote

Old   January 26, 2018, 03:39
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
If you use these equations, you will rotate around the origin x=y=0, which may or may not be what you want.

Furthermore: be aware that in the code, the angle should not be in degrees but in in radians.

Having said that: your problems are most likely a coding problem, and it is nearly impossible to give further advise without seeing your code.
pakk is offline   Reply With Quote

Old   January 26, 2018, 03:45
Default
  #3
New Member
 
Join Date: Jan 2018
Posts: 4
Rep Power: 8
van_Attre is on a distinguished road
I've tried two options. The first was just to try if i could make the axis move:


#include "udf.h"
DEFINE_ZONE_MOTION(fmotion,omega,axis,origin,veloc ity,time,dtime)
{

if (flow_time >= 0.10)
{

origin[0] = 0.5;
origin[1] = 0.0;
origin[2] = 0.0;
axis[0] = axis[0] + (axis[0]*cos(0.0175)-axis[1]*sin(0.0175));
axis[1] = axis[1] + (axis[1]*sin(0.0175)+axis[1]*cos(0.0175));
axis[2] = 1.0;

}
else
{
*omega = 0.0;
}

return;
}


The second try regards the loop it:

#include "udf.h"
DEFINE_ZONE_MOTION(fmotion,omega,axis,origin,veloc ity,time,dtime)
{
for( dtime = 10; dtime = 1000; dtime = 10 )
{

origin[0] = 0.5;
origin[1] = 0.0;
origin[2] = 0.0;
axis[0] = axis[0] + (axis[0]*cos(0.0175)-axis[1]*sin(0.0175));
axis[1] = axis[1] + (axis[1]*sin(0.0175)+axis[1]*cos(0.0175));
axis[2] = 1.0;
}


return;
}

Without further due, thank you very much.
van_Attre is offline   Reply With Quote

Old   January 26, 2018, 05:35
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
I think you were successfully rotating the axis. (With a minor detail: you take the wrong components of the axis in updating the y-component.)

But this does not have the effect that you want. "Axis" does not mean the axis of your coordinate system, but the axis around which you want to rotate. You never asked Fluent to rotate anything, so it keeps the default rotation of 0 degree. If you rotate 0 degree, it does not matter in which direction the rotation axis points.

It looks like you want to rotate around the z-axis, so:
Code:
axis[0] = 0.0;    
    axis[1] = 0.0;    
    axis[2] = 1.0;
And you want a rotational speed of 0.0175:
Code:
*omega = 0.0175;
All I did to learn this was look at the Fluent manual. It even looks like the default example for DEFINE_ZONE_MOTION does (up to some different constants) exactly what you need!
pakk is offline   Reply With Quote

Old   January 26, 2018, 06:49
Default
  #5
New Member
 
Join Date: Jan 2018
Posts: 4
Rep Power: 8
van_Attre is on a distinguished road
Yes, that seems like aplausible solution. However by setting omega it will generate a constant rotational speed and increment of the angle of attack. As i explained in my first post i intend to have a sequenced update of the angle. Below i've posted a picture to ilustrate more cleared what i mean.



https://imgur.com/hfGRG6O
van_Attre is offline   Reply With Quote

Old   January 26, 2018, 07:30
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Then set omega to zero for 0.099 seconds, and to (0.0175/0.001) for 0.001 seconds.
pakk is offline   Reply With Quote

Old   January 26, 2018, 07:47
Default
  #7
New Member
 
Join Date: Jan 2018
Posts: 4
Rep Power: 8
van_Attre is on a distinguished road
What about the code crtucture? Is it a loop? And what macro would be the best to consider the steps?
van_Attre is offline   Reply With Quote

Old   January 26, 2018, 08:30
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
No loops are required, I don't even see what you want to loop over...

You want something like this:

Code:
if (time<0.099) {
 *omega = 0.0;
} else if (time<0.1) {
 *omega = (0.0175/0.001);
} else if (time<0.199) {
 *omega = 0.0;
} else if (time<0.2) {
 *omega = (0.0175/0.001);
} else ... /*and go on as many times as you need */
The following is shorter but might be more complex to understand:

Code:
if ((1000*time)%100<99) {
 *omega = 0.0;
 } else {
 *omega = (0.0175/0.001);
 }
Use this only if you understand it, because you can not fix code that you don't understand.
pakk 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
Problem with airfoil shape optimization robyTKD SU2 Shape Design 7 March 7, 2022 16:18
SU2 AOA optimization 454514566@qq.com SU2 9 March 7, 2022 16:17
Ffd_control_point_2d feiyi SU2 4 September 30, 2019 12:42
High drag for airfoil compared to XFOIL and wind tunnel data Ry10 SU2 15 October 30, 2016 17:27
2D FFD Optimization RLangtry SU2 2 August 5, 2014 09:48


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