|
[Sponsors] |
October 24, 2019, 09:58 |
Need help with udf code for particles
|
#1 |
New Member
jens meier
Join Date: Sep 2019
Posts: 28
Rep Power: 7 |
Hey all,
I'm dealing with a dynamic mesh and I'm using a UDF Code that calculates my viscous force on that body. Now I want to insert particles and want to ask if I need to change my Code because of those particles? Does my code also calculate the force that the particles act on the body? Best regards: #include "udf.h" static real v_prev = 0.3; DEFINE_CG_MOTION(bubble, dt, vel, omega, time, dtime) { Thread *t; face_t f; real NV_VEC(A); real Wall_Shear_Force; real viscous,force; real 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 viscous force on body by looping through all faces */ force = 0.0; viscous = 0.0; begin_f_loop (f, t) { F_AREA (A, f, t); Wall_Shear_Force = -F_STORAGE_R_N3V(f,t ,SV_WALL_SHEAR)[0]; viscous += Wall_Shear_Force ; } end_f_loop (f, t) # if RP_NODE { /* Reduce in parallel */ PRF_GRSUM1 (viscous); } # endif /* compute change in velocity, i.e., dv = F * dt / mass velocity update using explicit Euler formula */ dv = dtime * (+viscous + 0.00512) / 0.000055; v_prev += dv; Message0("time = %f, x_vel = %f, viscous_force = %f\n", time, v_prev, viscous); /* set x-component of velocity */ vel[0] = v_prev; /*Output file force viscous*/ FILE *str; str = fopen ("Output.txt","a"); if(str==NULL) { printf("Error\n"); } fprintf (str,"1, %f , 2, %f , 3, %f \n", time, viscous, v_prev); fclose (str); } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Who can fix the error on this UDF code??? | NPs | Fluent UDF and Scheme Programming | 4 | June 2, 2017 07:58 |
udf code | azer | FLUENT | 0 | April 20, 2017 18:16 |
UDF code help solve reaction rate equation palm oil | zirkov | Fluent UDF and Scheme Programming | 0 | February 13, 2017 11:34 |
write code UDF Fluent solve kinetic reaction rate equation palm oil | zirkov | FLUENT | 0 | February 13, 2017 11:16 |
How to transfer a 2D UDF code into 3D? | Jo_vivian_lee | Fluent UDF and Scheme Programming | 0 | August 26, 2012 04:36 |