CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Ploting Drag Force Vectors (https://www.cfd-online.com/Forums/fluent-udf/142177-ploting-drag-force-vectors.html)

camilo_costa September 24, 2014 15:39

Ploting Drag Force Vectors
 
Dears Members,

Anyone has some experience for write an udf to plot the vectors of drag force in a multiphase flow modeled by Euler-Euler approach with VOF model enable?

More specified, I want to see the vectors of the drag force near the interface liquid-gas, responsible for create slug flow pattern in two phase flow.

Thanks!!

camilo_costa September 26, 2014 13:36

Find for variable
 
Well, I find this variable that should be responsible to evaluate the coefficient of the drag force on the XX direction.

C_DRAG_COEFF_ANISO_XX_IJ(c,t,i,j)

But, I dont know what for the index I J are used. Anyone could help me? Thx.

Best Regards

camilo_costa September 29, 2014 14:17

I write this udf, but the problem now is the segmentation violation!! What is wrong? This udf need be written for multiphase problems?


#include "udf.h"
/* Define which user-defined scalars to use. */
enum
{
drag_xx,
N_REQUIRED_UDS
};
DEFINE_ADJUST(adjust_fcn, domain)
{
Thread *t;
cell_t c;
int i = 2;
int j = 3;
/* Make sure there are enough user-defined scalars. */
if (n_uds < N_REQUIRED_UDS)
Internal_Error("not enough user-defined scalars allocated");
/* Fill first UDS with temperature raised to fourth power. */
thread_loop_c (t,domain)
{
if (NULL != THREAD_STORAGE(t,SV_UDS_I(drag_xx)))
{
begin_c_loop (c,t)
{
real drag_xx = C_DRAG_COEFF_ANISO_XX_IJ(c,t,i,j);
C_UDSI(c,t,0) = drag_xx;
}
end_c_loop (c,t)
}
}
}

camilo_costa September 29, 2014 15:26

I modified the udf just for test the calculation of the scalar variable. And works fine. But now I want to know how the variable is responsible for calculate the drag coefficient of a anisotropic drag model? Anyone who knows?

# include "udf.h"
DEFINE_ADJUST(adjust_gradient, mix_dom)
{
Thread **phase_t;
Thread *mix_t;
cell_t c;
face_t f;
int phase_index = 1;
/* Fill UDS with the variable. */
mp_thread_loop_c (mix_t,mix_dom,phase_t)
{
begin_c_loop (c,mix_t)
{
C_UDSI(c,mix_t,0) = C_VOF(c,phase_t[phase_index]);
}
end_c_loop (c,mix_t)
}
mp_thread_loop_f (mix_t,mix_dom,phase_t)
{
if (THREAD_STORAGE(mix_t,SV_UDS_I(0))!=NULL)
begin_f_loop (f,mix_t)
{
F_UDSI(f,mix_t,0) = F_VOF(f,phase_t[phase_index]);
}
end_f_loop (f,mix_t)
}
}
DEFINE_ON_DEMAND(store_gradient)
{
int phase_index = 1;
Thread **phase_t;
Thread *mix_t;
Domain *mix_dom;
cell_t c;
mix_dom=Get_Domain(1);
/* Fill the UDM with magnitude of gradient. */
mp_thread_loop_c (mix_t,mix_dom,phase_t)
{
begin_c_loop (c,mix_t)
{
C_UDMI(c,mix_t,0) = NV_MAG(C_UDSI_G(c,mix_t,0));
}
end_c_loop (c,mix_t)
}
}


All times are GMT -4. The time now is 05:44.