![]() |
monitoring of displacement during fall of a body
hi,
i am using the tutorial for the 2d falling box. i want to get the displacement monitoring for the box. is it possible to get a plot of it in fluent as we get for pressure ,velocity etc... thanks for all the inputs. deepti |
I assume you can only do that with UDF. (is the tutorial running with an udf?)
|
yes,i am using the cg udf. isnt the udf meant for giving properties to the physicals phenomenon? can i include the kind of solution that i need to extract? is it possible to define a custom function? i tried doing it. but i couldnt incorporate the flow time variable.
thank you for the inputs. |
i don't know this tutorial, but cg udf sounds like "center of gravity". It should be an 6dof motion, so I assume you can extract the displacement in a file.
just like in this udf (no 6dof motion): ********* #include <stdio.h> #include "udf.h" #if !RP_NODE # define UDF_FILENAME "udf_loc_velo" # define UDF_DATA "data.dat" /* read current location and velocity from file */ static void read_loc_velo_file (real *loc, real *velo) { FILE *fp = fopen(UDF_FILENAME, "r"); if (fp != NULL) { float read_loc, read_velo; fscanf (fp, "%e %e", &read_loc, &read_velo); fclose (fp); *loc = (real) read_loc; *velo = (real) read_velo; } else { *loc = 0.0; *velo = 0.0; } } /* write current location and velocity in file */ static void write_loc_velo_file (real loc, real velo) { FILE *fp = fopen(UDF_FILENAME, "w"); if (fp != NULL) { fprintf (fp, "%e %e", loc, velo); fclose (fp); } else Message ("\nWarning: cannot write %s file", UDF_FILENAME); } /* write current location and velocity in datafile */ static void write_data_file (real time, real loc, real velo, real force) { FILE *fp = fopen(UDF_DATA, "a+"); fprintf (fp, "%e %e %e %e\n", time, loc, velo, force); fclose (fp); } #endif /* !RP_NODE */ DEFINE_ON_DEMAND(reset_velocity) { #if !RP_NODE real loc, velo; read_loc_velo_file (&loc, &velo); write_loc_velo_file (loc, 0.0); Message ("\nUDF reset_velocity called:"); #endif } DEFINE_CG_MOTION(valve, dt, cg_vel, cg_omega, time, dtime) { #if !RP_NODE Thread *t = DT_THREAD (dt); face_t f; real force, loc; #endif real velo; /* reset velocities */ NV_S (cg_vel, =, 0.0); NV_S (cg_omega, =, 0.0); if (!Data_Valid_P ()) return; #if !RP_NODE /* compute force on piston wall */ force = 0.0; begin_f_loop (f, t) { real *AA; AA = F_AREA_CACHE (f, t); force += F_P (f, t) * AA[0]; } end_f_loop (f, t) # if RP_2D if (rp_axi) force *= 2.0 * M_PI; # endif read_loc_velo_file (&loc, &velo); /* add in spring force */ # define K_SPRING 253.18 { real init_disp = 0.02791; real s_force = K_SPRING * (loc + init_disp); force = force - s_force; } /* compute change in velocity */ { real dv = dtime * force / 0.0217; velo += dv; loc += velo * dtime; } Message ("\nUDF valve: time = %f, x_vel = %f, force = %f, loc(m)= %f\n", time, velo, force, loc); write_loc_velo_file (loc, velo); write_data_file (time,loc,velo,force); #endif /* !RP_NODE */ #if PARALLEL host_to_node_real_1 (velo); #endif cg_vel[0] = velo; } DEFINE_CG_MOTION(moving_fluid, dt, cg_vel, cg_omega, time, dtime) { #if !RP_NODE Thread *t = DT_THREAD (dt); face_t f; real force, loc; #endif real velo; /* reset velocities */ NV_S (cg_vel, =, 0.0); NV_S (cg_omega, =, 0.0); if (!Data_Valid_P ()) return; #if !RP_NODE read_loc_velo_file (&loc, &velo); #endif /* !RP_NODE */ #if PARALLEL host_to_node_real_1 (velo); #endif cg_vel[0] = velo; } |
Fluent user guide (6DOF) :
Note that you can also keep track of an object's motion history using the text user interface and by entering yes for the motion-history? text interface command. define -> models -> dynamic-mesh-controls-> six-dof-parameter-> motion-history? |
| All times are GMT -4. The time now is 08:49. |