CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Two-phase Eulerian UDF problem (

zayafish November 22, 2013 16:31

Two-phase Eulerian UDF problem

I am developing an Eulerian two-phase axisymmetric model to predict the dynamic flow system in magnetic separation process. So I wrote a UDF for the source term for the force on magnetic particles (phase 2) due to the magnetic field. In my code, I defined several UDSs, which were just used as variables to store the FIXED values regarding the magnetic field strength or gradient. So these UDSs should be independent of time. However, after the simulation started running, the UDSs were perfectly showing the expected values for the first several seconds, and then it started to deform with time. As shown in the following figure, near the top two corners, the UDS 0 (magnetic field strength) values became zero. The two bubbles started from a small region (probably from one cell) and then grew bigger with time. If the simulation kept running, it just ruined all the values.

Since I am using UDSs to store the fixed values, the unsteady/convection/diffusion/sources in the main function of UDS should not be calculated. So in the User-Defined Scalars dialog box, I did switch the Flux Function and Unsteady Function to NONE. But this did not fix the deformation problem with time.

Here I attached my code. Can anyone help me figure out where I did wrong? How to resolve this deformation problem?

Thread *t;
cell_t c;
real PI = 3.1415926;
real L = 0.04; /*Length of the tube*/
real MUO = 4*PI*pow(10,-7.);
real M = 1.220703;
real x;
real y;
real r1;
real r2;
real xc[ND_ND];
real origin[ND_ND];

x = xc[0];
y = xc[1];
r1 = pow(x+0.00625,2)+pow(y,2);
r2 = pow(x-(L+0.00625),2)+pow(y,2);
C_UDSI(c,t,0) = M/(4.0*PI*sqrt(pow(r1,3)))*sqrt(3.0*pow(y,2)/r1+1.0) + M/(4.0*PI*sqrt(pow(r2,3)))*sqrt(3.0*pow(y,2)/r2+1.0);
C_UDSI(c,t,1) = C_UDSI(c,t,0)*MUO;
C_UDSI(c,t,2) = pow(C_UDSI(c,t,0),2);

Many thanks in advance!!


All times are GMT -4. The time now is 13:39.