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

VR_RATE PROBELM.......no variation in concentration happening ?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 17, 2018, 06:20
Default VR_RATE PROBELM.......no variation in concentration happening ?
  #1
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 8
sooraj546 is on a distinguished road
I am using VR_RATE UDF for simulating a set of reactions as shown below. (transient_problem)

3Fe2O3 + CO = 2Fe3O4 + CO2
Fe3O4 + CO = 3FeO + CO2
Fe3O4 + CO = Fe + CO2
CO2 + C = 2CO carbon gasification (HIGHLY ENDOTHERMIC)

All the species with properties are defined etc and these reactions are defined in the mixture template with default pre-exp factor and activation energy. VR rate is hooked into the volumetric rate function hook then the geometry is patched with initial concentration of Fe2O3, C and CO2.

PROBLEM FACED

1. I am getting the variation in conc for only those species which i have patched with some initial values, even if first reaction is happening some conc of Fe3O4 should be developed right but in my case none is happening ? ( in reality first the Fe2O3 react to form Fe3O4 then this formed Fe3O4 further react to form FeO similarly to Fe all these reaction happens by the intermediate generation of CO by carbon gasification reaction i.e. CO is produced continuously )

I have already solved this problem by coding and i am attaching the result how it should come fig 1 etc and what i am getting now fig 2

#include "udf.h"


DEFINE_VR_RATE(volumetric_rate,c,t,r,mw,yi,rr,rr_t )
{
real Yfe2o3 ,Yfe3o4, Yfeo, Yfe, Yc;/* variable declaration */
real Xfe2o3 ,Xfe3o4, Xfeo, Xfe, Xc;/* variable declaration */
real r1,r2,r3,r4;

real temp= C_T(c,t);

Yfe2o3=C_YI(c, t, 0);/*mass fraction*/
Yfe3o4=C_YI(c, t, 1);
Yfeo=C_YI(c, t, 2);
Yfe=C_YI(c, t, 3);
Yc=C_YI(c, t, 6);


Xfe2o3=Yfe2o3*C_R(c, t);/*( kg/m3 )*/
Xfe3o4=Yfe3o4*C_R(c, t);
Xfeo=Yfeo*C_R(c, t);
Xfe=Yfe*C_R(c, t);
Xc=Yc*C_R(c, t);

if (!strcmp(r->name, "reaction-1"))

{
r1= -(((28.432*pow(10,17))*exp(-607*1000/(8.314*temp))*Xfe2o3));/* kg/m3-sec*/

*rr=r1;
}

else if (!strcmp(r->name, "reaction-2"))
{
r2= (((2/3)*(28.432*pow(10,17))*exp(-607*1000/(8.314*temp))*Xfe2o3)-((93.3*pow(10,16))*exp(-602000/(8.314*temp))*Xfe3o4));/* kg/m3-sec*/

*rr=r2;
}
else if (!strcmp(r->name, "reaction-3"))

{
r3= ((3*((93.3*pow(10,16))*exp(-602000/(8.314*temp))*Xfe3o4))-((94.94*pow(10,11))*exp(-427000/(8.314*temp))*Xfeo));/* kg/m3-sec*/

*rr=r3;
}
else if (!strcmp(r->name, "reaction-4"))

{
r4= -((((1/3)*(28.432*pow(10,17))*exp(-607*1000/(8.314*temp))*Xfe2o3)+((93.3*pow(10,16))*exp(-602000/(8.314*temp))*Xfe3o4)+((94.94*pow(10,11))*exp(-427000/(8.314*temp))*Xfeo)));/* kg/m3-sec*/

*rr=r4;
}
}

Is there any problem with my way of solving set of equation through vr_rate udf etc Kindly help me out guys
THANKS A LOT IN ADVANCE
Attached Images
File Type: jpg fig 1.jpg (21.5 KB, 22 views)
File Type: jpg fig 2.jpg (18.8 KB, 17 views)
sooraj546 is offline   Reply With Quote

Old   July 19, 2018, 08:16
Default
  #2
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 11
obscureed is on a distinguished road
Hi Sooraj546,
A few things:

(1) Are you sure about Fe2O3 etc being gaseous species? Maybe this is true, but it seems very strange to me. I would expect all the iron-containing species to be solid. In that case, you probably need to consider the reactions as surface reactions on particles -- this is an option in Fluent, but a significantly different road to the one you're on.

(2) When a publication writes 93.3×10^16, you should use 93.3e16 in a program, not 93.3*pow(10,16). They arrive at the same answer, but 93.3e16 goes straight there. It's a bit like not knowing how decimal points work, so writing 93.3 as (93+3/10). But seeing "3/10" sets off an alarm bell in my mind -- see the next point:

(3) A much more insidious problem is writing (1/3) or (3/10). If your compiler treats these as integers, then integer arithmetic gives the answer zero! In integer arithmetic, the answer is an integer, so fractions are rounded away: for example, (7/3) equals 2. You must force the compiler to treat these as reals by adding a decimal point: (1./3.) equals 0.3333...

(4) Check the Fluent documentation for the units of the rates that you are returning -- I think you will find they are kmol/m3/s. Then also check the units in the reference for your rate equations. If I am correct in my point (1), then you will find that the reference has not actually provided volumetric rate constants.

(5) Check that the rates that you calculate are somewhere close to reasonable, using a calculator or spreadsheet. Try to reach a rate constant "k" with units [1/s], such that (rate of change of X) = k * (concentration of X). Rate and concentration need to have corresponding units, but it doesn't matter which. Then, the timescale of your reaction is (1/k). If you are expecting timescales of a few seconds, but the answer comes back as a few years or a few microseconds, something is wrong with your inputs or your unit conversions. It is *much* easier to discover and fix this outside of the full CFD simulation.

(6) Does your simulation include turbulence? If so, you must return the rate in *rr_t as well as in *rr.

(7) To help other readers, I would not use X as a symbol for mass concentration -- very often, Y is used for mass fraction and X is used for mole fraction. Use C_fe2o3, or even better spell it out as mass_conc_fe2o3 etc.

Good luck!
Ed
obscureed is offline   Reply With Quote

Old   July 19, 2018, 08:48
Default
  #3
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 8
sooraj546 is on a distinguished road
Sir,
1. You are absolutely correct about the Fe2O3, its a solid species but what i have done is considered it as a liquid species and gave it a high viscosity value like 2.25, thus making it an equivalent to solid. I did this because i have to give molecular weight which is only available in liquid species moreover, my properties are mass fraction dependent etc (this type of cases i found already discussed in forum )

2. i will change it to 93.3e16 sir thanks a lot for that suggestion.

3. i will change it to 0.334 sir thanks a lot for that suggestion.

4. this point is very important sir, i thought its (kg/m3sec ) reason http://www.afs.enea.it/fluent/Public.../PDF/chp13.pdf eq 13.1-1 the species transport equation unit of LHS is i.e. d(density*massfraction)/dt so overall unit is kg/m3sec which equivalent to RHS over all rate part Ri........................kindly give me ur thought on this sir.

5. i will check that as well.

6. no sir i haven't included turbulence.

7. i will change that too sir.
sooraj546 is offline   Reply With Quote

Old   July 19, 2018, 15:13
Default
  #4
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 11
obscureed is on a distinguished road
Hi Sooray546,
1. The strategy of giving solid species a high viscosity is not correct. First, you presumably have a mixing law for viscosity, so the solid will not actually behave as solid, and the dependence of multiphase viscosity on solids content may be exaggerated. Second, solid/gas reaction rates are fundamentally different from gaseous homogeneous reactions. (For example, in your formulation, how would you apply a change in particle size, which would be expected to cause a change in reaction rate?) One definite way to decide how to proceed is to check the assumptions associated with the rate laws you are using.

3. I would not advise using "0.334" in place of 1/3 -- "(1./3.)" is fine, "0.333333333" is OK, "0.333" is imprecise, but "0.334" is wrong.

4. The place to look is the documentation of the DEFINE_VR_RATE function.

One small but important piece of etiquette: as someone succinctly put it in a different post, "women can do CFD too". I would advise you to avoid using "sir" unless you have a definite indication that you are addressing a man, and probably not even then. (My name is "Ed", which is a possible but not watertight indication. As it happens, you guessed correct, and I am not at all offended, but the goal should be to avoid barriers to diversity.) You might then ask how to address a woman with the same respect conveyed by "sir". I do not have a good answer to this (and I do not think that "madam" is suitable) except that, in a friendly forum like this, it is not necessary to try, for men, women or others. My points here may be culturally specific, but I feel they are appropriate for an international forum. If you disagree, I would be happy to hear your perspective.

Good luck!
Ed
obscureed is offline   Reply With Quote

Old   July 20, 2018, 01:45
Default
  #5
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 8
sooraj546 is on a distinguished road
thanks a lot for you reply..........i will do according to ur suggestions.

And i am really sorry for addressing you as "SIR" my perspective was not to impair anybodies feeling etc.............sorry for that ed


Once again thanks a lot for you valuable suggestions
sooraj546 is offline   Reply With Quote

Old   July 20, 2018, 16:01
Default
  #6
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 11
obscureed is on a distinguished road
Hi Sooraj546,


Thanks for your reply. The "sir" thing has not impaired my feelings, so don't worry about that -- but it is something to consider in future.



I did not reply to one point you made earlier: You are correct that the basic DPM material does not include an option to specify molecular weight, and so it initially does not seem suitable for reactions. But by the time you have activated the Energy Equation and Species Transport models, and added surface species to an injection, then (as far as I remember) molecular weight is specified for surface species. (If not, reactions can be specified fully in mass terms -- I forget which.) I think a DPM approach is probably what I would recommend as a first try (at least for a fairly low concentration of solids).


Good luck!
Ed
obscureed is offline   Reply With Quote

Old   July 21, 2018, 07:06
Default
  #7
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 8
sooraj546 is on a distinguished road
thanks a lot ed
sooraj546 is offline   Reply With Quote

Old   November 6, 2018, 01:52
Default
  #8
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 8
sooraj546 is on a distinguished road
hello ed,
sooraj546 posted this 11 minutes ago
I am facing a difficulty in selecting which model TO should for this KIND OF PROBLEM etc.......................



Model description



The mixture of iron ore and coal particle make up a composite pellet which is considered as a porous medium. Both solid and gas phases are assumed to be continuum. The pellet shape is assumed to be spherical. these are the reactions which are happening inside the pellet.



3Fe2O3 + CO = 2Fe3O4 + CO2

Fe3O4 + CO = 3FeO + CO2

FeO + CO = Fe + CO2

CO2 + C = 2CO



eq solved include - continuity, mass balance , momentum eq that's all

rate of the first 3 reactions are given by



Ri= Si*ni*(4phi*(r^2))*kio*exp(-Ei/RT)*(Cco-(Cco2/keq))



Ri = Reaction rate Equation (mol/m3.s)

S = Shape factor of particles

r = Average particle radius (m)

ko = pre-exponential constant (m/s)

Ea = Activation Energy (J/mol)

R = Universal Gas constant. (J/ mol.K)

Cco , Cco2 = concentration of Cco , Cco2 (mol/ m3)

n = number of particles of solid reactants for reaction i in the mixture (m^-3) etc



In reality there are 2 different type of solid particle of different sizes are there which interact with gas as surface reactions,

which model should i start with................KINDLY HELP ME OUT
sooraj546 is offline   Reply With Quote

Old   June 13, 2022, 10:57
Default
  #9
New Member
 
qiudejin
Join Date: May 2022
Posts: 2
Rep Power: 0
qiudejin is on a distinguished road
hi sir,
What macro did you finally choose?
qiudejin is offline   Reply With Quote

Reply

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
Material change during phase transformation (FePO4 > LiFePO4) concentration distribut kimsw0103 CFX 0 January 15, 2016 22:05
DPM Steady Local Collection Efficiency and Concentration Cells Error Manathan Fluent UDF and Scheme Programming 0 April 8, 2015 12:06
Setting up the pressure variation due to tornado in a duct(UDF)+animation guillaume1990 FLUENT 0 March 3, 2014 11:59
Concentration Scale Data Interpretation usker Siemens 4 October 23, 2007 20:30
initial concentration in multicomponent mixtures isidro Siemens 0 April 26, 2004 07:40


All times are GMT -4. The time now is 01:09.