|
[Sponsors] |
Specifying equation of motion in Fluent (UDF) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 6, 2019, 03:00 |
Specifying equation of motion in Fluent (UDF)
|
#1 |
New Member
Join Date: Jul 2019
Posts: 9
Rep Power: 7 |
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)) } |
|
August 6, 2019, 03:13 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
ansys fluent customization manual
chapter -> DEFINE_GRID_MOTION best regards |
|
August 6, 2019, 05:38 |
|
#3 |
New Member
Join Date: Jul 2019
Posts: 9
Rep Power: 7 |
I am unable to write the udf. Could you help me in writing the code?
|
|
August 6, 2019, 05:39 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
why you are unable?
best regards |
|
August 6, 2019, 08:39 |
|
#5 |
New Member
Join Date: Jul 2019
Posts: 9
Rep Power: 7 |
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?
|
|
August 7, 2019, 01:37 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
show you code
best regards |
|
August 7, 2019, 03:31 |
|
#7 |
New Member
Join Date: Jul 2019
Posts: 9
Rep Power: 7 |
@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; } |
|
August 8, 2019, 02:27 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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" 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]; real i1, i2, i3,i4,omega,moment_z; Compute_Force_And_Moment(d, t_object, cg, force, moment, TRUE) moment_z= moment [2]; \* To compute the moment at the beginning of the time step and feed into the equation of motion */ i1 = exp(-0.823*time); i2 = cos (8.19*time); i3 = 48870 sin(8.19*time); i4 = 2.893 pow(10,-8); 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; } |
|
August 8, 2019, 03:17 |
|
#9 |
New Member
Join Date: Jul 2019
Posts: 9
Rep Power: 7 |
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! |
|
August 8, 2019, 08:43 |
|
#10 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
||
August 10, 2019, 11:49 |
|
#11 |
New Member
Join Date: Jul 2019
Posts: 9
Rep Power: 7 |
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; } |
|
August 11, 2019, 20:16 |
|
#12 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
it seem that this part of code computes momentum
Code:
Compute_Force_And_Moment(d, t_object, cg, force, moment, TRUE) moment_z= moment [2]; \* To compute the moment at the beginning of the time step and feed into the equation of motion */ so you got zero in Compute_Force_And_Moment function (this function was made by you) check it best regards |
|
Tags |
equation of motion, fluent - udf, grid motion |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
udf for one dimensional linear motion based on force | maccheese | Fluent UDF and Scheme Programming | 2 | September 1, 2019 03:18 |
can anyone help me about the udf of dynamic contact angle in FLUENT? | Albert Lee | FLUENT | 0 | July 1, 2018 09:21 |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
Fluent Radiation/porous media | Schmitt pierre-Louis | FLUENT | 26 | September 1, 2016 11:29 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |