Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

DPM-UDF for absorptive process

    • anthonybasuni.hamzah
      Subscriber

      Hi all,
      I have been working on the modelling of ammonia absorption using water spray. For this purpose, the DPM simulation is used. To implement the mass-heat transfer terms, the transfer equations are hard-coded in a UDF.
      An illustration of the computational domain is given in the schematic diagram below: 

      Note that the gas is mixture of ammonia diluted in air. Additionally, below is the UDF code I wrote to implement the ammonia gas absorption, which includes the mass transfer of ammonia gas from bulk to droplet, as well as the heat transfer.

      #include "udf.h"
      /* UDF for ammonia absorption into water droplets */
      DEFINE_DPM_HEAT_MASS(ammonia_absorption, tp, Cp, hgas, hvap, cvap_surf, Z, dydt, dzdt)
      {
          int ns;
          Material *sp;
          int nc = TP_N_COMPONENTS(tp);              /* Number of particle components */
          Thread *t0 = TP_CELL_THREAD(tp);            /* Thread where the particle is located */
          Material *gas_mix = THREAD_MATERIAL(DPM_THREAD(t0, tp)); /* Gas mixture material */
          Material *cond_mix = TP_MATERIAL(tp);       /* Particle mixture material */
          cphase_state_t *c = &(tp->cphase[0]);         /* Cell information at particle location */
          real molwt[MAX_SPE_EQNS];                 /* Molecular weights of gas species */
          real Tp = TP_T(tp);                         /* Particle temperature */
          real mp = TP_MASS(tp);                      /* Particle mass */
          real molwt_bulk = 0.;                     /* Avg molecular weight in bulk gas */
          real Dp = DPM_DIAM_FROM_VOL(mp / TP_RHO(tp)); /* Particle diameter */
          real Ap = DPM_AREA(Dp);                   /* Particle surface area */
       
          /* Standard heat transfer calculation */
          real Pr = c->sHeat * c->mu / c->tCond;    /* Prandtl number */
          real Nu = 2.0 + 0.6 * sqrt(tp->Re) * pow(Pr, 1./3.); /* Nusselt number */
          real h = Nu * c->tCond / Dp;              /* Heat transfer coefficient */
          real dh_dt = h * (c->temp - Tp) * Ap;     /* Heat source term */
       
          dydt[0] += dh_dt / (mp * Cp);             /* Update particle temperature source */
          dzdt->energy -= dh_dt;                    /* Update gas phase enthalpy source */
       
          /* Calculate average molecular weight of the bulk gas */
          mixture_species_loop(gas_mix, sp, ns)
          {
              molwt[ns] = MATERIAL_PROP(sp, PROP_mwi);
              molwt_bulk += c->yi[ns] / molwt[ns];
          }
          molwt_bulk = MAX(molwt_bulk, DPM_SMALL);
          /* Loop through particle components to handle mass transfer */
          for (ns = 0; ns < nc; ns++)
          {
              int gas_index = TP_COMPONENT_INDEX_I(tp, ns); /* Index of vaporizing/absorbing species */
              if (gas_index >= 0)
              {
                  Material *cond_c = MIXTURE_COMPONENT(cond_mix, ns);
                  real D = MATERIAL_PROP_POLYNOMIAL(cond_c, PROP_binary_diffusivity, c->temp);  /* Diffusion coefficient (polynomial of gas temperature) */
                  real Sc = c->mu / (c->rho * D);   /* Schmidt number */
                  /* Mass transfer coefficient */
                  real k_m = (2. + 0.6 * sqrt(tp->Re) * pow(Sc, 1./3.)) * D / Dp;
                  
                  /* Bulk gas concentration (Ideal Gas Law) */
                  real cvap_bulk = c->pressure / UNIVERSAL_GAS_CONSTANT / c->temp * c->yi[gas_index] / molwt_bulk;
                  /* The absorption/vaporization rate calculation: If cvap_bulk > cvap_surf[ns], the rate is negative (absorption) Note: cvap_surf[ns] is provided by Fluent based on equilibrium data */
                  real abs_rate = k_m * molwt[gas_index] * Ap * (cvap_surf[ns] - cvap_bulk);
                  /* saving bulk concentration of ammonia, TO BE CHECKED */
                  C_UDMI(c, t0, 0) = abs_rate;
                  /* Update particle and gas mass source terms */
                  dydt[1 + ns] -= abs_rate;         /* Change in particle component mass */
                  dzdt->species[gas_index] += abs_rate;   /* Change in gas species mass */
              }
      }
      }

      The problem I am facing right now is that when I checked the rate of ammonia gas absorption into the droplets (using Particle Track > Discrete Phase Sources > DPM NH3 source), the profile shows zero value (see screenshot below), which implies the absorption using the UDF above doesn't work. Appreciate if someone could help me with this matter.


    • Rob
      Forum Moderator

      Staff are unable to check/debug code, nor cover much on UDFs other than point at the documentation. Other Forum posters are not restricted in the same way.

      So, what I can do is ask questions. 

      I assume you have a mixture for gas phase and multicomponent droplets? Does this need to be fully transient, or can you run steady flow with transient droplets? The latter can be more computationally efficient. In the DPM plot you're showing a fluid phase value on the droplets, why not plot that on a contour and plot ammonia concentration on the droplets? 

    • anthonybasuni.hamzah
      Subscriber
      Yes, it's bulk gas - multicomponent droplets, and the simulation should be of the latter (steady gas flow, transient droplet).
      On the ammonia concentration value, the aim is to show ammonia concentration that should be absorbed into the droplets, thus the fluid phase value instead of the concentration on droplet surface.
       
      Hope that clarifies.
    • Rob
      Forum Moderator

      If it's been absorbed check what options there are in Particle Variables, below from a dummy case here. 

    • anthonybasuni.hamzah
      Subscriber

       

      The mass fraction profile is oddly zero. Does this mean absorption does not occur? Assuming the absorption does occur, does another option below the Mass Fraction of H2O (let’s say something like Mass Fraction of ammonia) appear? Note that such option doesn't appear in the drop down.

       

    • Rob
      Forum Moderator

      What is the DPM material composition?

    • anthonybasuni.hamzah
      Subscriber

      The particle mixture is only water. In this case, shall this mixture consist of only water or water-ammonia (or aqueous ammonia)? And if the latter is necessary, how is this implemented (e.g., how to create the 'ammonia' in the Available Materials column)?

    • Rob
      Forum Moderator

      If the droplet is only water where would the ammonia go? 

Viewing 7 reply threads
  • You must be logged in to reply to this topic.
[bingo_chatbox]