Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

DPM – Momentum source terms in DEFINE_DPM_SOURCE UDF

    • bluefox467
      Subscriber

      Hi,

      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;
      }

    • Mark O
      Ansys Employee
      Hi,
       
      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
    • bluefox467
      Subscriber

      Thanks 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

Viewing 2 reply threads
  • You must be logged in to reply to this topic.