Specifying equation of motion in Fluent (UDF)
I have a 2-d plate hinged at (0,0). It is free to rotate about the z-axis, due to the fluid forces. The motion is purely rotational about z-axis following the equation of motion as below. M is the moment of the previous time step about the z-axis due to fluid forces. the theta is the rotation angle about z-axis.
Please help me in writing the UDF. θ(t)=M(e^(-0.823t)) {(0.0001709(e^0.823t))-(0.000017177 sin(8.19t))-(0.0001709 cos(8.19t)) } |
ansys fluent customization manual
chapter -> DEFINE_GRID_MOTION best regards |
I am unable to write the udf. Could you help me in writing the code?
|
why you are unable?
best regards |
I have been trying for a long time. But I am not sure that I fully understand the functioning and the variables in the macros. Can you please help?
|
show you code
best regards |
@AlexanderZ
The equation of motion is: θ(t)=M(e^(-0.823t)) {(0.0001709(e^0.823t))-(0.000017177 sin(8.19t))-(0.0001709 cos(8.19t)) } M is the moment about the z-axis. All other dof are arrested. The domains are created similar to the link below (the airfoil replaced by flat plate): https://www.youtube.com/watch?v=G0zAHv0rEa8 The fluid flow over the flat plate generates moment about z-axis of the plate (origin). this moment should rotate the inner domain with fine mesh , as rigid body, according to the equation of motion above. On rotation, the effective angle of attack of plate changes, and hence the fluid forces and moments. This changes the moment about the z-axis which further rotates the domain (hence the plate AOA). The moment is fed into the equation of motion at the beginning of every time-step. The time step iteration should end with the rotation of the inner domain as rigid body. This process continues, until the end of time. In dynamic mesh options, I would specify the inner domain as passive 6dof udf rigid motion (i.e., no deformation in the inner domain mesh) and the plate as sdof udf rigid motion and the outer boundary as deforming zone #include "udf.h" DEFINE_CG_MOTION (rotational_motion, dt, cg_vel, cg omega, time, dtime) { Domain *d =Get Domain(1); Thread *t_object = Lookup_Thread(d, 2); real moment [ND_ND], cg[ND_ND], force [ND_ND]; Compute_Force_And_Moment(d, t_object, cg, force, moment, TRUE) real moment_z= moment [3]; \* To compute the moment at the beginning of the time step and feed into the equation of motion */ real i1 = exp(-0.823*time); real i2 = cos (8.19*time); real i3 = 48870 sin(8.19*time); real i4 = 2.893 pow(10,-8); real omega = -i4 * moment_z * i1 * (i2-i3); cg_vel[0]=0.0; cg_vel [1]=0.0; cg_ve1[2]=0.0; cg omega [0]-0.0 ; cg omega (1)-0.0; cg omega [2]=real omega; } |
Code:
moment [ND_ND] In case of 3D it has indexes 0,1,2 -> so if you want moment in z direction you should use moment[2], but not moment[3] try this code, explain your results: Code:
#include "udf.h" |
Thanks for your reply!
Do you have any idea why such error pops up when I try to compile the above udf The UDF library you are trying to load (libudf) is not compiled for 2d on the curent platform (win64). The system cannot find the file specified. Please help! |
Quote:
second isseu -> you are not compiling UDF, but try to load it. Click button build instead of load (make it in 3D, or change UDF) best regards |
Hello,
There is no error in compilation now. Thanks to you. Now the problem is the moment about the z-axis doesn't load after each time step iteration. If I omit the moment part in the previous udf, then I can see my udf running properly in the zone motion in dynamic mesh tab. But with the moment part in the udf, the motion is not updated. Can you help? #include "udf.h" DEFINE_CG_MOTION (rotational_motion, dt, cg_vel, cg omega, time, dtime) { real i1, i2, i3,i4,omega; i1 = exp(-0.823*time); i2 = cos (8.19*time); i3 = 48870 sin(8.19*time); i4 = 2.893 pow(10,-8); omega = -i4 * i1 * (i2-i3); cg_vel[0]=0.0; cg_vel [1]=0.0; cg_ve1[2]=0.0; cg omega [0]-0.0 ; cg omega (1)-0.0; cg omega [2]=real omega; } |
it seem that this part of code computes momentum
Code:
Compute_Force_And_Moment(d, t_object, cg, force, moment, TRUE) so you got zero in Compute_Force_And_Moment function (this function was made by you) check it best regards |
All times are GMT -4. The time now is 09:45. |