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

UDF to create rotational motion constrained between 2 angles

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 7, 2021, 09:21
Default UDF to create rotational motion constrained between 2 angles
  #1
New Member
 
unicorn
Join Date: Nov 2020
Posts: 6
Rep Power: 5
el123 is on a distinguished road
Hi there,

I'm trying to create a UDF to make a circular domain rotate about its centre but constrained to between its starting position and -90 degrees. Once it reaches -90 degrees I want it to rotate the back the opposite way to its start position.

I have differentiated theta = -90*(sin(100t))^2 to get theta dot (angular speed)

I currently have the below UDF that doesn't seem to be constraining the motion:

Code:
#include "udf.h"
#define PI 3.141592654
real theta_max = - 90 * (PI/180);
real omega = 100 * (2 * PI/60);

DEFINE_TRANSIENT_PROFILE(circ, time)
{
real theta_dot = 2 * theta_max * omega * cos(omega * time) * sin(omega * time);
return theta_dot;

}
Thanks in advance.
el123 is offline   Reply With Quote

Old   December 14, 2021, 07:33
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you code should work without issues
however, I prefer to make few changes to avoid using standard names
Code:
#include "udf.h"
real theta_max = - 90 * (M_PI/180);
real omega_w = 100 * (2 * M_PI/60);

DEFINE_TRANSIENT_PROFILE(circ, time)
{
real theta_dot = 2 * theta_max * omega_w * cos(omega_w * time) * sin(omega_w * time);
return theta_dot;
}
use small enough time step. Seems like the period of wave is about 0.4 sec
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply

Tags
constrained, fluent, rotational motion, udf


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
How to define movement/deformation relative to a rigid body motion in Fluent by udf? eagle_001 Fluent UDF and Scheme Programming 6 May 17, 2022 03:41
UDF for equation of motion saadyw Fluent UDF and Scheme Programming 0 January 23, 2018 12:48
OpenFoam "Permission denied" and "command not found" problems. iyidaniel@yahoo.co.uk OpenFOAM Running, Solving & CFD 11 January 2, 2018 06:47
UDF Problem about Grid Motion !!! Zhengyu Gao Fluent UDF and Scheme Programming 0 December 6, 2013 19:45
udf in MRF to update the rotational speed Jam FLUENT 0 August 21, 2005 12:50


All times are GMT -4. The time now is 12:23.