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

Specifying equation of motion in Fluent (UDF)

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 6, 2019, 02:00
Default Specifying equation of motion in Fluent (UDF)
  #1
New Member
 
Join Date: Jul 2019
Posts: 9
Rep Power: 4
Shuvadeep is on a distinguished road
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)) }
Shuvadeep is offline   Reply With Quote

Old   August 6, 2019, 02:13
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,989
Rep Power: 30
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
ansys fluent customization manual
chapter -> DEFINE_GRID_MOTION

best regards
AlexanderZ is online now   Reply With Quote

Old   August 6, 2019, 04:38
Default
  #3
New Member
 
Join Date: Jul 2019
Posts: 9
Rep Power: 4
Shuvadeep is on a distinguished road
I am unable to write the udf. Could you help me in writing the code?
Shuvadeep is offline   Reply With Quote

Old   August 6, 2019, 04:39
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,989
Rep Power: 30
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
why you are unable?

best regards
AlexanderZ is online now   Reply With Quote

Old   August 6, 2019, 07:39
Default
  #5
New Member
 
Join Date: Jul 2019
Posts: 9
Rep Power: 4
Shuvadeep is on a distinguished road
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?
Shuvadeep is offline   Reply With Quote

Old   August 7, 2019, 00:37
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,989
Rep Power: 30
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
show you code

best regards
AlexanderZ is online now   Reply With Quote

Old   August 7, 2019, 02:31
Default
  #7
New Member
 
Join Date: Jul 2019
Posts: 9
Rep Power: 4
Shuvadeep is on a distinguished road
@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;
}
Shuvadeep is offline   Reply With Quote

Old   August 8, 2019, 01:27
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,989
Rep Power: 30
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
moment [ND_ND]
means that it is array, which has 2 elements in case of 2D solver and 3 elements in case of 3D solver
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;
}
best regards
AlexanderZ is online now   Reply With Quote

Old   August 8, 2019, 02:17
Default
  #9
New Member
 
Join Date: Jul 2019
Posts: 9
Rep Power: 4
Shuvadeep is on a distinguished road
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!
Shuvadeep is offline   Reply With Quote

Old   August 8, 2019, 07:43
Default
  #10
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,989
Rep Power: 30
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Quote:
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.
first of all, you've started fluent in @d mode, buy your UDF uses z-axis, which is not exists in 2D

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
AlexanderZ is online now   Reply With Quote

Old   August 10, 2019, 10:49
Default
  #11
New Member
 
Join Date: Jul 2019
Posts: 9
Rep Power: 4
Shuvadeep is on a distinguished road
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;
}
Shuvadeep is offline   Reply With Quote

Old   August 11, 2019, 19:16
Default
  #12
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,989
Rep Power: 30
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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 */
if nothing works when these lines are in your code, then it means, that moment [2] is zero
so you got zero in Compute_Force_And_Moment function (this function was made by you)
check it

best regards
AlexanderZ is online now   Reply With Quote

Reply

Tags
equation of motion, fluent - udf, grid motion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 02:18
can anyone help me about the udf of dynamic contact angle in FLUENT? Albert Lee FLUENT 0 July 1, 2018 08:21
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 07:37
Fluent Radiation/porous media Schmitt pierre-Louis FLUENT 26 September 1, 2016 10:29
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20


All times are GMT -4. The time now is 22:55.