CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   DPM UDF particle position using the macro P_POS(p)[i] (http://www.cfd-online.com/Forums/fluent/63716-dpm-udf-particle-position-using-macro-p_pos-p-i.html)

 dm2747 April 17, 2009 01:29

DPM UDF particle position using the macro P_POS(p)[i]

Hello everybody,

I have a problem when I use the macro P_POS(p) to get the particle positions.

I want to calculate the particle collisions using macro DEFINE_DPM_SPRAY_COLLIDE.
As the first try, I want to obtain the particle positions and velocities using the following simple UDF.

DEFINE_DPM_SPRAY_COLLIDE(collide,tp,p)
{
Message("-----------------------------\n");
Message("particle position: %10f, %10f, %10f; velocity: º%10f, %10f, %10f; time step: º%10f\n", P_POS(tp)[0], P_POS(tp)[1], P_POS(tp)[2], P_VEL(tp)[0], P_VEL(tp)[1], P_VEL(tp)[2], P_DT(tp));
}

I can obtain two groups of results after every time step: (two particle injected in the calculation domain for every time step)

After the first time step
Results from UDF in the console window :
-----------------------------
particle position: 0.499532, 0.001013, 0.739735; velocity: -37.015999, 0.008046, 0.012735; time step: 0.000050
-----------------------------
particle position: 0.499002, 0.006400, 0.749981; velocity: -37.025082, -0.011640, -0.014559; time step: 0.000050
number tracked = 2, escaped = 0, aborted = 0, trapped = 0, evaporated = 0, incomplete = 0, coalesced = 0

These results below are obtained from DPM reports following the steps. DisplayàParticle tracksàReport Type: Current Positions and Report to: ConsoleàTrack
Time X-Position Y-Position Z-Position X-Velocity Y-Velocity Z-Velocity
4.95911e-005 4.97682e-001 1.01297e-003 7.39736e-001 -3.70160e+001 8.04605e-003 1.27348e-002
4.95911e-005 4.97151e-001 6.39963e-003 7.49980e-001 -3.70251e+001 -1.16404e-002 -1.45594e-002

After the second time step
Results from UDF in the console window :
-----------------------------
particle position: 0.498317, 0.001916, 0.765399; velocity: -37.018932, -0.005328, 0.000110; time step: 0.000050
-----------------------------
particle position: 0.499558, 0.002685, 0.760411; velocity: -37.015694, -0.006167, -0.002309; time step: 0.000050
-----------------------------
particle position: 0.497682, 0.001013, 0.739736; velocity: -37.031860, 0.016161, 0.025296; time step: 0.000050
-----------------------------
particle position: 0.497151, 0.006400, 0.749980; velocity: -37.049992, -0.023105, -0.029179; time step: 0.000050
number tracked = 4, escaped = 0, aborted = 0, trapped = 0, evaporated = 0, incomplete = 0, coalesced = 0

These results below are obtained from DPM reports using the same method mentioned above.

Time X-Position Y-Position Z-Position X-Velocity Y-Velocity Z-Velocity
4.95911e-005 4.96467e-001 1.91631e-003 7.65399e-001 -3.70189e+001 -5.32831e-003 1.09906e-004
4.95911e-005 4.97707e-001 2.68470e-003 7.60411e-001 -3.70157e+001 -6.16660e-003 -2.30891e-003
9.91821e-005 4.95831e-001 1.01357e-003 7.39737e-001 -3.70319e+001 1.61610e-002 2.52956e-002
9.91821e-005 4.95299e-001 6.39876e-003 7.49979e-001 -3.70500e+001 -2.31050e-002 -2.91788e-002

Results after the third time step as the same:

-----------------------------
particle position: 0.496467, 0.001916, 0.765399; velocity: -37.037704, -0.010518, 0.000321; time step: 0.000050
-----------------------------
particle position: 0.497707, 0.002685, 0.760411; velocity: -37.031239, -0.012192, -0.004506; time step: 0.000050
-----------------------------
particle position: 0.495831, 0.001014, 0.739737; velocity: -37.047588, 0.024344, 0.037684; time step: 0.000050
-----------------------------
particle position: 0.495299, 0.006399, 0.749979; velocity: -37.074730, -0.034395, -0.043858; time step: 0.000050
-----------------------------
particle position: 0.498798, 0.001538, 0.747872; velocity: -37.028553, -0.010786, 0.016159; time step: 0.000050
-----------------------------
particle position: 0.497937, -0.006550, 0.742732; velocity: -37.006294, 0.012822, -0.013909; time step: 0.000050
number tracked = 6, escaped = 0, aborted = 0, trapped = 0, evaporated = 0, incomplete = 0, coalesced = 0

Time X-Position Y-Position Z-Position X-Velocity Y-Velocity Z -Velocity
9.91821e-005 4.94615e-001 1.91591e-003 7.65399e-001 -3.70377e+001 -1.05180e-002 3.21468e-004
9.91821e-005 4.95856e-001 2.68424e-003 7.60411e-001 -3.70312e+001 -1.21916e-002 -4.50621e-003
1.48773e-004 4.93979e-001 1.01459e-003 7.39738e-001 -3.70476e+001 2.43444e-002 3.76838e-002
1.48773e-004 4.93446e-001 6.39733e-003 7.49977e-001 -3.70747e+001 -3.43949e-002 -4.38583e-002
4.95911e-005 4.96948e-001 1.53728e-003 7.47873e-001 -3.70286e+001 -1.07858e-002 1.61592e-002
4.95911e-005 4.96087e-001 -6.55002e-003 7.42732e-001 -3.70063e+001 1.28220e-002 -1.39095e-002

The particle velocity for a particle from two groups of results after every time step is the same, which is correct.
The problem is that the particle position for a particle from two groups of results after every time step is different.
From the calculation results, it is seems that the macro P_POS(p)[i] gets the particle position at the end of the previous time step. How can I get the particle position now in UDF.