Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

How to get the specific heat of a species in a mixture using UDF?

TAGGED: 

    • hefeinanzhan
      Subscriber

      How to obtain the specific heat of the volatile component itself in the mixture within DEFINE_DPM_SOURCE (name, c, t, S, strength, tp)?

    • Rob
      Forum Moderator

      Most of the materials are set as you've found and then used in a mixed form in the cells. The various cell values can be found in the documentation. 

    • Mark O
      Ansys Employee

      There is no documented access to the material property routines. The simplest thing is to change the specific heat property to a user defined property that calls a function to evaluate the specific heat as a function of temperature. Then you can call the same function anywhere else in the code where you need it.

    • hefeinanzhan
      Subscriber

      In the process of writing a source term UDF for volatile particles and the continuous phase, I encountered this issue. Currently, the mass source term is completely consistent with Fluent's default calculation, but there's always some discrepancy in the energy source term. When calculating the energy source term, does the variable C_pg in Equation 12.510 represent the specific heat capacity of the volatiles?

    • hefeinanzhan
      Subscriber
      In the test case, I set the specific heat of the volatiles to 2500. Below are the output results and my UDF source code:
      DEFINE_DPM_SOURCE(dpm_source, c, t, S, strength, tp)
      {
          if (TP_CURRENT_LAW(tp) == DPM_LAW_DEVOLATILIZATION)
          {
              if (tp->part_id == 0)
              {
                  real cp_g = 2400;

                  real H_lat_ref = strength * (TP_MASS0(tp) - TP_MASS(tp)) * (cp_g * (T_REF - TP_INIT_TEMP(tp)) - tp->Cp * (T_REF - TP_INIT_TEMP(tp)));

                  real Q_in = TP_MASS0(tp) * (TP_T0(tp) - T_REF) * tp->Cp;
                  real Q_out = TP_MASS(tp) * (TP_T(tp) - T_REF) * tp->Cp;
                  real Q = strength * (Q_in - Q_out);
                  real Q_cal = Q - H_lat_ref;
                  real M_cal = (TP_MASS0(tp) - TP_MASS(tp)) * strength;

                  printf("Fluent: energy = %.24e, mass = %.24e\n", S->energy, S->species[0]);
                  printf("My UDF: energy = %.24e, mass = %.24e\n", Q_cal, M_cal);
                  printf("======================================================\n");
                  fflush(stdout);
              }
          }
      }
Viewing 4 reply threads
  • You must be logged in to reply to this topic.