CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Dilatation field (https://www.cfd-online.com/Forums/fluent/46464-dilatation-field.html)

Jiri Novak October 31, 2007 09:22

Dilatation field
 
Hi! I want to visualize velocity/pressure dilatation field of compressible flow in Fluent. I've got a formula calculating it by means of fluctuating velocity gradient

dilatation = d/dx(u``)

where:

u`` = u(actual) - u(avg)

I already have a data file of average values of velocity u(avg) during my unsteady simulation saved in UDM, but still have problem to show fluctuating velocity gradient C_UDSI_G, which seems to be zero...

Here is my UDF:

#include "udf.h"

DEFINE_ON_DEMAND(vel_x_to_udm0) { float velx; Thread *tc; cell_t c; extern Domain *domain; thread_loop_c(tc,domain) { begin_c_loop(c,tc) { velx=C_U(c,tc); C_UDMI(c,tc,0)=velx; } end_c_loop(c,tc) } }

DEFINE_ON_DEMAND(vel_y_to_udm1) { float vely; Thread *tc; cell_t c; extern Domain *domain; thread_loop_c(tc,domain) { begin_c_loop(c,tc) { vely=C_V(c,tc); C_UDMI(c,tc,1)=vely; } end_c_loop(c,tc) } }

DEFINE_ON_DEMAND(vel_fluctuation_to_udm2_and_uds0) { float udmi0,udmi1; float velx, vely, velMagAvg, velMagActual, delta; Thread *tc; cell_t c; extern Domain *domain;

thread_loop_c(tc,domain) { begin_c_loop(c,tc) { udmi0=C_UDMI(c,tc,0); udmi1=C_UDMI(c,tc,1); velx=C_U(c,tc); vely=C_V(c,tc); velMagAvg=sqrt(pow(udmi0,2)+pow(udmi1,2)); velMagActual=sqrt(pow(velx,2)+pow(vely,2)); delta=velMagActual-velMagAvg; C_UDMI(c,tc,2)=delta; C_UDSI(c,tc,0) = C_UDMI(c,tc,2); C_UDSI(c,tc,1) = NV_MAG(C_UDSI_G(c,tc,0)); } end_c_loop(c,tc) } }



All times are GMT -4. The time now is 23:06.