|
[Sponsors] |
udf for one dimensional linear motion based on force |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 17, 2018, 13:23 |
udf for one dimensional linear motion based on force
|
#1 |
New Member
Join Date: Mar 2018
Posts: 24
Rep Power: 8 |
Hi guys,
I am currently working on a Fluent simulation which contains a rigid body which should move in a certain way. At the moment, my goal is to get a udf file working which contains the following information: 1. Translational movement over a certain range from point a to b in negative y-direction caused by body forces of the rigids 2. A certain amount of time where the rigids rest at point b 3. Translational movement back from point b to a The magnitude of the force and the duration of time for step 2 should be modifiable in the udf. I looked at the define_cg_motion example in the udf manual, which seems to be a quite good point for me to start on. In this example, "the linear velocity is computed from a simple force balance on the body in the x-direction". Here it is: /************************************************** ********** * 1-degree of freedom equation of motion (x-direction) * compiled UDF ************************************************** **********/ #include "udf.h" static real v_prev = 0.0; DEFINE_CG_MOTION(piston,dt,vel,omega,time,dtime) { Thread *t; face_t f; real NV_VEC(A); real force, dv; /* reset velocities */ NV_S(vel, =, 0.0); NV_S(omega, =, 0.0); if (!Data_Valid_P()) return; /* get the thread pointer for which this motion is defined */ t = DT_THREAD(dt); /* compute pressure force on body by looping through all faces */ force = 0.0; begin_f_loop(f,t) { F_AREA(A,f,t); force += F_P(f,t) * NV_MAG(A); } end_f_loop(f,t) /* compute change in velocity, i.e., dv = F * dt / mass velocity update using explicit Euler formula */ dv = dtime * force / 50.0; v_prev += dv; Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev, force); /* set x-component of velocity */ vel[0] = v_prev; } However, I do not really understand how this udf is supposed to work, as the force is defined as zero (see the marked red line). I tested the udf out with a simple geometry (please see the image attached), which would allow a rigid sphere to move freely in x-direction with the use of dynamic meshing, but the sphere doesnīt bother to move at all. I modified the udf and put the force to a value of 100 instead of 0, but still no motion of the sphere. I would really appreciate some insights on this udf. Maybe I do get the udfs purpose all wrong and it isnīt supposed to work the way which I think of? Also, if you have some tips for writing an udf which performs the way i need it to, any help is really appreciated as well! In general, I am eager to learn more about C programming, but I just do not have the necessary time to learn it from the start to solve all the issues I have with udfs by myself. I do not expect someone to write the udf for me, but some tips from more experienced users are of essential meaning for the progression of my model at the moment. Thank you in advance! |
|
May 11, 2019, 04:05 |
|
#2 |
New Member
poya
Join Date: Jun 2013
Posts: 7
Rep Power: 13 |
Hi dear
This parameters is the first value for forces and at the end of loop, force summation can be calculated. |
|
September 1, 2019, 03:18 |
|
#3 | |
New Member
hossein
Join Date: Aug 2019
Posts: 2
Rep Power: 0 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
incorrect cg motion UDF sdof_properties::libudf on zone 6 (assuming no motion) | M.Magdy | Fluent UDF and Scheme Programming | 9 | April 4, 2023 13:00 |
CG Motion UDF Problem | leoarmas | Fluent UDF and Scheme Programming | 17 | February 14, 2023 09:59 |
UDF for defining a body force in Singel ROtating Reference Frame | teymourj | Fluent UDF and Scheme Programming | 9 | August 18, 2016 16:33 |
incorrect cg motion UDF sdof_properties::libudf on zone 6 (assuming no motion) | M.Magdy | Fluent UDF and Scheme Programming | 0 | March 22, 2013 07:58 |
Fluent UDF Discontinuous Motion | lequi7 | Fluent UDF and Scheme Programming | 2 | November 4, 2011 00:18 |