Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

Reaction rate for a particular domain

    • Young Duk Lee
      Subscriber

      Hi everyone!

      I am simulating decomposition of Ammonia in a channel. i have 3 zones, all fluid and I want to select a particular zone where the reaction takes place. 

      second, I want to define the reaction rate as temperature dependent. how can I get the temperature of that cell where the UDF is being calculated.

       

      Thankyou. 

       

      My code is as follows:

      #include "udf.h"
      #define A 4e15
      #define E 196200.0
       
      DEFINE_VR_RATE(my_rate, c, t, r, mole_weight, species_mf, rate, rr_t)
      {
      real s1 = species_mf[1];
      real mw1 = mole_weight[1];
      if (FLUID_THREAD_P(t)&&ZONE_ID(5))
      *rate = A * exp(-E / 8.31412 / 1000) * s1/100000;
      else
      *rate = 0;
      *rr_t = *rate;
      }

       

       

    • Atharva Nagarkar
      Subscriber

      Hello,

      You can select a particular zone id by assigning the pointer to point at the corresponding zone using the Lookup_Thread macro. You will need to get the corresponding zone ID. Here is the link from the Ansys UDF Manual regarding the macro. 

      3.2.6. Special Macros (ansys.com) -> Check section 3.2.6.1

      To access the temperature for a cell, you can use the flow variable macro for temperature. The macro is C_T(c,t). Here is the link of the same from the UDF Manual.

      3.2. Data Access Macros (ansys.com) -> Check section 3.2.3.6

      For reference, here is the link of the definition of the macro DEFINE_VR_RATE. Please check out the examples below the theory of the macro for better understanding.

      2.3. Model-Specific DEFINE Macros (ansys.com) -> Check section 2.3.53

      Additionally, I see that you have defined mole weight and assigned it to the variable "mw1". However, you have not used this variable anywhere. You might want to remove unncessary variables from your UDF.

      If you are not able to access the link, please refer to this forum discussion: Using Help with links (ansys.com)

      Thanks!

    • Young Duk Lee
      Subscriber

      Thankyou very much.

    • Young Duk Lee
      Subscriber

      Hi Atharva Nagarkar!

      can you tell me what is the species index if I have total of 6 fluids in the mixture? i want to get the mole fraction of mixture-material no. 5 where total 6 are given. 

      thankyou

    • Atharva Nagarkar
      Subscriber

       

      Hello,

      Please refer to the 3rd link I shared above and the corresponding section.

      Here, “mw” or in your case “mole_weight” is the pointer to array of species molecular weights. You can simply access the species by using the correct index of the species inside the array. This array is directly passed by Fluent solver to the UDF so all you need is the order in which the specie are defined in Fluent. Accordingly, you can specify the correct index for the species you want.

      Thanks!

       

    • Young Duk Lee
      Subscriber

      thanks alot for your reply.

      i couldnt find the index numbering starts at 0 or 1. so in my case I am giving the reaction rate for ammonia decomposition and ammonia is the fifth material in my list of mixture-materials. 

      so do I give the index 4 (if index numbering starts from 0) or should I give the index 5 (if the numbering starts from 1).

       

      Thankyou.  

       

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