Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

About DPM UDF Parallelisation

    • Saxon_HUI
      Subscriber

      I have compiled a UDF of particle combustion, which describes the heat and mass transfer laws of particles after entering a high temperature environment. According to the needs of calculation, I need to obtain the fluid parameters in the cell where the particles are located, such as calculating the Prandtl number. When I need to obtain physical parameters such as dynamic viscosity and specific heat of the fluid in the cell where the particles are located, I assign the calculated values to TP_USER_REAL according to the UDF help manual. There is no problem in the serial calculation of the program. When I start the parallel calculation(6 nodes), the calculated Prandtl number curve will be discontinuous. I observed that the number of discontinuous "cusps" is equal to the node numbers of the parallel operation I opened.

      I would be very grateful if anyone could provide any advice and help!

    • Saxon_HUI
      Subscriber
      I am attaching part of the code below:
      DEFINE_DPM_SCALAR_UPDATE(dTdt_update, cell, thread, initialize, tp)
      {
      cphase_state_t *c = &(tp->cphase[0]);
      ......
      TP_USER_REAL(tp,42) = c->sHeat * c->mu / c->tCond;
      ......
      }
      And on the DPM model template, I chose the parallelized computation method of message passing


    • Rob
      Forum Moderator
      Have a look in the UDF manual for the parallel chapter. There are a number of macros that get called on host/node and this can result in cells being checked or calculated twice (or more) as they're on a partition boundary.
    • Saxon_HUI
      Subscriber
      @RobYes, I've checked the relevant section of the UDF manual on DPM parallel computing and it says "In the case of parallel simulations, you must use user variables specific to particles, as they can be accessed via macros TP_USER_REAL(tp, i) (tp is the type of Tracked_Particle *) and PP_USER_REAL( p, i) (p is the type of particle *). Only this information is in partition boundaries, while other local or global variables will not cross partition boundaries." , I have used TP_USER_REAL(tp, i) to save my calculations according to the instructions, but the fluent parallel calculation does not return a "continuous" result for me.
    • Rob
      Forum Moderator
      What cell zone functions are you using?
    • Saxon_HUI
      Subscriber
      @RobSorry, I didn't quite understand what you meant. What do you mean by "cell zone functions"? I have attached my part of the code above. I just want to calculate the Prandtl number of the fluid in the cell where the particle is located: TP_USER_REAL(tp,42) = c->sHeat * c->mu / c->tCond; further I can obtain the convective heat transfer coefficient h to calculate the convective heat transfer of the fluid to the particle.Thank you sincerely for your positive response and help´╝ü


    • Rob
      Forum Moderator
      Are you using any cell loops etc?
    • Saxon_HUI
      Subscriber
      I did't use any cell loops in my UDF code.
    • Rob
      Forum Moderator
      Try hybrid, I'm sure there was a flag on an old case that suggested Message Passing memory was being retired.
    • Saxon_HUI
      Subscriber
      Thank you very much for your reply! I have tried message passing,shared memory and a hybrid approach and the calculations show that memory sharing gives me the right result in parallelising DPM, at least it doesn't have discontinuous "spikes" at the moment.
    • Amine Ben Hadj Ali
      Ansys Employee
      Sorry but what you are doing is not completely correct. If you want to get the Prandtl Number in the cell your particle is actually located you need to access that cell and there you can store the Prandtl Number in a cell memory. What you are doing now you are doing it first right but then you store value as particle user variable.

      I assume now that the Prandtl Number of the continuous phase has nothing to do with the DPM particles I won't rely on any DPM Macros here. So you can then via DEFINE_ADJUT calculate Pr for every cell store it in memory and then if you require that value for DPM customization you just need to get into the cell index and cell thread the particle is currently located in it.
    • Saxon_HUI
      Subscriber
      Thank you very much for your valuable advice, I will try to use this approach in my subsequent work. But I still have a question, what is wrong with storing the parameters (e.g. Prandtl number) calculated from the cell in the particle scalar (TP_USER_REAL(tp,i))? Or even any serious error problems that can occur? At least in my current work, the results obtained by fluent calculations are respectable. I hope to get your reply, and thanks again sincerely!
Viewing 11 reply threads
  • The topic ‘About DPM UDF Parallelisation’ is closed to new replies.