Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

write particle date in a output file by using example 2.5.10.3 in UDF manual

TAGGED: , ,

    • ll00023
      Subscriber

      Dear staff,

      I tried to find ways to export different injections's data into one file.

      Define_DPM_output seems available to do this work.

      Now I have dozens of injections. how to specify the code to an injection like inj-100-single?

      I only found the UDF in DPM model. where I can make the pointer in the code point to the injection I want? like tp pointing to the particles from inj-100-single.

      plane here is for 2d case. Mine is 3d, so it is null.

      is the output file name melting_output?

      Thank you.

      Lei

    • ll00023
      Subscriber

      I found where to set the output file. But I still didn't find how to specify certain injection to update scalar.

    • ll00023
      Subscriber

      Previously when I encounter the malloc() error, I assume the code update all the particles in the system about 40 million. so I tried to just update a very small number, like 10 particles from certain injection.

    • ll00023
      Subscriber

      after I hooked up this udf in a 2d test case, I run the summary, then I got this error.

    • ll00023
      Subscriber

      after hook up Define_init, errors number decreasing

    • ll00023
      Subscriber

       

      test initial section:

      #include "udf.h"
      DEFINE_INIT(melt_setup,domain)
      {
          /* if memory for the particle variable titles has not been
          * allocated yet, do it now */
          if (NULLP(user_particle_vars)) Init_User_Particle_Vars();
          /* now set the name and label */
          strcpy(user_particle_vars[0].name,"melting-index");
          strcpy(user_particle_vars[0].label,"Melting Index");
          strcpy(user_particle_vars[1].name,"melting-index-0");
          strcpy(user_particle_vars[1].label,"Melting Index 0");
      }

      No error.

      add Define_DPM_scapar_update, 

      /* update the user scalar variables */
      DEFINE_DPM_SCALAR_UPDATE(melting_index,cell,thread,initialize,tp)
      {
          cphase_state_t *c = &(tp->cphase[0]);
          if (initialize)
          {
          /* this is the initialization call, set:
          * TP_USER_REAL(tp,0) contains the melting index, initialize to 0
          * TP_USER_REAL(tp,1) contains the viscosity at the start of a time step*/
          TP_USER_REAL(tp,0) = 0.;
          TP_USER_REAL(tp,1) = c->mu;
          }
          else
          {
          /* use a trapezoidal rule to integrate the melting index */
          TP_USER_REAL(tp,0) += TP_DT(tp) * .5 * (1/TP_USER_REAL(tp,1) + 1/c->mu);
          /* save current fluid viscosity for start of next step */
          TP_USER_REAL(tp,1) = c->mu;
          }
      }

      switch RANS to URANS since this code is for 2D transient case. then 

      Then I got this error.

       

Viewing 5 reply threads
  • The topic ‘write particle date in a output file by using example 2.5.10.3 in UDF manual’ is closed to new replies.