Fluids

Fluids

Error using flow variables in DPM UDF

    • kamatsa
      Subscriber

      Hello. I am trying to introduce a force in the DPM_BODY_FORCE macro in the DPM model. The force is dependent on the flow velocity so I want to incorporate the flow velocity into the equation. My code is:

      DEFINE_DPM_BODY_FORCE(DEP,tp,i)
      {
      double beta=L/D;
      double xi=beta/sqrt((beta*beta-1));
      double c1=0.5*log((xi+1)/(xi-1));
      double f=xi*((1-xi*xi)*c1*xi+xi);
      double Fd=0;
      if (TP_POS(tp)[0] >= 0.05)
      {
      if(i == 1)
      {
      Fd = -1* (pi * km * epsilon * D * D * L / 6) / (alpha / (alpha - 1) - f) * pow(V / log(R2 / R1), 2) * pow(1 / TP_POS(tp)[1], 3)+pi*mu*D*4* fabs(TP_VEL(tp)[1])*(pow(beta,2)-1)/((2*pow(beta,2)-1)*(log(beta+sqrt(pow(beta,2)-1))/sqrt(pow(beta,2)-1)-beta));
      }
      else if (i == 0)
      {
      Fd = -1*pi * mu * D * fabs(C_U(c,t)-TP_VEL(tp)[0]) * 8 * (pow(beta, 2) - 1) / ((2 * pow(beta, 2) - 3) * (log(beta + sqrt(pow(beta, 2) - 1)) / sqrt(pow(beta, 2) - 1) + beta));
      }
      }
      return(Fd/TP_MASS(tp));
      }

      I am getting the following error during compilation:
      error: use of undeclared identifier 'c'
      error: use of undeclared identifier 't'


      Is this because I am using the flow variables in a different macro that does not have the variables t & c in its declaration. If yes, how do I fix this.

      Some help would be appreciated.

    • Rob
      Ansys Employee

      Have a look at the example here   https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v221/en/flu_udf/flu_udf_sec_define_dpm_body_force.html  

    • DrAmine
      Ansys Employee

      Check the manual for more examples.

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