CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Soot absorption coefficient in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 9, 2012, 14:48
Smile Soot absorption coefficient in UDF
  #1
lei
New Member
 
Lei Chen
Join Date: Mar 2010
Posts: 21
Rep Power: 16
lei is on a distinguished road
Hi everyone,

I used the UDF macro DEFINE_PROPERTY(name, c,t) to model the absorption coefficient (Alpha) for gas and soot, the absorption coefficient is a function of gas composition and temperature, and the soot's contribution is calculated using the correlation:

Alpha(soot) = 1232.4*C_R(c,t)*C_POLLUT(c,t,4)*(1.0+0.00048*(T-2000.0));

Then the total Absorption coefficent = Alpha(gas)+Alpha(soot);

The UDF works well for the gas absorption coefficient calculation, however, when I use the variable for soot's mass fraction "C_POLLUT(c,t,4)", this variable gives all zero value in the domain, and thus the soot's effect on absorption coefficient cannot be added into the total absorption coefficient.

I checked the soot mass fraction, and it can be seen reasonably in post-processing.

Some information for my case:
*version: FLUENT 12.1.4
*Problem: propane combustion using a UDF for radiation property
*Model used: SST k-omega, DO, user defined WSGG model, EDC, one-step soot formation model

Thank you for your comments and helps!
lei is offline   Reply With Quote

Old   March 16, 2013, 08:33
Default
  #2
lei
New Member
 
Lei Chen
Join Date: Mar 2010
Posts: 21
Rep Power: 16
lei is on a distinguished road
In case you encounter the same problem. This problem has been solved with helps from a great FLUENT engineer. Use variable C_POLLUT(c,t,IT_SOOT_START) instead, which is the soot mass fraction in (kg/kg).
lei is offline   Reply With Quote

Old   May 21, 2019, 03:49
Default
  #3
New Member
 
Junjun Guo
Join Date: May 2019
Posts: 12
Rep Power: 6
Junjun Guo is on a distinguished road
Quote:
Originally Posted by lei View Post
In case you encounter the same problem. This problem has been solved with helps from a great FLUENT engineer. Use variable C_POLLUT(c,t,IT_SOOT_START) instead, which is the soot mass fraction in (kg/kg).
Hi lei,

I try the C_POLLUT(c,t,IT_SOOT_START), but it still doesn't work!
No matter I use C_POLLUT(c,t,4) or C_POLLUT(c,t,IT_SOOT_START), the Fluet can't run with a error "Process 48890: Received signal SIGSEGV". Once I delete the C_POLLUT, UDF works well. I also have added the #include "sg_mem.h"
Junjun Guo is offline   Reply With Quote

Old   May 22, 2019, 05:56
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Ansys fluent customization manual
look for Example: Soot Mass Rate

seems like you need memory check like:
Code:
if(NNULLP(t)) /*This check is must*/
{
soot_yi = C_POLLUT(c,t,EQ_SOOT);
nuc = C_POLLUT(c,t,EQ_NUCLEI);
}
best regard
AlexanderZ is offline   Reply With Quote

Old   May 22, 2019, 07:12
Default
  #5
New Member
 
Junjun Guo
Join Date: May 2019
Posts: 12
Rep Power: 6
Junjun Guo is on a distinguished road
Thank you Alexander! I try it, but it is the same. There is no problem with UDF compilation. Once calculated, an error is reported.
Here is my udf:
Code:
#include "udf.h"
#include "sg_mem.h"
#include "sg_pollut.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <pdf_props.h>

/*Calculation for absorption coefficient */
DEFINE_GRAY_BAND_ABS_COEFF(Smith_gray_band_abs,c,t,nb)
        {
                real abs_coeff = 0.00001;
                real CO2_molf           ;
                real H2O_molf           ;
                real xi[100],yi[100]    ;
                real soot_yi=1.0E-06     ;
                real rho=C_R(c,t)        ;
                real Tcell=C_T(c,t)      ;
                real KT[4]               ; /* absorption coefficient for each gray gas*/
                real kT[4]               ;
                real b1=1230.0           ;
                real bT=4.8E-04          ;
                int  j,num=3             ; /* number of gray gases (4)  */

                real Kji[2][3] =       /* polynomial coefficients */
                {
                        { 0.4303, 7.055, 178.1 },
                        { 0.4201, 6.516, 131.9 }
                } ;

                if (NNULLP(t))
                  {
                    soot_yi=C_POLLUT(c,t,EQ_SOOT);
                  }
                Pdf_XY(c,t,xi,yi) ;
                CO2_molf=xi[10]   ;
                H2O_molf=xi[5]    ;
                /* Find absorption coefficient for each region */
                for (j = 0 ; j < num ; j++ )
                 {
                        KT[j]=Kji[1][j];
                        kT[j]=(CO2_molf+H2O_molf)*KT[j] + b1*rho*soot_yi*(1.0+bT*(Tcell-2000.0));
                 }

                KT[3] = 0.000001;
                kT[3] = KT[3]+b1*rho*soot_yi*(1.0+bT*(Tcell-2000.0));

                switch (nb)
                        {
                                case 0 : abs_coeff = kT[0]; break;
                                case 1 : abs_coeff = kT[1]; break;
                                case 2 : abs_coeff = kT[2]; break;
                                case 3 : abs_coeff = kT[3]; break;
                        }
                return abs_coeff;
        }
Junjun Guo is offline   Reply With Quote

Old   May 23, 2019, 00:50
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Frankly speaking I don't know what to suggest
try
Code:
soot_yi = C_POLLUT(c,t,12);
also, you may try do use UDMI to plot C_POLLUT(c,t,12)

Code:
C_UDMI(c,t,0) = C_POLLUT(c,t,12);
don't forget to allocate memory for udmi in Fluent GUI

best regards
AlexanderZ is offline   Reply With Quote

Old   May 23, 2019, 01:53
Default
  #7
New Member
 
Junjun Guo
Join Date: May 2019
Posts: 12
Rep Power: 6
Junjun Guo is on a distinguished road
Still face the same error. But if I enbale the NOx model, I can use C_POLLUT(c,t,0) to get the mass fraction of NO.
By th way, Why is 12 in C_POLLUT?
Junjun Guo is offline   Reply With Quote

Old   May 23, 2019, 04:11
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
file sg_pollut.h
inside you have following
Code:
/* Scalar equations solved for pollutants */
typedef enum {
    EQ_NO = 0,
    EQ_HCN,
    EQ_NH3,
    EQ_N2O,
    EQ_UREA,
    EQ_HNCO,
    EQ_NCO,
    EQ_SO2,
    EQ_H2S,
    EQ_SO3,
    EQ_SH,
    EQ_SO,
    EQ_SOOT,
    EQ_NUCLEI, /*This ID:13 has been used in rfcell.scm to identify this eq-name. In case of modification, make sure to update the scheme file also*/
    EQ_CTAR,
    EQ_HG,
    EQ_HGCL2,
    EQ_HCL,
    EQ_HGO,
    EQ_CL,
    EQ_CL2,
    EQ_HGCL,
    EQ_HOCL
} EQ_Pollut;
where EQ_SOOT has number 12

as I undestand, it is possible to use scheme command to get this value
Code:
(rpgetvar 'pollut_soot/eq_start)
may be it is mandatory to use one of the following macros to get soot values:
DEFINE_SOOT_MASS_RATES
DEFINE_SOOT_OXIDATION_RATE
or some special model should be switched on in Fluent GUI. I have no experience about it.
Post the answer, when you'll find solution.

best regards
AlexanderZ is offline   Reply With Quote

Old   May 23, 2019, 04:44
Default
  #9
New Member
 
Junjun Guo
Join Date: May 2019
Posts: 12
Rep Power: 6
Junjun Guo is on a distinguished road
Thank you!

After I change the soot model from MOM to two-steps, the C_POLLUT works.
Junjun Guo is offline   Reply With Quote

Reply

Tags
udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't set absorption coefficient for inert particle lauripar FLUENT 1 May 9, 2012 15:09
error message cuteapathy CFX 14 March 20, 2012 06:45
Constant velocity of the material Sas CFX 15 July 13, 2010 08:56
Automotive test case vinz OpenFOAM Running, Solving & CFD 98 October 27, 2008 08:43
Absorption Coefficient Mark FLUENT 2 March 31, 2004 12:55


All times are GMT -4. The time now is 22:03.