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

Get the mole fraction in UDS and UDF Error "the fl process could not be started"

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 16, 2023, 08:27
Default Get the mole fraction in UDS and UDF Error "the fl process could not be started"
  #1
New Member
 
Xiangkun Liu
Join Date: Apr 2023
Location: Shanghai, China
Posts: 2
Rep Power: 0
kckcc is on a distinguished road
I am working on particle-resolved fixed bed and using the UDS to calculate the reaction species in catalysts(represented as solid phase in Fluent), so I need to calculate the diffusion coefficient of species using the macro DEFINE_DIFFUSIVIT(name,c,t,i) and the formula in the attached picture.

I set uds to work in all zones ,so I wrote the codes for the diffusion coefficients in the solid phase and in the liquid phase separately, where the code for the liquid phase is a simplification of the code for the solid phase, you can see the code for the solid phase here.

#Codes
#include "udf.h"
/*[O2,CO2,C2H4,C2H4O,H2O,N2]*/
real M[6]={32,44.01,28.06,44.052,18.015,28.013};/*these are the relative molecular mass of the species i */
real V[6]={16.6,26.9,41.04,28.85,12.7,17.9};/* these are the sum of the atomic diffusion volumes for species i*/
#define species 6
#define R 8.314
#define d_pore 20e-9
#define epslon 0.4
#define tao 2

DEFINE_DIFFUSIVITY(uds_diff_solid,c,t,i)/*to calculate the diffusivity of the species i in the solid phase*/
{
real temp=C_T(c,t);/*get temp in the solid phase*/
real press=C_P(c,t);/*get tpressure in the solid phase*/
real density=C_R(c,t);/*get density in the solid phase*/
real D1=0.;/*calculate the binary diffusion corffcient*/
real Df=0.;/*calculate the molecular diffusivity*/
real Ds=0.;/*to get the the effective diffusivity of the ith species in the solid phase*/
real Dk=0.;/*calculate the Knudsen diffusivity of the species i*/
real Mm=0.;
real Mm_total=0.;
real mole_fraction[6];
int x=i;
int y;
for(y=0;y<species;++y)
{
Mm = Mm + C_UDSI(c,t,y)/M[y];/*use C_UDSI(c,t,i) to get the mass fraction of ith species in solid phase*/
}
Mm_total =1/Mm; /*calculate the average relative molecular mass*/
for(y=0;y<species;++y)
{
mole_fraction[y]=C_UDSI(c,t,y)/(M[y]/Mm_total);
}/*get the mole fraction of ith species in solid phase*/

for (y=0;y<species;++y)
{
if(y!=x)
{
D1=D1+(mole_fraction[y]/(1e-3*pow(temp,1.75)*pow((1/M[x]+1/M[y]),0.5))/(press*pow((pow(V[x],1/3)+pow(V[y],1/3)),2)));
}
}

Df=(1-mole_fraction[x])/D1;/*get the molecular diffusivity, if I need the diffusity of ith species in fluid phase, I will return Df*density */
Dk=48.5*d_pore*pow((temp/M[x]),0.5);/*get the Knudsen diffusivity of the species i*/
Ds=epslon/tao*pow((1/Df+1/Dk),-1);/*get the the effective diffusivity of the ith species in the solid phase*/
return Ds*density;/*the uds needs diffusivity*density, so I return this*/

}

Problems
1. All UDF have been able to compling and load them sucessfully. However, on trying to run the simulation after incorporating those UDF, I am constantly facing an error "The fl process could not be started".
2. I can only get the mass fraction of the ith species by the uds in Fluent, but I have to use the mole fraction to calculate the diffusivity, so I use the method in the attached picture, is there a better solution?
3. As you can see, I have to calculate the mole fraction every time when I want to get the diffusivity of all species , is there a better solution?

I am unable to figure out the exact problem, and would highly appreciate any sort of help. Thanks in advance.
Attached Images
File Type: jpg diffusivity.jpg (38.0 KB, 12 views)
Attached Files
File Type: c code.c (2.1 KB, 3 views)
kckcc is offline   Reply With Quote

Old   May 23, 2023, 09:49
Default
  #2
New Member
 
Xiangkun Liu
Join Date: Apr 2023
Location: Shanghai, China
Posts: 2
Rep Power: 0
kckcc is on a distinguished road
I have solved the above problem, just modify D1 in the code as follows:
D1 = (1e-3*pow(temp,1.75)*pow((1/M[x]+1/M[y]),0.5))/(press*pow((pow(V[x],1/3)+pow(V[y],1/3)),2));
D2 = mole_fraction[y]/D1;
D3 = D3+D2;


But I have encountered a new problem now.

Solid zones don't provide a pressure term, so I set the pressure constant, it can be calculated.

In the fluid zones I need the actual pressure to calculate, so I set pressure=C_P(c,t), but this causes divergence.
kckcc is offline   Reply With Quote

Reply

Tags
mole fraction, udf error, uds diffusivity

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
UDF for specifying species mass fraction gradient at boundary Zaphod'sSecondHead Fluent UDF and Scheme Programming 1 March 14, 2020 06:12
udf for source term in UDS equation dkjknobel Fluent UDF and Scheme Programming 12 August 19, 2019 07:57
Setting up a UDF to monitor UDS mass fraction dinknflicka Fluent UDF and Scheme Programming 1 January 15, 2019 20:17
unsteady udf for concentration uds borhan_sd@yahoo.com Fluent UDF and Scheme Programming 0 July 15, 2013 03:32
Associating profile files for the UDS though a UDF Bharath FLUENT 0 December 1, 2006 15:58


All times are GMT -4. The time now is 18:32.