- **Fluent UDF and Scheme Programming**
(*https://www.cfd-online.com/Forums/fluent-udf/*)

- - **lagrange gun UDF**
(*https://www.cfd-online.com/Forums/fluent-udf/111808-lagrange-gun-udf.html*)

lagrange gun UDF1 Attachment(s)
I want to simulate a piston which move on the differential pressure force acting on its two surfaces.
The UDF tha I use 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; } But it doesn't work. would you please help me? thanks. |

Hi,
Why don't you use the "Compute_Force_And_Moment" function for the calculation of the force? I've seen it in the 6DOF examples of the tutorials. Marion. |

Quote:
What tutorial exactly do you refer?! I can't find it among Fluent tutorials. If you'd have such tutorial would you please send it to me?! Me E-mail is syavash_azna@yahoo.com Thank you |

Quote:
Dear Marion Would you please send me that axample? aydinkabir88@gmail.com thanks in advance. |

Quote:
This is the same approach I proposed to you in private message. Daniele |

Hi everyone
I have been working on moving projectile in a barrel. I need udf for dynamic mesh(Six degree of freedom solver). can anyone help me? |

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