TAGGED: dpm, momentum-source, spray, udf
-
-
July 14, 2025 at 1:57 am
bluefox467
SubscriberHi,
I am implmenting a custom udf for spray. I wanted to change the trajectories of droplets by modifying their momentum. I was able to implment a udf for one direction. But for some reason, only one udf is allowed in User-defined suboption for source udf in DPM panel. Is this a mistake on my side or there is no scope for specifying momentum source term of each direction using DEFINE_DPM_SOURCE.
UDF is as below. I have similar UDF for other two directions (I am omitting header).
// X-direction source
DEFINE_DPM_SOURCE(child_momentum_source_x, c, t, S, strength, tp)
{
  real source = 0.0;
  if (CURRENT_TIME < 2.0e-4)
    return 0.0;  if (TP_DIAM(tp) < (D_PARENT - D_TOL))
  {
    real u2, u3;
    compute_target_velocity(tp, &u2, &u3);
    source = (TP_MASS(tp) / RELAX_TIME) * (u2 - TP_VEL(tp)[0]) * strength; // X
  }
  return source;
} -
July 14, 2025 at 4:57 pm
Mark O
Ansys EmployeeHi,ÂAdvice on UDF coding is outside the scope of the forum pages and so the advice we can provide here is limited. Please read the help for DEFINE_DPM_SOURCE. It has a return type of void. It doesn't return anything. The source is set by setting the pointer to the source data structure dpms_t *S, which is not fully documented in the customization manual. It does not document how to access the momentum. The source is for the associated cell the particle is passing through. Your current source calc is for a force, that is, a rate of change of momentum. You can alter the particle velocity by applying a force to the particle with DEFINE_DPM_BODY_FORCE.ÂRegardsÂMark -
July 14, 2025 at 5:06 pm
bluefox467
SubscriberThanks Mark.
As you have suggested, I digged through the customization manual...didnot find what I was looking for.
I will work on DEFINE_DPM_BODY_FORCE
-
- You must be logged in to reply to this topic.
-
3477
-
1057
-
1051
-
940
-
912
© 2025 Copyright ANSYS, Inc. All rights reserved.