Airfoil AoA steped increment
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 |
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. |
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. |
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; Code:
*omega = 0.0175; |
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 https://imgur.com/hfGRG6O |
Then set omega to zero for 0.099 seconds, and to (0.0175/0.001) for 0.001 seconds.
|
What about the code crtucture? Is it a loop? And what macro would be the best to consider the steps?
|
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) { Code:
if ((1000*time)%100<99) { |
All times are GMT -4. The time now is 18:50. |