CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDS convection (https://www.cfd-online.com/Forums/fluent/104406-uds-convection.html)

 sunbird04 July 9, 2012 04:16

UDS convection

Hey all,
Recently I want to use Fluent's user define scalars(uds) to solve the nucleation of equiax grain in a ingot cast problem with Fluent Eulerian Mutiphase Model. The control equation for the nucleation of equiaxed grain as follow:

N/t+(uN)=source

Therefor, for both the Unsteady Function and Flux Function should be defined by udf. My code is shown:

{
real cell_volume, physical_dt, RHO_cell, vof, vof_new, phi_old;

physical_dt = RP_Get_Real("physical-time-step");

/* IMPLICIT PART OF THE TIME DERIVATIVE DISCRETIZATION */
*apu = -(cell_volume)/physical_dt;

/* EXPLICIT PART OF THE TIME DERIVATIVE DISCRETIZATION */
*su = (cell_volume*phi_old)/physical_dt;
}

/*-------------------------*/
/* CONVECTIVE (FLUX) TERMS */
/*-------------------------*/

{
cell_t c0, c1 = -1;
real NV_VEC(psi_vec), NV_VEC(A), vof, flux = 0.0, rho = 2;

vof = C_VOF(c0, t0);

{
F_AREA(A,face_index,face_thread); /* NORMAL VECTOR OF THE FACE */

{
flux = NV_DOT(psi_vec,A); /* FLUX THROUGH THE FACE */
}
else
{

NV_DS(psi_vec, =,C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),*,1.0);
NV_DS(psi_vec,+=,C_U(c1,t1),C_V(c1,t1),C_W(c1,t1), *,1.0);

flux = NV_DOT(psi_vec,A)/2.0; /* AVERAGE FLUX THROUGH THE FACE */
}
return (flux);
}
}

Only momentum equation is solved. For these code I done two different cases:

Case I, only the melt (liquid) region is considered. For this case the simulation result is reasonable;

Case II, both the melt (liquid) and model (solid) are considered which means this is a liquid solid couple problem. For this case, the simulation cannot running. The error message emerged even at the first iteration:

Error:
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
Error Object: ()

 sunbird04 July 9, 2012 12:23

 sunbird04 July 10, 2012 11:41

Anyone who can help me?

 mkj February 13, 2013 04:33

I am not very sure, but according to FLUENT UDF manual Pg. 205, _M1 doesn't seem to be usable with C_VOF. Its probably only with cell variable in the table. I think I am facing a problem because of using C_VOF_M1.

I am using "Variable Time Step". Does anyone know if UDS is compulsory to use so that "_M1" can be used? Because, according to the user manual, if you use adaptive time step, there is no need to use UDS to utilize "_M1". I am unsure whether "Variable Time Step" (for 2 phase) qualifies as "Adaptive Time Step"

 mkj February 13, 2013 04:37

@sunbird04: Did you manage to solve your problem? Please let me know.

Thanks!

 vig February 15, 2013 06:46

If UDS is defined at the mixture level, you might require to access the volume fraction from the phase level.

If that is the case,
then define the phase thread as following

For phase-index = n , n = 0 for primary phase, 1 for 1st secondary phase