-
-
May 24, 2020 at 4:14 am
anshs
SubscriberI am modeling a species mass transfer model, in which I want to transfer a species from one phase to another phase. I am trying to express this process with the last term of the equation given below. [ m_dot(p_j,q_i) = mass transfer of 'species j from p phase' to 'species i of q phase' ]
Can anyone please help me with a very basic example of which UDF macro to use and how may I assign the phases and the species? -
May 25, 2020 at 9:29 am
Amine Ben Hadj Ali
Ansys EmployeeI cannot share an example but the Ansys help should be useful here. Have a look into the DEFINE_LINEARIZED_MASS_TRANSFER or even the non linear one.
-
May 25, 2020 at 2:33 pm
anshs
SubscriberCan you just tell me how to start? Is define_linearized_mass_transfer the same as adding source term to the species equation?
In the past I have written a code for heterogeneous reaction:
DEFINE_HET_RXN_RATE(user_evap_condens_react, c, t, hr, mw, yi, rr, rr_t)
{
Thread **pt = THREAD_SUB_THREADS(t);
Thread *tp = pt[0];
Thread *ts = pt[1];
int i;
//Message("nn Area3 = %fn", C_UDMI(c,t,1));
double D = 1.;
double delCo2 = 1.;
*rr_t = ((D*delCo2*C_UDMI(c,t,1) )/ C_VOLUME(c,t)); // *(C_YI_G(c,ts,i)[2]+C_YI_G(c,ts,i)[0])
Message("n 2n");
} -
May 25, 2020 at 2:39 pm
Amine Ben Hadj Ali
Ansys EmployeeI am sorry but I cannot help here: we do not debug UDF's. In this case the mass transfer is described via the Heterogeneous Reaction Rate macro so you need to prepare that in GUI too.Â
Is your mass transfer a simple degassing or evaporation or require a complicated formulation like the case for reaction: one can still model evaporation as chemical heterogeneous reaction but same can be done via the macro I mentioned in the first post.
-
May 25, 2020 at 3:37 pm
anshs
SubscriberOkay but can you just help me, in including a rate expression in my udf , the rate expression is as giwen below:
I know the terms of this expression as: C_D(c,t) (turb. kinetic energy dissipation rate) , C_MU_T(c,t) (turbulent viscosity) , DEFINE_DIFFUSIVITY ( D, c, t, i)
but how to include these in the reaction rate?Â
Â
*rr_t = (0.4*(sqrt(D))*(C_D(c,t) / C_MU_T(c,t)).^0.25 )*((D*delCo2*C_UDMI(c,t,1) )/ C_VOLUME(c,t));Â
Am I right? or do I need to do anything else as well?
Â
-
May 28, 2020 at 8:49 am
anshs
SubscriberAny help with this?Â
Thanks -
May 28, 2020 at 10:05 am
anshs
SubscriberThis is the udf which is present there in the example case of mass transfer:
#include "udf.h"
Â
DEFINE_MASS_TRANSFER(liq_gas_source, cell, thread, from_index,
from_species_index, to_index, to_species_index)
{
  real m_lg;
  real T_SAT = 373.15;
  Thread *gas = THREAD_SUB_THREAD(thread, from_index);   // gas phase
  Thread *liq = THREAD_SUB_THREAD(thread, to_index);      // liquid phase
Â
  m_lg = 0.;      // initialisationÂ
 Â
Â
  if (C_T(cell, liq) >= T_SAT).     // liq: pointer thread of liquid phase
  {
    m_lg = -0.1*C_VOF(cell,liq)*C_R(cell,liq)*
        fabs(C_T(cell,liq)-T_SAT)/T_SAT;
   }
  if ((m_lg == 0. ) && (C_T(cell, gas) <= T_SAT))
   {
    m_lg = 0.1*C_VOF(cell,gas)*C_R(cell,gas)*
     fabs(T_SAT-C_T(cell,gas))/T_SAT;
   }
Â
  return (m_lg);
Â
But it does not have any species inclusion, like: 'from_species_index' and 'to_species_index'. How to include this in the above example case, is it like this?
Thread *gas_i = THREAD_SUB_THREAD(thread, from_species_index);Â Â
Thread *liq_j  = THREAD_SUB_THREAD(thread, to_species_index);Â
if ((m_lg == 0. ) && (C_T(cell, gas) <= T_SAT))
   {
    m_lg = 0.1* C_VOF(cell,gas) * C_R(cell,gas) * C_YI(c , gas , gas_i) // 0.1*(Volume of gas cell)*(Density gas of cell)*(Species fraction of i in gas phase)
   }
  return (m_lg);
Â
-
May 28, 2020 at 12:51 pm
Amine Ben Hadj Ali
Ansys EmployeeWe do not provide UDF support.Â
The phase threads are just as in the example in the documentation. The species index are only placeholder so that Fluent knows from which component to which component mass transfer is initiated.Â
To access the diffusivity you should look into the documentation and you will see the right macro which is C_DIFF_EFF.
-
May 28, 2020 at 2:24 pm
anshs
SubscriberSo I need not include these lines,
Thread *gas_i = THREAD_SUB_THREAD(thread, from_species_index);Â Â
Thread *liq_j  = THREAD_SUB_THREAD(thread, to_species_index);
and just writeÂ
from_species_index = 0. (let's say the first species)
to_species_index = 2. (let's say the third species)
  -> m_lg = 0.1* C_VOF(cell,gas) * C_R(cell,gas) * C_YI(c , gas , 0)  ;
here C_YI(c, gas, 0 ), denotes species mass fraction of 1st species in the mixture denoted by phase 'gas'.
Is the above correct?
-
- The topic ‘Species transport equation source term udf’ is closed to new replies.
-
3832
-
1414
-
1193
-
1100
-
1015
© 2025 Copyright ANSYS, Inc. All rights reserved.