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

UDF to change angular velocity after every timestep based on the previous value

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 8, 2022, 12:13
Default UDF to change angular velocity after every timestep based on the previous value
  #1
New Member
 
Join Date: Jul 2019
Posts: 14
Rep Power: 7
usr0830 is on a distinguished road
Hello,
I am trying to run a simulation where the angular velocity of a dynamic mesh zone changes every time step based on this equation of motion where moment_z is the moment on the two aerofoils defined as one wall.

omega_prev + = ((1/I) * (moment_z - (alpha * omega_prev)))
When I set up the dynamic mesh with the udf, the initialisation returns an "All compute processes received SIGFPE." error. I am not sure what the cause of this error is. Could someone more knowledgeable please help me solve this?

This is the UDF I am using:

Code:
#include "udf.h"
real current_dt;
real omega_old;
real omega_new;
real moment_z;
static I = 0.0275; /* Moment of inertia */
static alpha = 0.00626;
static real omega_prev = 0.0;
DEFINE_CG_MOTION (rotational_motion1, dt, vel, omega, time, dtime)
{
#if !RP_HOST
current_dt = RP_Get_Integer("time-step");
if (current_dt ==1)
omega_prev = -128;
else
omega_prev = omega[2];
Message("Omega_old1 is %g",omega_prev);
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);
moment_z= moment [2]; 
/* Equation of motion */
omega_prev += ((1/I) * (moment_z - (alpha * omega_prev)));
Message("Omega_new1 is %g",omega_prev);
omega[2] = omega_prev;
#endif
}

Thank you!
usr0830 is offline   Reply With Quote

Reply

Tags
rotating domain, 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
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 03:18
UDF comilation error. urgent help please m zubair Fluent UDF and Scheme Programming 4 February 10, 2019 12:19
Fluent do not use my velocity field(by UDF) to solve energy equation tangleiplus Fluent UDF and Scheme Programming 6 January 21, 2019 22:28
adapt viscous resistance based on velocity / UDF Häwimeddel FLUENT 2 April 20, 2009 11:08
UDF velocity and temperature Raj FLUENT 3 February 1, 2009 19:29


All times are GMT -4. The time now is 16:15.