FLUENT UDF代码_颗粒(煤或生物质)床层多相流燃烧过程数值模拟-【第2部分-完结】
fluent教程粉煤燃烧
Last Point 0.001 0.001 100 57.7 1.0E-4 303 2.0E-4
Material: (continuous phase)
Cp: mixing-law
Thermal conductivity: 0.025
Viscosity :2.0e-5
Density
Cp
Materials: Discrete Phase Thermal Conductivity
进口条件 Setup-operating conditions 燃料进口: 303K
氧化剂进口
650K
定义PDF求解条件 Setup-solution parameters 保存输入参数:file-write-input 求解:calculate-PDF table 保存PDF文件:file-write-PDF 检查PDF计算结果
Graphics-Property Curves
温度混合分数之间关系:f=0.1;T=2270K
组分在混合分数空间分布
非绝热的设置和PDF计算
Operating condition
Setup-solution Parameters
FLUENT 计算
读入网格 检查网格 显示网格
非耦合求解器 标准双方程模型 PDF模型(非预混模型) 离散相与气相耦合: define-models-discrete phase
X-Position (m) Y-Position (m) X-Velocity (m/s) Y-Velocity (m/s) Diameter (m) Temperature (K) Flow Rate (kg/s)
First Point 0.001 0.001 100 0 1.0E-4 303 2.0E-4
fluent关于化学反应的udf编写
放热速度 单位 j/(m3 s)*/
return source;
}
/*定义 CH4 组分方程源项*/
DEFINE_SOURCE(ch4_source,c,t,dS,eqn)
{
real source;
source = (-arrhenius_rate(C_T(c,t)))*C_R(c,t)*C_YI(c,t,CH4);/*计算甲烷的消耗速度
udf的代码如下includeudfh动力学参数常量definepreexp18e08指前因子单位1sdefineactive13e08活化能jkmoldefinebeta00温度指数realarrheniusraterealtempreturnpreexppowtempbetaexpactiveuniversalgasconstanttemp
单位 kg/(m3 s)*/
return source;
}
/*定义 CO2 组分方程源项*/
DEFINE_SOURCE(co2,c,t,dS,eqn)
{ real source; source = (arrhenius_rate(C_T(c,t)))*C_R(c,t)*C_YI(c,t,CH4);/*计算 CO2 的生成速度 单
单位 kg/(m3 s)*/
return source;
}
/*定义 O2 组分方程源项*/
DEFINE_SOURCE(o2_source,c,t,dS,eqn)
{
real source;
source = 2*(-arrhenius_rate(C_T(c,t)))*C_R(c,t)*C_YI(c,t,CH4);/*计算 DEFINE_SOURCE(energy_source,c,t,dS,eqn)
Fluent软件的燃烧模型介绍(精)
Fluent软件的燃烧模型介绍Fluent软件中包含多种燃烧模型、辐射模型及与燃烧相关的湍流模型,适用于各种复杂情况下的燃烧问题,包括固体火箭发动机和液体火箭发动机中的燃烧过程、燃气轮机中的燃烧室、民用锅炉、工业熔炉及加热器等。
燃烧模型是FLUENT软件优于其它CFD软件的最主要的特征之一。
下面对Fluent软件的燃烧模型作一简单介绍:一、气相燃烧模型·有限速率模型这种模型求解反应物和生成物输运组分方程,并由用户来定义化学反应机理。
反应率作为源项在组分输运方程中通过阿累纽斯方程或涡耗散模型。
有限速率模型适用于预混燃烧、局部预混燃烧和非预混燃烧。
应用领域:该模型可以模拟大多数气相燃烧问题,在航空航天领域的燃烧计算中有广泛的应用。
PDF模型该模型不求解单个组分输运方程,但求解混合组分分布的输运方程。
各组分浓度由混合组分分布求得。
PDF模型尤其适合于湍流扩散火焰的模拟和类似的反应过程。
在该模型中,用概率密度函数PDF来考虑湍流效应。
该模型不要求用户显式地定义反应机理,而是通过火焰面方法(即混即燃模型或化学平衡计算来处理,因此比有限速率模型有更多的优势。
应用领域:该模型应用于非预混燃烧(湍流扩散火焰,可以用来计算航空发动机的环形燃烧室中的燃烧问题及液体/固体火箭发动机中的复杂燃烧问题。
非平衡反应模型层流火焰模型是混合组分/PDF模型的进一步发展,从而用来模拟非平衡火焰燃烧。
在模拟富油一侧的火焰时,典型的平衡火焰假设失效。
该模型可以模拟形成Nox的中间产物。
应用领域:该模型可以模拟火箭发动机的燃烧问题和RAMJET及SCRAMJET 的燃烧问题。
预混燃烧模型该模型专用于燃烧系统或纯预混的反应系统。
在此类问题中,充分混合的反应物和反应产物被火焰面隔开。
通过求解反应过程变量来预测火焰面的位置。
湍流效应可以通过层流和湍流火焰速度的关系来考虑。
应用领域:该模型可以用来模拟飞机加力燃烧室中的复杂流场模拟、气轮机、天然气燃炉等。
fluent tutorial file 之 prePDF 模拟煤粉燃烧
译者:wyxpuma时间有限,错漏之处在所难免.如有发现可站内 message 我: )使用非预混燃烧模型 Using the Non-Premixed Combustion Model 概要 先决条件 问题描述 使用 prePDF 的准备工作 Step 1: Define the Preliminary Adiabatic System in prePDF Step 2: Compute and Review the Adiabatic System prePDF Look-Up Tables Step 3: Create and Compute the Non-Adiabatic prePDF System Preparation for FLUENT Calculation Step 4: Grid Step 5: Models: Continuous (Gas) Phase Step 6: Models: Discrete Phase Step 7: Materials: Continuous Phase Step 8: Materials: Discrete Phase Step 9: Boundary Conditions Step 10: Solution Step 11: Postprocessing Step 12: Energy Balances and Particle Reporting SummaryIntroduction 概要对煤粉燃烧的模拟包括对连续气相的模拟及其对煤颗粒分散相的相互作用 的模拟.煤颗粒穿过气相时,会进行脱挥发分和焦炭的燃烧,从而成为进行气相 反应的燃料的源.对反应的模拟可通过组分传输模型(the species transport model)或非预混燃烧模型(the non-premixed combustion model)进行模拟. 在此实例指南中, 你将使用非预混燃烧模型模拟一个简化的燃煤炉体内的化学反 应. 在此实例指南中,你将学习: 使用 prePDF 预处理器为煤粉燃料(的燃烧)准备一个 PDF 表 为非预混燃烧化学反应模型定义 FLUENT 的输入参数 为煤颗粒定义一个离散相 求解一个包含反应离散相的煤颗粒的数值模型非预混燃烧模型是采用这样一种建模方法, 即求解一个或两个守恒标量以及混合 分数的的传输方程.多化学组分时,包括根和中间产物,可以采用这种方法被考译者:wyxpuma时间有限,错漏之处在所难免.如有发现可站内 message 我: )虑进来,并且他们的浓度能够通过预测出的混合分数分布计算出来.通过化学数 据库,可以得出组分的正确数据.湍流和化学反应的相互作用可通过使用β或双 δ的概率密度函数 (PDF) 来模拟. 关于非预混燃烧的模型详见 the User's GuidePrerequisitesThis tutorial assumes that you are familiar with the menu structure in FLUENT, and that you have solved Tutorial 1 or its equivalent. Some steps in the setup and solution procedure will not be shown explicitly.问题描述(Problem Description )本例程考虑的煤粉燃烧系统时一个简单的二维管道,截面为 10m×1m,如图 13.1 所示.因为管道对称,图中只显示了宽度的一半.该二维管道的入口分成 两股来流.靠近管道中心的高速来流速度为 50m/s,跨度为 0.125m.另一股来流 速度为 15m/s,跨度为 0.375m.两股来流都是 1500K 的空气.靠近中心高速流股 进入炉膛的煤颗粒,其质量流率为 0.1kg/s(煤颗粒的总流率为 0.2kg/s).管 道的壁温为 1200K 的常温. 基于入口尺寸和平均入口速度的雷诺数约为 100,000. 因此,流动为湍流. 关于煤组成和粒度分布的详细信息将在 step 5(Models: Continuous (Gas) Phase)和 Step 8( Materials: Discrete Phase)中给出.Figure 13.1: 2D Furnace with Pulverized Coal Combustion译者:wyxpuma时间有限,错漏之处在所难免.如有发现可站内 message 我: )对 prePDF 的准备(Preparation for prePDF )1. 启动 prePDF.当你使用非预混燃烧模型,你要先使用前处理器—prePDF-生成一个 PDF 文件. 该 PDF 文件包含了关于各组分浓度,温度与混合分数值之间的联系的信息,并被 FLUENT 在求解过程中用来获得这些标量(组分浓度,温度等) .Step 1: 在 prePDF 中定义初步的绝热系统 (Define the Preliminary Adiabatic System in prePDF )1. 定义 prePDF 模型类别.你可以定义单一燃料流或者燃料流加上另一个流股.激活第二个流股可以让你明了 两个混合分数.对于煤颗粒的燃烧,采用两个流股的方法可以让你明确地将挥发分 (第二个流股)流股同焦炭流股(燃料流)分开.在该例程中,我们将不采用两个 流股的方法,而采用单一混合分数法.SetupCase...(a)译者:wyxpuma时间有限,错漏之处在所难免.如有发现可站内 message 我: )在 Heat transfer options, 保持默认设置 Adiabatic.该例程中讨论的煤粉燃烧器是一个非绝热系统, 在气相与煤颗粒相间, 以及燃 烧器壁面上,都有热量传递.因此,必须在 prePDF 中考虑非 绝热系统.由于非绝热系统较之绝热系统在计算时要耗费更多的时间,因此你 可在启动 prePDF 时先考虑系统为绝热系统. 根据对绝热系统的 PDF/化学 平衡的计算结果,你将确定大致的系统参数,这将使得在非绝热系统下的 计算更具效率.而且,绝热系统的计算将提供绝热火焰温度,混合分数的 化学当量以及各单独组分对化学反应系统的重要性的信息. 这种首先在绝 热系统中计算的方法将被用于所有的考虑在非绝热条件下的 PDF 计算.(b) 在 Chemistry models, 保持默认设置 Equilibrium Chemistry. 对大多数基于 PDF 的数值模拟,推荐 使用 Equilibrium Chemistry 选项. Stoichiometric Reaction ( 混合即完全反应 ) 选项计算量小,但不准确; Laminar Flamelets 选项能够考虑空气拉伸的非平衡现象,例如超平衡基浓度和亚平衡温度. 这对于 NOx 的预测非常重要,但在此例中不必考虑. (c) 保持默认设置 PDF models. 一般的,推荐使用β函数的 PDF 积分,因为他比δ函数的 PDF 积分方法更准确.(d) 在 Empirically Defined Streams, 选择 Fuel stream 选项. 这将允许你采用 empirical 输入选项来定义燃料流股(即根据煤的 ultimate analysis 定义) Empirical 输入选项允许你指定燃料中 H,C,N 和 O 的元素组成 (DAF) 低位发热量和比热. , 当元素分析和热值已知时, 这种指定方法是很有效的. (e) 点击 Apply ,关闭面板 2. 定义系统中的化学组分指定系统中包含哪些组分依赖于燃料类型和燃烧系统. 关于指定组分的指南在FLUENT User's Guide 中有介绍.在这里,你将假定该平衡系统中包含 13 种组分: C, C(s), CH , CO, CO , H, H ,H O, N, N , O, O , and OH.之所以包含 C, H, O, 和 N 是因为我们采用``empirical''输入方法 对燃料进行定义的,因此要用到元素组分.! 当使用 empirical input 选项时,你应当将 C and C(S) 都选入系统SetupSpeciesDefine...译者:wyxpuma时间有限,错漏之处在所难免.如有发现可站内 message 我: )(a) 将 Maximum # of Species 设为 13. 使用上,下箭头来设置最大组分数目,或在数 字框中直接键入数字然后摁<ENTER>. (b) 在 Defined Species 列表中选择最上面的组分(初始标志为 UNDEFINED). (c) 在 Database Species 下拉表单中,使用滚动条拖动表单,并选择 C. 此时 Defined Species 表单中的最顶部组分将显示为 C . (d) 在 Defined Species 列表中选择第二个组分 (或在 Species # 选项中将数目增大为 2). (e) 在 Database Species 下拉 表 单 中 , 使 用 滚 动 条 拖 动 表 单 , 并 选 择 下 一 个 组 分 ( C(S)). (f) 重复 步骤 (d) 和 (e),直到 13 个组分都被定义 (g) 点击 Apply,关闭面板 Note:在其他燃烧系统中,你也许想添加其他化学组分,但你不要添加慢反应的化学组分, 例如 NOx..3. 确定燃料组分输入.本例中考虑的燃料是已知的,根据工业分析,知道含 28%的挥发分,64%的焦炭和 8%的灰分.你要根据这些信息,以及以下给出的元素分析结果,在 prePDF 中定义 煤的组成.燃料流的组成(焦炭和挥发分)可计算如下:译者:wyxpuma时间有限,错漏之处在所难免.如有发现可站内 message 我: )首先将工业分析数据(干燥基)转化为可燃基(干燥无灰基).工业分析 Wt % Wt % Proximate Analysis (dry) Volatiles Char (C(s)) Ash 28 64 8 (DAF) 30.4 69.6 -煤的元素分析如下表:Element Wt % (DAF) C H O N S 89.3 5.0 3.4 1.5 0.8为简单起见,煤中的硫分可并入氮的质量分数,因此最终数据如下:Element Wt % (DAF) C H O N S 89.3 5.0 3.4 2.3 -我们可根据工业分析和元素分析的数据得出挥发分的元素组成如下: can combine Wethe proximate and ultimate analysis data to yield the following elemental composition of the volatile stream: (译者注:这里不是挥发分流股的元素组成,而是整个燃料流股的元素组成,因为该模型采用单混合分数模型,而且表中数据也显示是单流股的摩 尔组成)译者:wyxpuma时间有限,错漏之处在所难免.如有发现可站内 message 我: )Element Wt % Moles Mole Fraction C H O N Total 89.3 5.0 3.4 2.3 7.44 5 0.21 0.16 12.81 0.581 0.390 0.016 0.013你将用到上表中最后一列中的数据.prePDF 将使用这些信息以及煤的热值来定义 燃料中的组分. 煤的低位热值为(DAF) : LCV= 35.3 MJ/kg煤的热容和密度分别为 1000 J/kg-K 和 1 kg/m4. 输入燃料和氧化剂的组分SetupSpeciesComposition...(a) 激活氧化剂流股组分的输入框氧化剂(空气)的组成为 21%的 O2 和 79% 的 N2译者:wyxpuma时间有限,错漏之处在所难免.如有发现可站内 message 我: )i. 在 Stream 下, 选择 Oxidiser. ii. 在 Specify Composition In, 保持默认选项 Mole Fractions. iii. 在 Defined Species 选项中选择 O2 并在 Species Fraction 中输入 0.21. iv. 在 Defined Species 选项中选择 N2 并在 Species Fraction 中输入 0.79 (b) 激活燃料流股组分的输入框 Note: 因为燃料流股已经选择了 empirical 输入选项,您将被提示输入 C,H,O 和 N 的原子摩尔分数,以及燃料的热值和热容.译者:wyxpuma时间有限,错漏之处在所难免.如有发现可站内 message 我: )i. 在 Stream 下, 选择 Fuel. ii. 在 Specify Composition In 中,保持默认选项 Mole Fractions. iii. 在 Defined Species 列表中选择 C 并在 Atom Fraction 中键入 0.581. iv. 在 Defined Species 列表中选择 H 并在 Atom Fraction 中键入 0.390. v. 在 Defined Species 列表中选择 N 并在 Atom Fraction 中键入 0.016. vi. 在 Defined Species 列表中选择 O 并在 Atom Fraction 中键入 0.013. vii. 在 Lower Caloric Value 中键入 3.53e+07 J/kg 在 Specific Heat 中键入 1000 J/kg-K . viii. 点击 Apply ,关闭面板. 5. 定义固体碳的密度.译者:wyxpuma时间有限,错漏之处在所难免.如有发现可站内 message 我: )这里,假定固定碳密度为 1300 kg/m3SetupSpeciesDensity...(a) 在 Defined Species 中选择 C(S) . (b) 将 Density 设为 1300. (c) 点击 Apply ,关闭面板. Note:在计算燃料的混合密度时,prePDF 会用到这个信息.你应当定义固定焦炭的密度, 这个值可能和 FLUENT 中定义的煤的密度不一致, FLUENT 中定义的是包含灰 的煤粒的显密度.6. 定义系统操作条件.在化学平衡计算中需要用到系统压力和入口流温度. 煤燃烧情况下, 燃料流股 的入口温度应当是开始脱挥发分的温度.氧化剂流股的入口温度应当对应于空气入 口温度.在本例程中,煤脱挥发分的温度设置为 400 K,空气入口温度为 1500K,系 统压力为 1 大气压.SetupOperating Conditions...(a)在Fuel和Oxidiser中分别将温度设为400 K 和1500 K。
采用FLUENT软件研究旋流煤粉燃烧器燃烧特性
2005 Fluent 中国用户大会论文集采用FLUENT软件研究旋流煤粉燃烧器燃烧特性由长福(清华大学热能工程系,北京 100084)摘要:本文FLUENT软件研究了实际电站锅炉单个双调风旋流燃烧器附近区域的煤粉燃烧过程。
并分别研究了内二次风旋流强度,外二次风风率,一次风风率和三次风风率等因素对燃烧性能的影响。
各工况计算结果表明,总体上在燃烧器出口处形成了高温区和高煤粉浓度区,燃烧器出口一定距离后的炉内温度呈逐渐上升趋势,炉膛温度分布均匀。
中心高温区出现迟的工况,后期分级燃烧充分。
表明该燃烧器具有高效稳燃和变工况运行稳定的性能。
关键词:旋流燃烧器;数值计算;燃烧性能引 言当前国内使用的电站锅炉,80%是四角切圆煤粉燃烧锅炉,不到10%采用旋流燃烧锅炉[1]。
和四角切圆煤粉锅炉相比,旋流燃烧器锅炉是一种新型的锅炉,结构复杂得多。
已有较多学者采用数值模拟方法研究旋流燃烧器燃烧性能的例子[1-4],这些例子的计算结果都详细预报了由于测量困难而不能充分获得的炉膛内部的温度场,速度场,燃烧产物各组分的浓度分布和污染物的分布,其中文献[2]和[3]还与实验数据比较,比较结果表明,模拟结果与锅炉热态试验数据吻合情况较好,为数值模拟的更广应用提供了依据。
简图如图1燃烧器中心通一股直流的三次风,风量较小。
针对该燃烧器的结构,本文研究了内二次风的旋流强度,二次风的配比,一次风和中心风的风率对燃烧性能的影响。
作者:由长福(1969),男(汉族),黑龙江,副教授,博士,清华大学热能工程系1 计算方法1.1 计算对象和网格生成计算域为单个旋流燃烧器附近的区域,大致为两个燃烧器之间的水冷壁和炉膛。
根据旋流燃烧器出口附近的流场特性,采用二维轴对称结构模拟该区域。
在计算区域的出口采用了倾斜一定角度的斜面以避免由于回流产生的压力计算不准确。
由于要计算旋转流动,为了得到较好的收敛结果,对燃烧器喉部壁面附近、水冷壁附近进行了网格细分。
利用fluent组分输运模型模拟锅炉混煤燃烧过程
利⽤fluent组分输运模型模拟锅炉混煤燃烧过程fluent组分输运模拟混煤燃烧之前⽤组分输运做过⼀些混煤燃烧的⼯作,因为⾃⼰⼀开始接触组分输运的时候也遇到很多困难,⽤组分输运做混煤模拟更是⼀⽆所知,后来在之前课题组基础上,加上⾃⼰的摸索,对⽤组分输运做混煤模拟的套路⼤概了解了,所以就把这个“套路”总结了⼀下写了出来,希望可以帮到有需要的朋友。
当然,下⾯的内容更多的是做混煤模拟的⼀个过程的描述,具体⾥⾯的有些参数的设置我也不是太懂,尤其是⼀些涉及到化学反应的参数,所以这篇⽂章只是告诉⼤家设置的“套路”,具体的参数还是要⼤家查阅相关⽂献或书籍。
另外⼤家也没必要死搬硬套我这个套路,我这篇⽂章只是希望能给想做混煤模拟的朋友⼀些启发,⼤家应当在我这个⽂章的基础上多去琢磨,搞清楚每⼀步的设置都是在做什么,这样⾃⼰遇到⼀些我⽂中没有提到的问题时也能⾃⼰解决。
⽂中若有什么错误或未描述清楚的地⽅,欢迎互相交流。
1.打开species⾯板,选择species transport(组分输运),Reactions勾选上Volumetric,表⽰组分输运在某体积内有化学反应,Turbulence-Chemistry Interaction点选Finite-Rate/Eddy-Dissipation,表⽰化学反应是有限反应速率的,反应速率受化学反应本⾝与湍流混合⼆者共同控制。
2.点Finite-Rate/Eddy-Dissipation后,下⾯会出现coal calculator,⽤于对煤的反应进⾏计算,点coal calculator,弹出如下界⾯,根据煤质分析结果,填⼊相应数据,这⾥假设有两种煤,⼀种中等挥发份,取名为coal-mv,⼀种为⾼挥发份,取名为coal-hv,相应结果如下图。
3.点完Apply后点OK,会弹出如下界⾯。
4.这样coal-hv就设置好了,然后继续点coal-calculator,以同样的⽅法设置coal-mv。
FLUENT中的燃烧模拟
第六章,FLUENT中的燃烧模拟6.1 燃烧模拟的重要性●面向实际装置(如锅炉、内燃机、火箭发动机、火灾等)●面向实际现象(如点火、熄火、燃烧污染物生成等)6.2 FLUENT燃烧模拟方法概要●FLUENT可以模拟宽广范围内的燃烧(反应流)问题。
然而,需要注意的是:你必须保证你所使用的物理模型要适合你所研究的问题。
FLUENT在燃烧模拟中的应用可如下图所示:●气相燃烧模型一般的有限速率形式(Magnussen 模型)守恒标量的PDF模型(单或二组分混合物分数)层流火焰面模型(Laminar flamelet model)Zimont 模型●离散相模型煤燃烧与喷雾燃烧●热辐射模型DTRM, P-1, Rosseland 和Discrete Ordinates模型●污染物模型NO x 模型,烟(Soot)模型6.3 气相燃烧模型6.3.1 燃烧的化学动力学模拟实际中的燃烧过程是湍流和化学反应相互作用的结果,燃烧的化学反应速率是强非线性和强刚性的。
通常的化学反应机理包含了几十种组分和几百个基元反应,而且这些组分之间的反应时间尺度相差很大(10-9~102秒),因此在实际问题的求解过程中计算量和存储量极大,目前应用尚不现实。
在FLUENT 中,针对不同的燃烧现象,采用了不同的化学动力学处理手段,以减少计算成本,如下:● 有限速率燃烧模型——>预混、部分预混和扩散燃烧● 混合物分数方法(平衡化学的PDF 模型和非平衡化学的层流火焰面模型)——>扩散燃烧● 反应进度方法(Zimont 模型)——>预混燃烧● 混合物分数和反应进度方法的结合——>部分预混燃烧6.3.2一般的有限速率模型● 化学反应过程一般采用总包机理(即简化化学反应,如单步反应)进行描述 ● 求解组分的输运方程,得到每种组分的时均质量分数值,如下:6-1其中组分j 的反应源项为所有K 个反应中,组分j 的净生成速率:6-2 式中,反应k 中的组分j 的反应速率可按照Arrhenius 公式、混合(mixing )速率或 “eddy breakup” 速率的方法求解。
FLUENT算例 (9)模拟燃烧
计算流体力学作业FLUENT 模拟燃烧问题描述:长为2m、直径为0.45m的圆筒形燃烧器结构如图1所示,燃烧筒壁上嵌有三块厚为0.0005 m,高0.05 m的薄板,以利于甲烷与空气的混合。
燃烧火焰为湍流扩散火焰。
在燃烧器中心有一个直径为0.01 m、长为0.01 m、壁厚为0.002 m的小喷嘴,甲烷以60 m/s的速度从小喷嘴注入燃烧器。
空气从喷嘴周围以0.5 m/s的速度进入燃烧器。
总当量比大约是0.76(甲烷含量超过空气约28%),甲烷气体在燃烧器中高速流动,并与低速流动的空气混合,基于甲烷喷嘴直径的雷诺数约为5.7×103。
假定燃料完全燃烧并转换为:CH4+2O2→CO2+2H2O反应过程是通过化学计量系数、形成焓和控制化学反应率的相应参数来定义的。
利用FLUENT的finite-rate化学反应模型对一个圆筒形燃烧器内的甲烷和空气的混合物的流动和燃烧过程进行研究。
1、建立物理模型,选择材料属性,定义带化学组分混合与反应的湍流流动边界条件2、使用非耦合求解器求解燃烧问题3、对燃烧组分的比热分别为常量和变量的情况进行计算,并比较其结果4、利用分布云图检查反应流的计算结果5、预测热力型和快速型的NO X含量6、使用场函数计算器进行NO含量计算一、利用GAMBIT建立计算模型第1步启动GAMBIT,建立基本结构分析:圆筒燃烧器是一个轴对称的结构,可简化为二维流动,故只要建立轴对称面上的二维结构就可以了,几何结构如图2所示。
(1)建立新文件夹在F盘根目录下建立一个名为combustion的文件夹。
(2)启动GAMBIT(3)创建对称轴①创建两端点。
A(0,0,0),B(2,0,0)②将两端点连成线(4)创建小喷嘴及空气进口边界①创建C、D、E、F、G点C D E F Gx 0 0.01 0.01 0 0y 0.005 0.005 0.007 0.007 0.225②连接AC、CD、DE、DF、FG。
FLUENT算例 (9)模拟燃烧
计算流体力学作业FLUENT 模拟燃烧问题描述:长为2m、直径为0.45m的圆筒形燃烧器结构如图1所示,燃烧筒壁上嵌有三块厚为0.0005 m,高0.05 m的薄板,以利于甲烷与空气的混合。
燃烧火焰为湍流扩散火焰。
在燃烧器中心有一个直径为0.01 m、长为0.01 m、壁厚为0.002 m的小喷嘴,甲烷以60 m/s的速度从小喷嘴注入燃烧器。
空气从喷嘴周围以0.5 m/s的速度进入燃烧器。
总当量比大约是0.76(甲烷含量超过空气约28%),甲烷气体在燃烧器中高速流动,并与低速流动的空气混合,基于甲烷喷嘴直径的雷诺数约为5.7×103。
假定燃料完全燃烧并转换为:CH4+2O2→CO2+2H2O反应过程是通过化学计量系数、形成焓和控制化学反应率的相应参数来定义的。
利用FLUENT的finite-rate化学反应模型对一个圆筒形燃烧器内的甲烷和空气的混合物的流动和燃烧过程进行研究。
1、建立物理模型,选择材料属性,定义带化学组分混合与反应的湍流流动边界条件2、使用非耦合求解器求解燃烧问题3、对燃烧组分的比热分别为常量和变量的情况进行计算,并比较其结果4、利用分布云图检查反应流的计算结果5、预测热力型和快速型的NO X含量6、使用场函数计算器进行NO含量计算一、利用GAMBIT建立计算模型第1步启动GAMBIT,建立基本结构分析:圆筒燃烧器是一个轴对称的结构,可简化为二维流动,故只要建立轴对称面上的二维结构就可以了,几何结构如图2所示。
(1)建立新文件夹在F盘根目录下建立一个名为combustion的文件夹。
(2)启动GAMBIT(3)创建对称轴①创建两端点。
A(0,0,0),B(2,0,0)②将两端点连成线(4)创建小喷嘴及空气进口边界①创建C、D、E、F、G点C D E F Gx 0 0.01 0.01 0 0y 0.005 0.005 0.007 0.007 0.225②连接AC、CD、DE、DF、FG。
FLUENT UDF代码_颗粒(煤或生物质)床层多相流燃烧过程数值模拟-【第2部分-完结】
Fluent-UDF_Coal-Combustion-Multiphase-Flow-Processes ---Codes for various kinds of heterogeneous reactions【第二部分-Part2】DEFINE_HET_RXN_RATE(SteamGasif_Rev_MGAS,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon, rr_turb = 1e+20;/*CO + H2 ---> H2O + 1/25 SootThe reverse steam gasification reaction, which is CO + H2 ---> 1/25 Soot + H2O is written as the reactionshown above. So a negative rate means CO and H2 is consumed and H2O and Soot are generated. Note that noC(s) is generated, the stoich coeff for C(s) in the above reation is zero.Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if(MGAS_Gasif){double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_h2o = RoRT * yi[IP_H2O][IS_H2O]/mw[IP_H2O][IS_H2O]/ 101325.;double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO] / 101325.;double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;y_carbon = yi[IP_SOOT][IS_SOOT];mol_weight = mw[IP_SOOT][IS_SOOT];if (rp_ke)rr_turb = Turbulent_rr(c, t, hr, yi);if(C_VOF(c, ts) >= eps_s_small){*rr = rr_steam_gasif(c, t, ts, tp, p_h2o, p_co, p_h2, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction > 0.0) /* positive value implies C(s) + H2O ---> CO + H2 */*rr = 0.0;else /* negative value implies CO + H2 ---> H2O + 1/25 Soot */{*rr = abs(*rr);*rr = MIN(*rr, rr_turb);}}}}double rr_steam_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double p_h2o, double p_co, double p_h2, double y_carbon, double mol_weight, double* direction){double rate, prod, T_g = MIN((MAX(TMIN,C_T(c,tp))),TMAX);double p_h2o_star = p_h2 * p_co / ( exp(17.29 - 16326/T_g) );if(MGAS_Gasif) *direction = p_h2o - p_h2o_star;if(PCCL_Gasif) *direction = pow(p_h2o, N_steam_gasification)/(1.+K_steam_gasification*p_h2);prod = y_carbon*(C_R(c,ts)*1e-03)/mol_weight*C_VOF(c,ts); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */if(MGAS_Gasif && *direction < 0.0) /* this implies reverse H2O gasification */prod = y_carbon*(C_R(c,tp)*1e-03)/mol_weight*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */rate = A_steam_gasification*exp(-E_steam_gasification/Rgas/T_g)* Annealing_steam_gasification * prod * *direction; /* mol/cm^3.s */rate *= 1000.; /* kmol/(m^3 .s) */return rate;}DEFINE_HET_RXN_RATE(Co2Gasif,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon;/*C(s) + CO2 ---> 2COSet the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO] / 101325.;double p_co2 = RoRT * yi[IP_CO2][IS_CO2]/mw[IP_CO2][IS_CO2] / 101325.;SolidFuel_Reactant(c, t, hr, &y_carbon, &mol_weight);if(C_VOF(c, ts) >= eps_s_small){*rr = rr_co2_gasif(c, t, ts, tp, p_co, p_co2, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction < 0.0) /* negative implies reverse steam gasification */*rr = 0.0;}}DEFINE_HET_RXN_RATE(Soot_CO2_Gasif,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */*rr = 0;double rr_turb = 1e+20;double T_g = MIN((MAX(TMIN,C_T(c,tp))),TMAX);/*1/25 Soot + CO2 ---> 2COSet the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO]/ 101325.;double p_co2 = RoRT * yi[IP_CO2][IS_CO2]/mw[IP_CO2][IS_CO2] / 101325.;if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);double prod = yi[IP_SOOT][IS_SOOT]*(C_R(c,tp)*1e-03)/mw[IP_SOOT][IS_SOOT]*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */*rr = A_soot_co2_gasification*exp(-E_soot_co2_gasification/Rgas/T_g)* Annealing_soot_co2_gasification * prod *pow(p_co2, N_soot_co2_gasification)/(1.+K_soot_co2_gasification*p_co); /* mol/cm^3.s */*rr *= 1000.; /* kmol/(m^3 .s) */*rr = MIN(*rr, rr_turb);}DEFINE_HET_RXN_RATE(Co2Gasif_Rev_MGAS,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon, rr_turb = 1e+20;/*2CO ---> CO2 + 1/25 SootThe reverse CO2 gasification reaction, which is 2CO ---> 1/25 Soot + CO2 is written as the reactionshown above. So a negative rate means CO is consumed and CO2 and Soot are generated. Note that noC(s) is generated, the stoich coeff for C(s) in the above reation is zero.Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if(MGAS_Gasif){double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO] / 101325.;double p_co2 = RoRT * yi[IP_CO2][IS_CO2]/mw[IP_CO2][IS_CO2] / 101325.;y_carbon = yi[IP_SOOT][IS_SOOT];mol_weight = mw[IP_SOOT][IS_SOOT];if (rp_ke)rr_turb = Turbulent_rr(c, t, hr, yi);if(C_VOF(c, ts) >= eps_s_small){*rr = rr_co2_gasif(c, t, ts, tp, p_co, p_co2, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction > 0.0) /* positive value implies C(s) + CO2 ---> 2CO */*rr = 0.0;else /* negative value implies 2CO ---> CO2 + 1/25 Soot */{*rr = abs(*rr);*rr = MIN(*rr, rr_turb);}}}}double rr_co2_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double p_co, double p_co2, double y_carbon, double mol_weight, double* direction){double T_g = MIN(MAX(TMIN,C_T(c,tp)), TMAX), prod;double p_co2_star = p_co * p_co/(exp(20.92 - 20282/T_g));if(MGAS_Gasif) *direction = p_co2-p_co2_star;if(PCCL_Gasif) *direction = pow(p_co2, N_co2_gasification)/(1. + K_co2_gasification * p_co);prod = y_carbon*C_R(c,ts)*1.e-3/mol_weight* C_VOF(c,ts); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */if(MGAS_Gasif && *direction < 0.0) /* this implies reverse CO2 gasification */prod = y_carbon*(C_R(c,tp)*1e-03)/mol_weight*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */double rate = A_co2_gasification*exp(-E_co2_gasification/Rgas/T_g)*Annealing_co2_gasification * prod * (*direction); /* mol/cm^3.s */rate *= 1000.; /* kmol/(m^3 .s) */return rate;}DEFINE_HET_RXN_RATE(H2Gasif,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon;/*1/2 C(s) + H2 ---> 1/2 CH4Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done bythe firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;double p_ch4 = RoRT * yi[IP_CH4][IS_CH4]/mw[IP_CH4][IS_CH4] / 101325.;SolidFuel_Reactant(c, t, hr, &y_carbon, &mol_weight);if(C_VOF(c, ts) >= eps_s_small){*rr = rr_h2_gasif(c, t, ts, tp, p_h2, p_ch4, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction < 0.0) /* negative implies reverse steam gasification */*rr = 0.0;}}DEFINE_HET_RXN_RATE(Soot_H2_Gasif,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */*rr = 0;double rr_turb = 1e+20;double T_g = MIN((MAX(TMIN,C_T(c,tp))),TMAX);/*1/25 Soot + 2H2 ---> CH4Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);double prod = yi[IP_SOOT][IS_SOOT]*(C_R(c,tp)*1e-03)/mw[IP_SOOT][IS_SOOT]*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */*rr = A_soot_h2_gasification*exp(-E_soot_h2_gasification/Rgas/T_g)* Annealing_soot_h2_gasification * prod *pow(p_h2, N_soot_h2_gasification); /* mol/cm^3.s */*rr *= 1000.; /* kmol/(m^3 .s) */*rr = MIN(*rr, rr_turb);}DEFINE_HET_RXN_RATE(H2Gasif_Rev_MGAS,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon, rr_turb = 1e+20;/*1/2 CH4 ---> H2 + (0.5)*1/25 SootThe reverse H2 gasification reaction, which is 1/2 CH4 ---> 1/25 Soot + H2 is written as the reactionshown above. So a negative rate means CH4 is consumed and H2 and Soot are generated. Note that noC(s) is generated, the stoich coeff for C(s) in the above reation is zero.Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if(MGAS_Gasif){double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;double p_ch4 = RoRT * yi[IP_CH4][IS_CH4]/mw[IP_CH4][IS_CH4] / 101325.;y_carbon = yi[IP_SOOT][IS_SOOT];mol_weight = mw[IP_SOOT][IS_SOOT];if(C_VOF(c, ts) >= eps_s_small){if (rp_ke)rr_turb = Turbulent_rr(c, t, hr, yi);*rr = rr_h2_gasif(c, t, ts, tp, p_h2, p_ch4, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction > 0.0) /* positive value implies 1/2 C(s) + H2 ---> 1/2 CH4 */*rr = 0.0;else /* negative value implies 1/2 CH4 ---> H2 + (0.5)*1/25 Soot */{*rr = abs(*rr);*rr = MIN(*rr, rr_turb);}}}}double rr_h2_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double p_h2, double p_ch4, double y_carbon, double mol_weight, double* direction){double rate = 0.0, prod;double T_g = MIN((MAX(TMIN,C_T(c,tp))), TMAX);double p_h2_star = pow ((p_ch4/(exp(-13.43 + 10999/T_g))), 0.5);prod = y_carbon*C_R(c,ts)*1.e-3/mol_weight * C_VOF(c,ts); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */if(MGAS_Gasif){*direction = p_h2-p_h2_star;if(*direction < 0.0) /* this implies reverse H2 gasification */prod = y_carbon*(C_R(c,tp)*1e-03)/mol_weight*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */rate = exp( -7.087 - 8078/T_g )* prod * *direction ; /* mol/cm^3.s */}if(PCCL_Gasif){*direction = p_h2;rate = A_h2_gasification*exp(-E_h2_gasification/Rgas/T_g)*Annealing_h2_gasification * prod * *direction; /* mol/cm^3.s */}rate *= 1000.; /* kmol/(m^3 .s) */return rate;}DEFINE_HET_RXN_RATE(coal_combustion,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */double mol_weight, y_carbon, y_ash;*rr = 0.0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if( C_YI(c,tp,IS_O2) >= spe_small){SolidFuel_Reactant(c, t, hr, &y_carbon, &mol_weight);y_ash = yi[index_phase][IS_ASH];*rr = rr_combustion(c, t, ts, tp, yi[IP_O2][IS_O2], y_ash, y_carbon); /* mol/(cm^3 .s) */*rr *= 1000.; /* kmol/(m^3 .s) */}}double rr_combustion(cell_t c, Thread *t, Thread *ts, Thread *tp, double yi_O2, double y_ash,double y_carbon){double rd, k_f, k_r, factor, k_a, rate = 0.0, vrel;double Pt = MAX(0.1, (op_pres+C_P(c,t))/101325);double gas_constant = 82.06; /* atm.cm^3/mol.K */double T = C_T(c,tp), T_s = C_T(c,ts), D_p = C_PHASE_DIAMETER(c,ts)*100.;double p_o2 = C_R(c,tp)*UNIVERSAL_GAS_CONSTANT* T *yi_O2/mw[IP_O2][IS_O2] / 101325.; /* atm */if(fc_ar > 0.){if (y_ash > 0.){rd = pow( (y_carbon * ash_ar/100.)/(y_ash * fc_ar/100.), (1./3.) );rd = MIN(1., rd);}elserd = 1.;}elserd = 0.;double diff = MAX((4.26 * pow((T/1800.),1.75)/Pt), 1.e-10); /* cm^2/s */double Sc1o3 = pow(C_MU_L(c,tp)/(C_R(c,tp) * diff * 1.e-4), 1./3.);#if RP_2Dvrel = pow(( (C_U(c,tp)-C_U(c,ts))*(C_U(c,tp)-C_U(c,ts)) +(C_V(c,tp)-C_V(c,ts))*(C_V(c,tp)-C_V(c,ts))), 0.5);#endif#if RP_3Dvrel = pow(( (C_U(c,tp)-C_U(c,ts))*(C_U(c,tp)-C_U(c,ts)) +(C_V(c,tp)-C_V(c,ts))*(C_V(c,tp)-C_V(c,ts)) +(C_W(c,tp)-C_W(c,ts))*(C_W(c,tp)-C_W(c,ts)) ), 0.5);#endifdouble Re = C_VOF(c,tp) * D_p/100. * vrel * C_R(c,tp)/(C_MU_L(c,tp)+SMALL_S);double N_sherwood = (7. - 10. * C_VOF(c,tp) + 5. * C_VOF(c,tp) * C_VOF(c,tp) )*(1. + 0.7 * pow(Re, 0.2) * Sc1o3) +(1.33 - 2.4 * C_VOF(c,tp) + 1.2 * C_VOF(c,tp) * C_VOF(c,tp)) *pow(Re, 0.7) * Sc1o3;if ( rd <= 0. || C_VOF(c, ts) <= 0. ){rate = 0.;}else{k_f = diff * N_sherwood / (D_p * gas_constant/mw[IP_O2][IS_O2] * T ); /* g/(atm.cm^2.s) */k_r = A_c_combustion * exp( -E_c_combustion/Rgas/T_s ) * rd * rd;if ( rd >= 1.){rate = 1. / (1./k_f + 1./k_r);}else{k_a = 2. * rd * diff * f_ep_a / (D_p * (1.-rd) * gas_constant/mw[IP_O2][IS_O2] * T_s );rate = 1. / (1./k_f + 1./k_r + 1./k_a);}factor = y_carbon / (y_carbon + 1.e-6);rate *= p_o2 * 6. * C_VOF(c,ts) * factor / (D_p * 32.); /* mol/(cm^3 .s) */ }return rate;}#if !RP_NODE || !PARALLELvoid volatile_mass_fractions(){read_c3m_data();/* pan2 : Oct 2012 ... added CX_Messages for debugging */CX_Message("PCCL_Devol = %d\n",PCCL_Devol);CX_Message("MGAS_Devol = %d\n",MGAS_Devol);CX_Message("CPD_Devol = %d\n",CPD_Devol);CX_Message("FGDVC_Devol = %d\n",FGDVC_Devol);CX_Message("HPTR_Devol = %d\n",HPTR_Devol);CX_Message("MGAS_Moisture = %d\n",MGAS_Moisture);CX_Message("PCCL_Moisture = %d\n",PCCL_Moisture);CX_Message("MGAS_TarCracking = %d\n",MGAS_TarCracking);CX_Message("PCCL_2nd_Pyro = %d\n",PCCL_2nd_Pyro);CX_Message("MGAS_gasif = %d\n",MGAS_Gasif);CX_Message("PCCL_gasif = %d\n",PCCL_Gasif);CX_Message("PCCL_TarCracking = %d\n",PCCL_TarCracking);CX_Message("MGAS_WGS = %d\n",MGAS_WGS);CX_Message("PCCL_soot_gasif = %d\n",PCCL_soot_gasif);CX_Message("MGAS_char_combustion = %d\n",MGAS_char_combustion);CX_Message("PCCL_char_combustion = %d\n",PCCL_char_combustion);CX_Message("PCCL_soot_oxidation = %d\n",PCCL_soot_oxidation);CX_Message("TAR_oxidation = %d\n",TAR_oxidation);CX_Message("MGAS_gas_phase_oxidation = %d\n",MGAS_gas_phase_oxidation);CX_Message("fc_ar = %f\n",fc_ar);CX_Message("vm_ar = %f\n",vm_ar);CX_Message("ash_ar = %f\n",ash_ar);CX_Message("moist_ar = %f\n",moist_ar);CX_Message("a1_devolatilization = %f\n",A1_devolatilization);CX_Message("e1_devolatilization = %f\n",E1_devolatilization);CX_Message("a2_devolatilization = %f\n",A2_devolatilization);CX_Message("e2_devolatilization = %f\n",E2_devolatilization);CX_Message("a_tar_cracking = %f\n",A_tar_cracking);CX_Message("e_tar_cracking = %f\n",E_tar_cracking);CX_Message("A_steam_gasification = %f\n",A_steam_gasification);CX_Message("E_steam_gasification = %f\n",E_steam_gasification);CX_Message("K_steam_gasification = %f\n",K_steam_gasification);CX_Message("N_steam_gasification = %f\n",N_steam_gasification);CX_Message("Annealing_steam_gasification = %f\n",Annealing_steam_gasification);CX_Message("A_co2_gasification = %f\n",A_co2_gasification);CX_Message("E_co2_gasification = %f\n",E_co2_gasification);CX_Message("K_co2_gasification = %f\n",K_co2_gasification);CX_Message("N_co2_gasification = %f\n",N_co2_gasification);CX_Message("Annealing_co2_gasification = %f\n",Annealing_co2_gasification);CX_Message("A_h2_gasification = %f\n",A_h2_gasification);CX_Message("E_h2_gasification = %f\n",E_h2_gasification);CX_Message("N_h2_gasification = %f\n",N_h2_gasification);CX_Message("Annealing_h2_gasification = %f\n",Annealing_h2_gasification);CX_Message("A_soot_steam_gasification = %f\n",A_soot_steam_gasification);CX_Message("E_soot_steam_gasification = %f\n",E_soot_steam_gasification);CX_Message("K_soot_steam_gasification = %f\n",K_soot_steam_gasification);CX_Message("N_soot_steam_gasification = %f\n",N_soot_steam_gasification);CX_Message("Annealing_soot_steam_gasification= %f\n",Annealing_soot_steam_gasification);CX_Message("A_soot_co2_gasification = %f\n",A_soot_co2_gasification);CX_Message("E_soot_co2_gasification = %f\n",E_soot_co2_gasification);CX_Message("K_soot_co2_gasification = %f\n",K_soot_co2_gasification);CX_Message("N_soot_co2_gasification = %f\n",N_soot_co2_gasification);CX_Message("Annealing_soot_co2_gasification= %f\n",Annealing_soot_co2_gasification);CX_Message("A_soot_h2_gasification = %f\n",A_soot_h2_gasification);CX_Message("E_soot_h2_gasification = %f\n",E_soot_h2_gasification);CX_Message("N_soot_h2_gasification = %f\n",N_soot_h2_gasification);CX_Message("Annealing_soot_h2_gasification = %f\n",Annealing_soot_h2_gasification);CX_Message("A_soot_combustion = %f\n",A_Soot_Combustion);CX_Message("E_soot_combustion = %f\n",E_Soot_Combustion);CX_Message("A_c_combustion = %f\n",A_c_combustion);CX_Message("E_c_combustion = %f\n",E_c_combustion);CX_Message("N_c_combustion = %f\n",N_c_combustion);CX_Message("Annealing_c_combustion = %f\n",Annealing_c_combustion);CX_Message("A_moisture_release = %f\n",A_moisture_release);CX_Message("E_moisture_release = %f\n",E_moisture_release);CX_Message("wg3 = %f\n",wg3);CX_Message("moisture_flux = %f\n",Moisture_Flux);/* f_ep_a is used in shrinking core model, in coal combustion model */double ep_a = 0.25 + 0.75*(1-ash_ar/100.);f_ep_a = pow(ep_a,2.5);}/* pan c3m start */static void SetBooleanValue(char * var , char * svalue) /* pan : Oct 2012 ... new function */ {cxboolean value;if ( strcmp(svalue,"true") == 0) /* pan2 : Oct 2012 : correction */value = TRUE;elsevalue = FALSE;if (strcmp(var,"pccl_devol") == 0) PCCL_Devol = value;if (strcmp(var,"mgas_devol") == 0) MGAS_Devol = value;if (strcmp(var,"cpd_devol") == 0) CPD_Devol = value;if (strcmp(var,"fgdvc_devol") == 0) FGDVC_Devol = value;if (strcmp(var,"hptr_devol") == 0) HPTR_Devol = value;if (strcmp(var,"mgas_moisture") == 0) MGAS_Moisture = value;if (strcmp(var,"pccl_moisture") == 0) PCCL_Moisture = value;if (strcmp(var,"mgas_tarcracking") == 0) MGAS_TarCracking = value;if (strcmp(var,"pccl_2nd_pyro") == 0) PCCL_2nd_Pyro = value;if (strcmp(var,"mgas_gasif") == 0) MGAS_Gasif = value;if (strcmp(var,"pccl_gasif") == 0) PCCL_Gasif = value;if (strcmp(var,"pccl_tarcracking") == 0) PCCL_TarCracking = value;if (strcmp(var,"mgas_wgs") == 0) MGAS_WGS = value;if (strcmp(var,"pccl_soot_gasif") == 0) PCCL_soot_gasif = value;if (strcmp(var,"mgas_char_combustion") == 0) MGAS_char_combustion = value;if (strcmp(var,"pccl_char_combustion") == 0) PCCL_char_combustion = value;if (strcmp(var,"pccl_soot_oxidation") == 0) PCCL_soot_oxidation = value;if (strcmp(var,"tar_oxidation") == 0) TAR_oxidation = value;if (strcmp(var,"mgas_gas_phase_oxidation") == 0) MGAS_gas_phase_oxidation = value;}static void SetValue(char * var , char * svalue) /* pan : oct 2012 ... replace entire function */{char * pEnd;double value = strtod(svalue,&pEnd);if (strcmp(var,"fc_ar") == 0) fc_ar = value;if (strcmp(var,"vm_ar") == 0) vm_ar = value;if (strcmp(var,"ash_ar") == 0) ash_ar = value;if (strcmp(var,"moist_ar") == 0) moist_ar = value;/* NOTE:If the two stage devolatilization model is not used, A2 and E2 have to be set to zero*/if (strcmp(var,"a1_devolatilization") == 0) A1_devolatilization = value;if (strcmp(var,"e1_devolatilization") == 0) E1_devolatilization = value;if (strcmp(var,"a2_devolatilization") == 0) A2_devolatilization = value;if (strcmp(var,"e2_devolatilization") == 0) E2_devolatilization = value;/* if (strcmp(var,"c3m_aem") == 0) c3m_aem = value; should not be used pan : Oct 2012 */if (strcmp(var,"a_tar_cracking") == 0) A_tar_cracking = value;if (strcmp(var,"e_tar_cracking") == 0) E_tar_cracking = value;if (strcmp(var,"a_steam_gasification") == 0) A_steam_gasification = value;if (strcmp(var,"e_steam_gasification") == 0) E_steam_gasification = value;if (strcmp(var,"annealing_steam_gasification") == 0) Annealing_steam_gasification = value;if (strcmp(var,"k_steam_gasification") == 0) K_steam_gasification = value;if (strcmp(var,"n_steam_gasification") == 0) N_steam_gasification = value;if (strcmp(var,"a_co2_gasification") == 0) A_co2_gasification = value;if (strcmp(var,"e_co2_gasification") == 0) E_co2_gasification = value;if (strcmp(var,"annealing_co2_gasification") == 0) Annealing_co2_gasification = value;if (strcmp(var,"k_co2_gasification") == 0) K_co2_gasification = value;if (strcmp(var,"n_co2_gasification") == 0) N_co2_gasification = value;if (strcmp(var,"a_h2_gasification") == 0) A_h2_gasification = value;if (strcmp(var,"e_h2_gasification") == 0) E_h2_gasification = value;if (strcmp(var,"annealing_h2_gasification") == 0) Annealing_h2_gasification = value;if (strcmp(var,"n_h2_gasification") == 0) N_h2_gasification = value;if (strcmp(var,"a_soot_steam_gasification") == 0) A_soot_steam_gasification = value;if (strcmp(var,"e_soot_steam_gasification") == 0) E_soot_steam_gasification = value;if (strcmp(var,"annealing_soot_steam_gasification") == 0) Annealing_soot_steam_gasification = value;if (strcmp(var,"k_soot_steam_gasification") == 0) K_soot_steam_gasification = value;if (strcmp(var,"n_soot_steam_gasification") == 0) N_soot_steam_gasification = value;if (strcmp(var,"a_soot_co2_gasification") == 0) A_soot_co2_gasification = value;if (strcmp(var,"e_soot_co2_gasification") == 0) E_soot_co2_gasification = value;if (strcmp(var,"annealing_soot_co2_gasification") == 0) Annealing_soot_co2_gasification = value;if (strcmp(var,"k_soot_co2_gasification") == 0) K_soot_co2_gasification = value;if (strcmp(var,"n_soot_co2_gasification") == 0) N_soot_co2_gasification= value;if (strcmp(var,"a_soot_h2_gasification") == 0) A_soot_h2_gasification = value;if (strcmp(var,"e_soot_h2_gasification") == 0) E_soot_h2_gasification = value;if (strcmp(var,"annealing_soot_h2_gasification") == 0) Annealing_soot_h2_gasification = value;if (strcmp(var,"n_soot_h2_gasification") == 0) N_soot_h2_gasification = value;if (strcmp(var,"a_soot_combustion") == 0) A_Soot_Combustion = value;if (strcmp(var,"e_soot_combustion") == 0) E_Soot_Combustion = value;if (strcmp(var,"a_c_combustion") == 0) A_c_combustion = value;if (strcmp(var,"e_c_combustion") == 0) E_c_combustion = value;if (strcmp(var,"n_c_combustion") == 0) N_c_combustion = value;if (strcmp(var,"annealing_c_combustion") == 0) Annealing_c_combustion = value;if (strcmp(var,"a_moisture_release") == 0) A_moisture_release = value;if (strcmp(var,"e_moisture_release") == 0) E_moisture_release = value;if (strcmp(var,"c3m_wg3") == 0) wg3 = value;if (strcmp(var,"moisture_flux") == 0) Moisture_Flux = value;/* if (strcmp(var,"c3m_ae5") == 0) c3m_ae5 = value; pan : Oct 2012 ... should not be used */}void read_c3m_data(){CX_Message("start of read_c3m_data \n");FILE * pFile;char line[80];char field1[80];char field2[80];char *pch;int i , field_index;pFile = fopen("fluent_c3m_udf.inp","r");if (pFile != NULL){CX_Message("fopen OK \n");char * pEnd = line;while (pEnd != NULL){/* CX_Message("read a line - start \n"); */pEnd = fgets(line,80,pFile);if (pEnd != NULL){for (i=0; i<80; ++i) line[i] = tolower(line[i]);pch = strtok(line," ,\t\n=");field_index = 0;while (pch != NULL){if (field_index == 0){strcpy(field1,pch);field_index = 1;/* CX_Message("token %s \n",field1); */}else{strcpy(field2,pch);field_index = 0;SetValue(field1,field2);SetBooleanValue(field1,field2); /* pan : Oct 2012 *//*CX_Message("\n\n");CX_Message("token %s \n",field1);CX_Message("token %s \n",field2);*/}pch = strtok(NULL," ,\t\n=");}}}fclose(pFile);}。
fluent中离散相项模型中udf的使用
《深度探讨:fluent中离散相项模型中udf的使用》在使用fluent进行离散相项模拟的过程中,用户定义函数(User Defined Function,UDF)的使用是非常重要的一环。
本文将从简单到复杂的方式,深入探讨在fluent中离散相项模型中UDF的使用,以帮助读者更全面地理解这一主题。
1. UDF在fluent中的基本原理在fluent中,用户定义函数是指用户可以编写自己的代码,并将其嵌入到fluent的求解过程中。
这样可以实现一些fluent本身不具备的功能,进而拓展了fluent的应用范围和灵活性。
在离散相项模拟中,UDF可以用于定义离散相的性质、参数和行为等,从而更精确地模拟实际工程问题。
2. UDF的基本结构和语法通常情况下,在fluent中定义UDF需要遵循一定的语法和结构。
需要包括必要的头文件引用、变量定义、函数定义等。
还需要注意在fluent中使用的特定关键词和函数,以确保UDF能够正确地嵌入到fluent的求解过程中,并得到正确的计算结果。
3. UDF在离散相项模拟中的具体应用UDF在离散相项模拟中可以发挥重要作用。
用户可以通过编写UDF来定义离散相的颗粒物性质,如密度、粘度等;或者定义离散相的边界条件,如离散相的速度场、温度场等。
通过合理地定义这些参数和条件,可以更准确地模拟离散相在流体中的运动和相互作用,从而得到更可靠的工程分析结果。
4. 我对UDF在fluent中的个人观点和理解作为一名工程师,我个人认为UDF在fluent中的使用是非常有价值的。
它可以帮助用户更灵活地定制自己的模拟模型,满足实际工程问题的需求。
尤其在离散相项模拟中,UDF的使用可以让模拟更加真实和可靠,对工程设计和优化有着重要意义。
总结回顾通过本文的深度探讨,我们对fluent中离散相项模型中UDF的使用有了更深入的了解。
我们从UDF的基本原理、结构和语法,到在离散相项模拟中的具体应用,进一步认识了UDF的重要性和价值。
【多相流】fluent中如何选择多相流模型?(2)
【多相流】fluent中如何选择多相流模型?(2)“长风破浪会有时,直挂云帆济沧海!”计算流体力学的发展为进一步了解多相流的动力学特性提供了基础。
目前多相流数值计算主要有两种方法:欧拉-拉格朗日法和欧拉-欧拉法。
01—fluent中的多相流模型在欧拉-欧拉方法中,不同的相在数学上被视为相互渗透的连续相。
由于某一相的体积不能被其他相所占据,因此引入了相体积分数的概念。
假设这些体积分数是空间和时间的连续函数,它们的和等于1。
推导出各相的守恒方程,得到各相具有相似结构的方程组。
这些方程通过提供从经验获得的本构关系而封闭,或者,在粒状流动的情况下,通过动力学理论的应用而封闭。
在ANSYS Fluent中,提供了三种欧拉多相流模型: volume of fluid (VOF) 模型, mixture模型, 和 Eulerian 模型。
•VOF模型VOF模型是一种应用于固定欧拉网格的表面跟踪技术。
VOF模型用于两种或多种不混溶的流体,而流体之间的界面位置是我们感兴趣的。
在VOF模型中,流体共享一组动量方程,并且在整个域中跟踪每个计算单元中每种流体的体积分数。
VOF模型可应用于:分层流动、自由表面流动、填充、晃动、大气泡在液体中的运动、溃坝后液体的运动、射流破裂的预测(表面张力)以及任何液-气界面的稳态或瞬态跟踪。
•Mixture模型混合模型可用于两种或两种以上的相(流体或颗粒)。
在欧拉模型中,相被视为相互渗透的连续体。
混合模型求解混合动量方程,用相对速度来描述分散相。
混合模型可应用于:低负荷颗粒流、气泡流、沉降和旋风分离器。
混合模型也可以用于没有相对速度的分散相来模拟均匀多相流。
•Eulerian模型欧拉模型是ANSYS Fluent中最复杂的多相流模型。
它要为每一项求解一系列的动量和连续性方程。
通过压力和相间交换系数实现了耦合。
处理这种耦合的方式取决于所涉及相的类型:颗粒状(流体-固体)流动与非颗粒状(流体-流体)流动的处理方法不同。
Fluent中的UDF详细中文教程(8)
Fluent中的UDF详细中文教程(8)第八章在FLUENT中激活你的UDF一旦你已经编译(并连接)了你的UDF,如第7章所述,你已经为在你的FLUENT模型中使用它做好了准备。
根据你所使用的UDF,遵照以下各节中的指导。
z8.1节激活通用求解器UDFz8.2节激活模型明确UDFz8.3节激活多相UDFz8.4节激活DPM UDF8.1 激活通用求解器UDF本节包括激活使用4.2节中宏的UDF的方法。
8.1.1 已计算值的调整一旦你已经使用7.2节和7.3节中概括的方法之一编译(并连接)了调整已计算值UDF,这一UDF在FLUENT中将成为可见的和可选择的。
你将需要在User-Defined Function Hooks面板的Adjust Function下拉菜单(图8.1.1)中选择它。
调整函数(以DEFINE_ADJUST宏定义)在速度、压力及其它数量求解开始之前的一次迭代开始的时候调用。
例如,它可以用于在一个区域内积分一个标量值,并根据这一结果调整边界条件。
有关DEFINE_ADJUST宏的更多内容将4.2.1节。
调整函数在什么地方适合求解器求解过程方面的信息见3.3节。
8.1.2 求解初始化一旦你已经使用7.2节和7.3节中概括的方法之一编译(并连接)了求解初始化UDF,这一UDF在FLUENT中将成为可见的和可选择的。
你将需要在User-Defined Function Hooks面板的Initialization Function下拉菜单(图8.1.1)中选择它。
求解初始化UDF使用DEFINE_INIT宏定义。
细节见4.2.2节。
8.1.3 用命令执行UDF一旦你已经使用7.2节和7.3节中概括的方法之一编译(并连接)了你的UDF,你可以在Execute UDF On Demand面板中选择它(图8.1.2),以在某个特定的时间执行这个UDF,而不是让FLUENT在整个计算中执行它。
5-1 FLUENT流体模拟-UDF-讲解解析
– 对面thread中所有面循环 begin_f_loop(f, f_thread) { … } end_f_loop(f, f_thread)
Fluid (cell thread or zone)
Cells Faces
为了在thread (zone)中获得数据,我们需要提供正确的指针,并 使用循环宏获得thread中的每个成员(cell or face)
A Pera Global Company © PERA China
UDF 数据结构(2)
DEFINE_PROFILE 宏允许定 义x_velocity函数 – 所有的UDFs 以 DEFINE_ 宏开始 – x_velocity 将在 GUI中 出现 – thread 和 nv DEFINE_PROFILE 宏的参 数, 分别用来识别域和变量 – begin_f_loop宏通过 thread指针,对所有的面f 循环 F_CENTROID宏赋单元位置向 量给 x[] F_PROFILE 宏在面 f上施加 速度分量 代码以文本文件保存 inlet_bc.c
A Pera Global Company © PERA China
DEFINE 宏
DEFINE 宏的例子
DEFINE_ADJUST(name,domain); general purpose UDF called every iteration DEFINE_INIT(name,domain); UDF used to initialize field variables DEFINE_ON_DEMAND(name); an „execute-on-demand‟ function DEFINE_RW_FILE(name,fp); customize reads/writes to case/data files DEFINE_PROFILE(name,thread,index); boundary profiles DEFINE_SOURCE(name,cell,thread,dS,index); equation source terms DEFINE_HEAT_FLUX(name,face,thread,c0,t0,cid,cir); heat flux DEFINE_PROPERTY(name,cell,thread); material properties DEFINE_DIFFUSIVITY(name,cell,thread,index); UDS and species diffusivities DEFINE_UDS_FLUX(name,face,thread,index); defines UDS flux terms DEFINE_UDS_UNSTEADY(name,cell,thread,index,apu,su); UDS transient terms DEFINE_SR_RATE(name,face,thread,r,mw,yi,rr); surface reaction rates DEFINE_VR_RATE(name,cell,thread,r,mw,yi,rr,rr_t); volumetric reaction rates DEFINE_SCAT_PHASE_FUNC(name,cell,face); scattering phase function for DOM DEFINE_DELTAT(name,domain); variable time step size for unsteady problems DEFINE_TURBULENT_VISCOSITY(name,cell,thread); calculates turbulent viscosity DEFINE_TURB_PREMIX_SOURCE(name,cell,thread,turbflamespeed,source); turbulent flame speed DEFINE_NOX_RATE(name,cell,thread,nox); NOx production and destruction rates
煤与生物质流化床共气化的CFD数值模拟研究综述
煤与生物质流化床共气化的CFD数值模拟研究综述摘要:气化技术作为固体燃料(如煤和生物质等)清洁利用的重要方式,越来越广泛地被应用于生产合成气的工程实践中。
针对煤与生物质在单独气化时存在转换效率低、气体产物热值低以及焦油含量高等问题,提出了共气化技术以改善气化工艺。
文中主要介绍了基于计算流体力学(CFD)的煤与生物质共气化仿真模拟的研究,论述了两种固体燃料在单独气化和共气化时的反应机理,并详细介绍了冷态和热态流化床共气化CFD模拟所用到的模型。
目前全球绝大多数能源均由传统化石燃料所提供。
随着能源需求量的不断增加,燃料资源总量也在日益减少,同时在煤等燃料的燃烧利用过程中会产生大量的NOx 、SO2以及颗粒物等污染物,会对环境造成严重的影响[1]。
所以,对资源进行更加清洁高效的利用是目前亟待研究和解决的问题。
在现有的能源利用技术中,气化则被视为传统能源清洁高效利用的重要方式之一[2],其中对煤与生物质的气化研究较为广泛,此外由于拥有较为适中的温度、物料粒径等条件,使得流化床气化成为活性较高的煤种与生物质等燃料气化的主要方式。
固体燃料流化床气化示意图及气化特点如图1所示。
在已发展较成熟的燃料单独气化技术的基础上,研究人员提出了煤与生物质的共气化技术[3]。
煤与生物质在共气化过程中产生了协同作用,弥补了两种燃料单独进行气化过程中的不足,打破了气化原料选择的限制,同时还可以提高气化时碳的反应速率,抑制焦油的生成并减少污染物的排放[4]。
所以共气化技术在将固体燃料转化为合成气的同时,提高了能源的利用率,并且减少了一部分化石能源的消耗。
由于生物质和煤的气化需要在900~1000℃的高温条件下进行,对实验设备有较高的要求。
此外,在对气化过程进行实验探究时,耗时较长,危险性也较高。
而通过计算流体力学(CFD)等数值模拟的方法则可以使得研究工作的成本较低,能节省更多的时间、人力和物力。
CFD在流化床中的应用主要有三个方面[5],分别是流化床结构设计与操作条件的优化;模拟流化床冷态气固两相流,研究其中颗粒流动的规律;模拟流化床中热态的化学耦合,建立热态化学反应模型。
fluent教程 燃烧模拟
组分输运方程中没有化学反应源项.
©燃烧
计算流体与传热传质
热科学与能源工程系 2003年10月
可以用单个混合物分数模拟的燃烧系统
Fuel/air 扩散火焰: 多氧化剂入口的扩散火焰: 多燃料进口的扩散火焰:
60% CH4 40% CO
气相燃烧
有限速率模型 (Magnussen model) 守恒标量的 PDF模型 (一个或两个混合分数) 层流火焰面(小火焰)模型 (V5) Zimont model (V5)
稀疏相模型
湍流颗粒弥散
随机轨道模型(Stochastic tracking) 颗粒云团模型(Particle cloud model) (V5)
求解组分的质量分数输运方程,化学反应机理由用户自己定 义。
非预混燃烧模型
该模型中并不求解单个组分的输运方程,而是求解一个或者 两个守恒标量(混合分数)的输运方程
预混燃烧模型
模拟完全混合的燃烧问题。充分混合的燃烧物和产物被火焰 前锋分隔,求解出的化学反应进展变量来描述该火焰前峰的位置 部分预混燃烧模型
实际处理方法
简化化学反应机理 有限速率燃烧模型
考虑湍流及其混合、弱化反应化学 混合分数模型
平衡化学的 PDF模型 层流火焰面模型
进展变量模型
Zimont 模型
©燃烧
计算流体与传热传质
热科学与能源工程系 2003年10月
有限速率模型
用总包机理反应描述化学反应过程. 求解化学组分输运方程.
计算流体与传热传质
FLUENT中组分输运及化学反应 (燃烧)模拟
热科学与能源工程系 2003年10月
Fluent软件模拟计算煤粉燃烧的机理及其模型实现的方式
4 过程与规则之间的关系
过 程 与 规 则 在 Fluent 计 算 中 的 调 用 关 系 是 UDF 二次开发的关键。 在 UDF 中, 获取当前颗粒 所处过程[ 8 ]的索引号是:
而为重写煤粉燃烧模型提供了基础。
关键词: Fluent; 煤粉; 燃烧; 数值计算; 规则; UDF
中图分类号: TK16
文献标志码: B
文章编号: 1007-1881(2010)11-0031-04
Mechanism and Model Realization of Pulverized Coal Combustion Simulation and Calculation with FLUENT
烧模型实现的方式。在详细说明煤粉单个颗粒燃烧每一步过程的含义和切换的条件后, 通过自编用户自
定义函数(UDF)深入研究了煤粉燃烧模型中颗粒跟踪数计算的方法、 过程之间的切换、 过程与规 则之
间的关系、 颗粒生命周期内最多调用自定义规则的数目以及过程规则的调用机理, 并用示意图的方式
加以说明。 通过研究可以深入掌握 Fluent 软件模拟计算煤粉燃烧的机理及其燃烧模型实现的方式, 从
2 颗粒跟踪数的计算方法
在 Fluent 中不同的煤粉颗粒射流类型(Injection Type)就有不同的计算颗粒跟踪数的方法。 目 前 比 较 常 用 的 Injection Type 按 以 下 几 种 情 况 划 分: 单个 颗粒 (Single)、 群 组 (Group)和 颗 粒 进 口 表面(Surface)等。 通过编写自定义 UDF, 掌握各 个类型颗粒跟踪数的计算方法。 2.1 Single 类型
FLUENT UDF代码_颗粒(煤或生物质)床层多相流燃烧过程数值模拟-【第1部分】
Fluent-UDF_Coal-Combustion-Multiphase-Flow-Processes ---Codes for various kinds of heterogeneous reactions【第一部分-Part1】#include "udf.h"#include "stdio.h"#include "time.h"#define SMALL_S 1.e-29#define eps_g_small 1.#define eps_s_small 1.e-6#define spe_small 1.e-6#define spe_small_comb 1.e-6#define TMAX 3000.#define TMIN 280.#define Rgas 1.987 /* cal/mol.K */ /*UNIVERSAL_GAS_CONSTANT;*/#define PR_NUMBER(cp,mu,k) ((cp)*(mu)/(k))#define IP_HEAT_COEFF(vofP,vofS,k,nu,d) ((vofP)*(vofS)*6.*(k)*(Nu)/(d)/(d))#define Carbon_Init_MF 0.541#define Volatile_Init_MF 0.418#define Moisture_Init_MF 0.026#define Ash_Init_MF (1.-Carbon_Init_MF-Volatile_Init_MF-Moisture_Init_MF)#define rho_c (1000.)#define rho_ash (2931)#define rho_liq_water (998.2)#define rho_volatile (1000.)#define solid_rho (1./(Carbon_Init_MF/rho_c+Volatile_Init_MF/rho_volatile+Moisture_Init_MF/rho_liq_water+Ash _Init_MF/rho_ash))/* Functions Defination */void SolidFuel_Reactant(cell_t c, Thread *t, Hetero_Reaction *hr, double* y_carbon, double* mol_weight);void volatile_mass_fractions();void SetSpeciesIndex();void read_c3m_data();double satPressure(double T);double Get_Phase_Index(Hetero_Reaction *hr);double Turbulent_rr(cell_t c, Thread *t, Hetero_Reaction *r, real yi[MAX_PHASES][MAX_SPE_EQNS]);double Mass_Transfer_Coeff(cell_t c, Thread *tp, Thread *ts);double heat_gunn_udf(cell_t c, Thread *ti, Thread *tj);double rr_combustion(cell_t c, Thread *t, Thread *ts, Thread *tp, double yi_O2, double y_ash, double y_carbon);double rr_steam_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double p_h2o, double p_co, double p_h2, double y_carbon, double mol_weight, double* direction);double rr_co2_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double y_co, double y_co2, double y_carbon, double mol_weight, double* direction);double rr_h2_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double y_h2, double y_ch4, double y_carbon, double mol_weight, double* direction);int IP_CH4 = 0, IS_CH4 = 0, IP_CO = 0, IS_CO = 0,IP_CO2 = 0, IS_CO2 = 0, IP_H2 = 0, IS_H2 = 0,IP_H2O = 0, IS_H2O = 0, IP_O2 = 0, IS_O2 = 0,IP_H2S = 0, IS_H2S = 0, IP_CL2 = 0, IS_CL2 = 0,IP_NH3 = 0, IS_NH3 = 0, IP_N2 = 0, IS_N2 = 0,IP_TAR = 0, IS_TAR = 0, IP_C = 0, IS_C = 0,IP_VOL = 0, IS_VOL = 0, IP_MOISTURE = 0, IS_MOISTURE = 0,IP_ASH = 0, IS_ASH = 0, IP_SOOT = 0, IS_SOOT = 0,IP_PAH = 0, IS_PAH = 0, IP_OIL = 0, IS_OIL = 0,IP_ASH_R = 0, IS_ASH_R = 0, IP_C_R = 0, IS_C_R = 0,IP_C2H2 = 0, IS_C2H2 = 0, IP_SLURRY = 0, IS_SLURRY = 0,IP_C2H4 = 0, IS_C2H4 = 0, IP_C2H6 = 0, IS_C2H6 = 0,IP_C3H6 = 0, IS_C3H6 = 0, IP_C3H8 = 0, IS_C3H8 = 0,IP_SLURRY_D = 0, IS_SLURRY_D = 0, IP_SAND = 0, IS_SAND = 0,IP_ASH_D = 0, IS_ASH_D = 0;int current_c3m_solid_phase = 0;cxboolean init_flag = TRUE;cxboolean PCCL_Devol = FALSE;cxboolean MGAS_Devol = FALSE;cxboolean CPD_Devol = FALSE;cxboolean FGDVC_Devol = FALSE;cxboolean HPTR_Devol = FALSE;cxboolean MGAS_Moisture = FALSE;cxboolean PCCL_Moisture = FALSE;cxboolean MGAS_TarCracking = FALSE;cxboolean PCCL_2nd_Pyro = FALSE;cxboolean MGAS_Gasif = FALSE;cxboolean PCCL_Gasif = FALSE;cxboolean PCCL_TarCracking = FALSE;cxboolean MGAS_WGS = FALSE;cxboolean PCCL_soot_gasif = FALSE;cxboolean MGAS_char_combustion = FALSE;cxboolean PCCL_char_combustion = FALSE;cxboolean PCCL_soot_oxidation = FALSE;cxboolean TAR_oxidation = FALSE;cxboolean MGAS_gas_phase_oxidation = FALSE;doubleavg_mf_h2o,avg_mf_co,avg_mf_h2,avg_mf_ch4,avg_mf_co2,avg_c,avg_volatile,avg_moisture,av g_ash;/* coal analysis variables */double fc_ar=0.,vm_ar=0.,ash_ar=0.,moist_ar=0.;double f_ep_a = 0.;double mw[MAX_PHASES][MAX_SPE_EQNS];double A1_devolatilization=0.0, E1_devolatilization=0.0; /* pan : Oct 2012 */double A2_devolatilization=0.0, E2_devolatilization=0.0; /* pan : Oct 2012 */double A_tar_cracking=0.0 , E_tar_cracking=0.0;double A_steam_gasification=0.0, E_steam_gasification=0.0;double K_steam_gasification=0.0, N_steam_gasification=0.0; /* pan : Oct 2012 */double Annealing_steam_gasification=1.0; /* pan : Oct 2012 */double A_co2_gasification=0.0, E_co2_gasification=0.0;double K_co2_gasification=0.0, N_co2_gasification=0.0; /* pan : Oct 2012 */double Annealing_co2_gasification=1.0; /* pan : Oct 2012 */double A_h2_gasification=0.0, E_h2_gasification=0.0;double N_h2_gasification=0.0; /* pan : Oct 2012 */double Annealing_h2_gasification=1.0; /* pan : Oct 2012 */double A_soot_steam_gasification=0.0, E_soot_steam_gasification=0.0; /* pan : oct 2012 */ double K_soot_steam_gasification=0.0, N_soot_steam_gasification=0.0; /* pan : Oct 2012 */ double Annealing_soot_steam_gasification=0.0; /* pan : Oct 2012 */double A_soot_co2_gasification=0.0, E_soot_co2_gasification=0.0; /* pan : Oct 2012 */ double K_soot_co2_gasification=0.0, N_soot_co2_gasification=0.0; /* pan : Oct 2012 */ double Annealing_soot_co2_gasification=0.0; /* pan : Oct 2012 */double A_soot_h2_gasification=0.0, E_soot_h2_gasification=0.0; /* pan : Oct 2012 */ double N_soot_h2_gasification=0.0; /* pan : Oct 2012 */double Annealing_soot_h2_gasification=0.0; /* pan : Oct 2012 */double A_Soot_Combustion = 0.0, E_Soot_Combustion = 0.0;double A_c_combustion = 8710. /* g/(atm.cm^2.s) */, E_c_combustion = 27000. /* cal/mole */; double Annealing_c_combustion=0.0 , N_c_combustion=0.0; /* pan : Oct 2012 */double A_moisture_release = 0.0, E_moisture_release = 0.0;double wg3 = 0.014;double Moisture_Flux;DEFINE_ADJUST(gasification,domain){if(init_flag){#if !RP_HOSTif(0) SetSpeciesIndex();#endif#if !RP_NODEvolatile_mass_fractions();#endifhost_to_node_real_5(fc_ar,vm_ar,ash_ar,moist_ar,f_ep_a);host_to_node_int_4(PCCL_Devol,MGAS_Devol,MGAS_Moisture,PCCL_2nd_Pyro);host_to_node_int_3(MGAS_Gasif,PCCL_Gasif,PCCL_Moisture);host_to_node_int_3(CPD_Devol,FGDVC_Devol,HPTR_Devol); /* pan : Oct 2012 */host_to_node_int_3(PCCL_TarCracking,MGAS_WGS,PCCL_soot_gasif); /* pan : Oct 2012 */host_to_node_int_1(PCCL_char_combustion); /* pan : Oct 2012 */host_to_node_int_3(MGAS_char_combustion,TAR_oxidation,MGAS_gas_phase_oxidation); /* pan : Oct 2012 */host_to_node_real_2(A_moisture_release, E_moisture_release);host_to_node_real_2(A1_devolatilization, E1_devolatilization); /* pan : Oct 2012 ... added the "1" */host_to_node_real_2(A2_devolatilization, E2_devolatilization); /* pan : Oct 2012 */host_to_node_real_2(A_tar_cracking, E_tar_cracking);host_to_node_real_2(A_steam_gasification, E_steam_gasification);host_to_node_real_2(K_steam_gasification, N_steam_gasification); /* pan : Oct 2012 */host_to_node_real_1(Annealing_steam_gasification);/* pan : Oct 2012 */host_to_node_real_2(A_co2_gasification, E_co2_gasification);host_to_node_real_2(K_co2_gasification, N_co2_gasification); /* pan : Oct 2012 */host_to_node_real_1(Annealing_co2_gasification);/* pan : Oct 2012 */host_to_node_real_2(A_h2_gasification, E_h2_gasification);host_to_node_real_2(Annealing_h2_gasification, N_h2_gasification); /* pan : Oct 2012 */host_to_node_real_2(A_soot_steam_gasification, E_soot_steam_gasification); /* pan : Oct 2012 */host_to_node_real_2(K_soot_steam_gasification, N_soot_steam_gasification); /* pan : Oct 2012 */host_to_node_real_1(Annealing_soot_steam_gasification);/* pan : Oct 2012 */host_to_node_real_2(A_soot_co2_gasification, E_soot_co2_gasification); /* pan : Oct 2012 */host_to_node_real_2(K_soot_co2_gasification, N_soot_co2_gasification); /* pan : Oct 2012 */host_to_node_real_1(Annealing_soot_co2_gasification);/* pan : Oct 2012 */host_to_node_real_2(A_soot_h2_gasification, E_soot_h2_gasification); /* pan : Oct 2012 */host_to_node_real_2(Annealing_soot_h2_gasification, N_soot_h2_gasification); /* pan : Oct 2012 */host_to_node_real_2(A_Soot_Combustion, E_Soot_Combustion);host_to_node_real_2(A_c_combustion, E_c_combustion); /* pan : Oct 2012 */host_to_node_real_2(N_c_combustion, Annealing_c_combustion); /* pan : Oct 2012 */host_to_node_real_2(wg3,Moisture_Flux);init_flag = FALSE;} /* end init_flag */}DEFINE_ON_DEMAND(Devol_and_Tar_Cracking){#if !RP_NODEvolatile_mass_fractions();#endif}void SetSpeciesIndex(){Domain *domain = Get_Domain(1);int n, ns, MAX_SPE_EQNS_PRIM = 0;Domain *subdomain;/*int n_phases = DOMAIN_N_DOMAINS(domain);*//* search all the species and saved the Molecular Weight */sub_domain_loop(subdomain, domain, n){Material *m_mat, *s_mat;if (DOMAIN_NSPE(subdomain) > 0){m_mat = Pick_Material(DOMAIN_MATERIAL_NAME(subdomain),NULL);mixture_species_loop(m_mat,s_mat,ns){if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"ch4")){IP_CH4 = n;IS_CH4 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"co")){IP_CO = n;IS_CO = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"c2h2")){IP_C2H2 = n;IS_C2H2 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"c2h4")){IP_C2H4 = n;IS_C2H4 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"c2h6")){IP_C2H6 = n;IS_C2H6 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"c3h6")){IP_C3H6 = n;IS_C3H6 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"c3h8")){IP_C3H8 = n;IS_C3H8 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"co2")){IP_CO2 = n;IS_CO2 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"h2")){IP_H2 = n;IS_H2 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"h2o")){IP_H2O = n;IS_H2O = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"o2")){IP_O2 = n;IS_O2 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"h2s")){IP_H2S = n;IS_H2S = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"cl2")){IP_CL2 = n;IS_CL2 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"nh3")){IP_NH3 = n;IS_NH3 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"n2")){IP_N2 = n;IS_N2 = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"oil")){IP_OIL = n;IS_OIL = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"pah")){IP_PAH = n;IS_PAH = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"tar")){IP_TAR = n;IS_TAR = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"c")){IP_C = n;IS_C = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"c_recycle")){IP_C_R = n;IS_C_R = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"soot")){IP_SOOT = n;IS_SOOT = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"volatile")){IP_VOL = n;IS_VOL = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"h2o<l>")){IP_MOISTURE = n;IS_MOISTURE = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"h2o<l>-slurry")){IP_SLURRY = n;IS_SLURRY = ns;mw[n][ns] = MATERIAL_PROP(s_mat,PROP_mwi);}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"h2o<l>-dummy")){IP_SLURRY_D = n;IS_SLURRY_D = ns;mw[n][ns] = MATERIAL_PROP(s_mat,PROP_mwi);}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"ash-coal")){IP_ASH = n;IS_ASH = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"ash-dummy")){IP_ASH_D = n;IS_ASH_D = ns;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"ash-recycle")){IP_ASH_R = n;IS_ASH_R = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}else if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"si<s>")){IP_SAND = n;IS_SAND = ns;if(n == 0)MAX_SPE_EQNS_PRIM +=1;}mw[n][ns] = MATERIAL_PROP(s_mat,PROP_mwi);}}else{s_mat = Pick_Material(DOMAIN_MATERIAL_NAME(subdomain),NULL);mw[n][0] = MATERIAL_PROP(s_mat,PROP_mwi);}}}DEFINE_HET_RXN_RATE(moisture_release,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */double prod = 0.0, Ts = C_T(c,ts);double Pt = MAX(0.1,(op_pres+C_P(c,t)));double Tsat = 1./(0.0727/log(Pt/611.) - 0.0042) + 273.;*rr = 0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if(C_VOF(c, ts) > 0.0 && Ts >= Tsat){if(MGAS_Moisture){prod = yi[IP_MOISTURE][IS_MOISTURE]*C_R(c,ts)/mw[IP_MOISTURE][IS_MOISTURE]; /* kg-mol/m^3*/ A_moisture_release = A1_devolatilization;E_moisture_release = E1_devolatilization;*rr = A_moisture_release*exp(-E_moisture_release/(Rgas*Ts)) * prod*C_VOF(c, ts); /* kmol/(m3.s) */}if(PCCL_Moisture){*rr = 6. * C_VOF(c, ts) / C_PHASE_DIAMETER(c,ts) * Moisture_Flux /mw[IP_MOISTURE][IS_MOISTURE] ; /* kmol/(m3.s) */}}}DEFINE_HET_RXN_RATE(devolatilization,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */double x0_star = 0., x_star =0.;double Ts = C_T(c,ts);*rr = 0.0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();/*Volatile Matter --> c1 Tar + c2 CO + c3 CO2 + c4 CH4 + c5 H2 + c6 H2O + c7 H2S + c8 NH3*/if(C_YI(c,ts,IS_MOISTURE) < spe_small){if(MGAS_Devol){if(Ts<1223)x0_star = pow((867.2/MAX((Ts-273.),1.)),3.914) / 100.;x_star = solid_rho * (fc_ar/100. + vm_ar/100.)/C_R(c,ts) * x0_star;A2_devolatilization = 0.0;E2_devolatilization = 0.0;}if((PCCL_Devol || CPD_Devol || FGDVC_Devol || HPTR_Devol) && yi[IP_VOL][IS_VOL] > x_star){*rr = (A1_devolatilization *exp(-E1_devolatilization/(1.987*Ts)) + A2_devolatilization *exp(-E2_devolatilization/(1.987*Ts)))*(yi[IP_VOL][IS_VOL]-x_star)*C_VOF(c,ts)*C_R(c,ts)/mw[IP_VOL][IS_VOL];}}}DEFINE_HET_RXN_RATE(tar_comb,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */double T_g = MAX(TMIN, C_T(c,tp));double rho_g = C_R(c,tp)*1.e-3; /* g/cm^3 */double rr_turb = 1e+20;*rr = 0.0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);if(yi[IP_O2][IS_O2] > spe_small_comb){double tmp_exp, tmp_o2, tmp_tar;T_g = MIN(T_g, TMAX);tmp_exp = 3.8e11 * exp(-30000./(Rgas*T_g)); /* 30000 ---> 60000*/tmp_o2 = pow(rho_g*yi[IP_O2][IS_O2]/mw[IP_O2][IS_O2],1.5);tmp_tar = pow(rho_g*yi[IP_TAR][IS_TAR]/mw[IP_TAR][IS_TAR],0.25);*rr = tmp_exp * tmp_o2 * tmp_tar * C_VOF(c,tp); /* mol/cm^3.s */*rr *= 1000.; /* kmol/(m^3 .s) */*rr = MIN(*rr, rr_turb);}}DEFINE_HET_RXN_RATE(tar_cracking,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */double prod = 0.0;double T_g = MAX(TMIN, C_T(c,tp));double rr_turb = 1e+20;*rr = 0.0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);if(yi[IP_TAR][IS_TAR] > spe_small){prod = yi[IP_TAR][IS_TAR]*C_R(c,tp)*C_VOF(c,tp)/mw[IP_TAR][IS_TAR];*rr = A_tar_cracking*exp(-E_tar_cracking/(1.987*T_g))* prod*C_VOF(c, tp); /* kmol/(m3.s) */}}DEFINE_HET_RXN_RATE(co_comb,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */double T_g = MAX(TMIN, C_T(c,tp));double rho_g = C_R(c,tp)*1.e-3; /* g/cm^3 */double rr_turb = 1e+20;*rr = 0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if(yi[IP_O2][IS_O2] > spe_small_comb){double tmp_exp, p_o2, p_co, p_h2o;if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);T_g = MIN(T_g, TMAX);tmp_exp = 3.98e+14 * exp(-40000./(Rgas*T_g)); /*40000 ---> 80000 */p_o2 = pow(rho_g*yi[IP_O2][IS_O2]/mw[IP_O2][IS_O2],0.25);p_co = rho_g*yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO];p_h2o = pow(rho_g*yi[IP_H2O][IS_H2O]/mw[IP_H2O][IS_H2O], 0.5);*rr = tmp_exp * p_o2 * p_co * p_h2o * C_VOF(c,tp); /* mol/cm^3.s */*rr *= 1000.; /* kmol/(m^3 .s) */*rr = MIN(*rr, rr_turb);}}DEFINE_HET_RXN_RATE(ch4_comb,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */double T_g = MAX(TMIN, C_T(c,tp));double rho_g = C_R(c,tp)*1.e-3; /* g/cm^3 */double rr_turb = 1e+20;*rr = 0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if(yi[IP_O2][IS_O2] > spe_small_comb){double p_o2, p_ch4;if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);T_g = MIN(T_g, TMAX);p_o2 = pow(rho_g*yi[IP_O2][IS_O2]/mw[IP_O2][IS_O2],1.3);p_ch4 = pow(rho_g*yi[IP_CH4][IS_CH4]/mw[IP_CH4][IS_CH4],0.2);*rr = 6.7e12 * exp(-48400./(Rgas*T_g)) * p_o2 * p_ch4 * C_VOF(c,tp); /* mol/cm^3.s */*rr *= 1000.; /* kmol/(m^3 .s) */*rr = MIN(*rr, rr_turb);}}DEFINE_HET_RXN_RATE(h2_comb,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */double T_g = MAX(TMIN, C_T(c,tp));double rho_g = C_R(c,tp)*1.e-3; /* g/cm^3 */double rr_turb = 1e+20;*rr = 0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if(yi[IP_O2][IS_O2] > spe_small_comb){double tmp_exp, tmp_o2, tmp_h2;if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);T_g = MIN(T_g, TMAX);tmp_exp = 1.08e16 * exp(-30000./(Rgas*T_g)); /* 30000 ----> 60000 cal/mole */ /* cm3/gmole-s */tmp_o2 = rho_g*yi[IP_O2][IS_O2]/mw[IP_O2][IS_O2]; /* gmole/cm3 */tmp_h2 = rho_g*yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2]; /* gmole/cm3 */*rr = tmp_exp * tmp_o2 * tmp_h2 * C_VOF(c,tp); /* mol/cm^3.s */*rr *= 1000.; /* kmol/(m^3 .s) */*rr = MIN(*rr, rr_turb);}}DEFINE_HET_RXN_RATE(WGS_char,c,t,hr,mw,yi,rr,rr_t){Domain *domain = Get_Domain(1);Domain *subdomain;Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */double T_g = C_T(c,tp), f3 = 0., k3=1.;double Pt = MAX(0.1,(op_pres+C_P(c,t))/101325);double p_co = 0., p_h2o = 0., p_co2 = 0., p_h2=0., sum = 0.0;int phase_domain_index, ns;double rr_turb = 1e+20;*rr = 0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();sub_domain_loop(subdomain, domain, phase_domain_index){if(phase_domain_index > 0){Thread *ts = pt[phase_domain_index]; /* solid phase */Material *m_mat, *s_mat;if (DOMAIN_NSPE(subdomain) > 0){m_mat = Pick_Material(DOMAIN_MATERIAL_NAME(subdomain),NULL);mixture_species_loop(m_mat,s_mat,ns){if (0 == strcmp(MIXTURE_SPECIE_NAME(m_mat,ns),"ash-coal")){sum +=C_VOF(c,ts)*C_YI(c,ts,IS_ASH)*C_R(c,ts)*1.e-3;}}}}}if (rp_ke)rr_turb = Turbulent_rr(c, t, hr, yi);if(C_VOF(c, tp) < 1.0){T_g = MIN(T_g, TMAX);f3 = sum *exp(-8.91+5553/T_g);k3 = exp( -3.63061 + 3955.71/T_g );p_co = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp)* yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO] / 101325.;p_co2 = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp)* yi[IP_CO2][IS_CO2]/mw[IP_CO2][IS_CO2] / 101325.;p_h2o = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp)* yi[IP_H2O][IS_H2O]/mw[IP_H2O][IS_H2O] / 101325.;p_h2 = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp)* yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;*rr = 2.877e+5 * wg3 * f3 * pow (Pt, 0.5-Pt/250.) * exp(-27760/Rgas/T_g)*(p_co * p_h2o /Pt/Pt - p_co2 * p_h2 /Pt/Pt / k3) * C_VOF(c,tp); /* mol/cm^3.s */*rr *= 1000.; /* kmol/(m^3 .s) */*rr = MIN(*rr, rr_turb);}}DEFINE_HET_RXN_RATE(soot_comb,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */double T_g = MIN(TMAX, MAX(TMIN, C_T(c,tp)));double rr_turb = 1e+20;double soot_dia = 8.e-6;*rr = 0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double y_o2 = yi[IP_O2][IS_O2];if(y_o2 > spe_small_comb){double tmp1_exp, tmp2_exp;if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);double P_o2 = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * T_g*y_o2/mw[IP_O2][IS_O2]/ 101325.;tmp1_exp = 240.*exp(-15100./T_g)*P_o2/(1.+21.3*exp(2060./T_g));tmp2_exp = 5.35e-2*exp(-7640./T_g)*P_o2;double tmp3_exp = 1.51e5*exp(-48800./T_g);double tmp4_exp = 4.46e-3*exp(-7640./T_g)*P_o2;double chi = tmp4_exp/(tmp3_exp+tmp4_exp);double prod = tmp1_exp*chi+tmp2_exp*(1.-chi); /* g/cm2-s */prod *= 10.; /* kg/m2-s */*rr = (6.*C_VOF(c, tp)/soot_dia)*prod/mw[IP_SOOT][IS_SOOT]; /* kmol/m^3.s */*rr = MIN(*rr, rr_turb);}}DEFINE_HET_RXN_RATE(SteamGasif,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon;/*C(s) + H2O ---> CO + H2Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done bythe firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_h2o = RoRT * yi[IP_H2O][IS_H2O]/mw[IP_H2O][IS_H2O]/ 101325.;double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO] / 101325.;double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;SolidFuel_Reactant(c, t, hr, &y_carbon, &mol_weight);if(C_VOF(c, ts) >= eps_s_small){*rr = rr_steam_gasif(c, t, ts, tp, p_h2o, p_co, p_h2, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction < 0.0) /* negative value implies reverse steam gasification */*rr = 0.0;}}DEFINE_HET_RXN_RATE(Soot_H2O_Gasif,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */*rr = 0;double rr_turb = 1e+20;double T_g = MIN((MAX(TMIN,C_T(c,tp))),TMAX);/*1/25 Soot + H2O ---> CO + H2Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_h2o = RoRT * yi[IP_H2O][IS_H2O]/mw[IP_H2O][IS_H2O]/ 101325.;double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);double prod = yi[IP_SOOT][IS_SOOT]*(C_R(c,tp)*1e-03)/mw[IP_SOOT][IS_SOOT]*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */*rr = A_soot_steam_gasification*exp(-E_soot_steam_gasification/Rgas/T_g)* Annealing_soot_steam_gasification * prod *pow(p_h2o, N_soot_steam_gasification)/(1.+K_soot_steam_gasification*p_h2); /* mol/cm^3.s */*rr *= 1000.; /* kmol/(m^3 .s) */*rr = MIN(*rr, rr_turb);}。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Fluent-UDF_Coal-Combustion-Multiphase-Flow-Processes ---Codes for various kinds of heterogeneous reactions【第二部分-Part2】DEFINE_HET_RXN_RATE(SteamGasif_Rev_MGAS,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon, rr_turb = 1e+20;/*CO + H2 ---> H2O + 1/25 SootThe reverse steam gasification reaction, which is CO + H2 ---> 1/25 Soot + H2O is written as the reactionshown above. So a negative rate means CO and H2 is consumed and H2O and Soot are generated. Note that noC(s) is generated, the stoich coeff for C(s) in the above reation is zero.Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if(MGAS_Gasif){double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_h2o = RoRT * yi[IP_H2O][IS_H2O]/mw[IP_H2O][IS_H2O]/ 101325.;double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO] / 101325.;double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;y_carbon = yi[IP_SOOT][IS_SOOT];mol_weight = mw[IP_SOOT][IS_SOOT];if (rp_ke)rr_turb = Turbulent_rr(c, t, hr, yi);if(C_VOF(c, ts) >= eps_s_small){*rr = rr_steam_gasif(c, t, ts, tp, p_h2o, p_co, p_h2, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction > 0.0) /* positive value implies C(s) + H2O ---> CO + H2 */*rr = 0.0;else /* negative value implies CO + H2 ---> H2O + 1/25 Soot */{*rr = abs(*rr);*rr = MIN(*rr, rr_turb);}}}}double rr_steam_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double p_h2o, double p_co, double p_h2, double y_carbon, double mol_weight, double* direction){double rate, prod, T_g = MIN((MAX(TMIN,C_T(c,tp))),TMAX);double p_h2o_star = p_h2 * p_co / ( exp(17.29 - 16326/T_g) );if(MGAS_Gasif) *direction = p_h2o - p_h2o_star;if(PCCL_Gasif) *direction = pow(p_h2o, N_steam_gasification)/(1.+K_steam_gasification*p_h2);prod = y_carbon*(C_R(c,ts)*1e-03)/mol_weight*C_VOF(c,ts); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */if(MGAS_Gasif && *direction < 0.0) /* this implies reverse H2O gasification */prod = y_carbon*(C_R(c,tp)*1e-03)/mol_weight*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */rate = A_steam_gasification*exp(-E_steam_gasification/Rgas/T_g)* Annealing_steam_gasification * prod * *direction; /* mol/cm^3.s */rate *= 1000.; /* kmol/(m^3 .s) */return rate;}DEFINE_HET_RXN_RATE(Co2Gasif,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon;/*C(s) + CO2 ---> 2COSet the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO] / 101325.;double p_co2 = RoRT * yi[IP_CO2][IS_CO2]/mw[IP_CO2][IS_CO2] / 101325.;SolidFuel_Reactant(c, t, hr, &y_carbon, &mol_weight);if(C_VOF(c, ts) >= eps_s_small){*rr = rr_co2_gasif(c, t, ts, tp, p_co, p_co2, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction < 0.0) /* negative implies reverse steam gasification */*rr = 0.0;}}DEFINE_HET_RXN_RATE(Soot_CO2_Gasif,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */*rr = 0;double rr_turb = 1e+20;double T_g = MIN((MAX(TMIN,C_T(c,tp))),TMAX);/*1/25 Soot + CO2 ---> 2COSet the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO]/ 101325.;double p_co2 = RoRT * yi[IP_CO2][IS_CO2]/mw[IP_CO2][IS_CO2] / 101325.;if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);double prod = yi[IP_SOOT][IS_SOOT]*(C_R(c,tp)*1e-03)/mw[IP_SOOT][IS_SOOT]*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */*rr = A_soot_co2_gasification*exp(-E_soot_co2_gasification/Rgas/T_g)* Annealing_soot_co2_gasification * prod *pow(p_co2, N_soot_co2_gasification)/(1.+K_soot_co2_gasification*p_co); /* mol/cm^3.s */*rr *= 1000.; /* kmol/(m^3 .s) */*rr = MIN(*rr, rr_turb);}DEFINE_HET_RXN_RATE(Co2Gasif_Rev_MGAS,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon, rr_turb = 1e+20;/*2CO ---> CO2 + 1/25 SootThe reverse CO2 gasification reaction, which is 2CO ---> 1/25 Soot + CO2 is written as the reactionshown above. So a negative rate means CO is consumed and CO2 and Soot are generated. Note that noC(s) is generated, the stoich coeff for C(s) in the above reation is zero.Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if(MGAS_Gasif){double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO] / 101325.;double p_co2 = RoRT * yi[IP_CO2][IS_CO2]/mw[IP_CO2][IS_CO2] / 101325.;y_carbon = yi[IP_SOOT][IS_SOOT];mol_weight = mw[IP_SOOT][IS_SOOT];if (rp_ke)rr_turb = Turbulent_rr(c, t, hr, yi);if(C_VOF(c, ts) >= eps_s_small){*rr = rr_co2_gasif(c, t, ts, tp, p_co, p_co2, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction > 0.0) /* positive value implies C(s) + CO2 ---> 2CO */*rr = 0.0;else /* negative value implies 2CO ---> CO2 + 1/25 Soot */{*rr = abs(*rr);*rr = MIN(*rr, rr_turb);}}}}double rr_co2_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double p_co, double p_co2, double y_carbon, double mol_weight, double* direction){double T_g = MIN(MAX(TMIN,C_T(c,tp)), TMAX), prod;double p_co2_star = p_co * p_co/(exp(20.92 - 20282/T_g));if(MGAS_Gasif) *direction = p_co2-p_co2_star;if(PCCL_Gasif) *direction = pow(p_co2, N_co2_gasification)/(1. + K_co2_gasification * p_co);prod = y_carbon*C_R(c,ts)*1.e-3/mol_weight* C_VOF(c,ts); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */if(MGAS_Gasif && *direction < 0.0) /* this implies reverse CO2 gasification */prod = y_carbon*(C_R(c,tp)*1e-03)/mol_weight*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */double rate = A_co2_gasification*exp(-E_co2_gasification/Rgas/T_g)*Annealing_co2_gasification * prod * (*direction); /* mol/cm^3.s */rate *= 1000.; /* kmol/(m^3 .s) */return rate;}DEFINE_HET_RXN_RATE(H2Gasif,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon;/*1/2 C(s) + H2 ---> 1/2 CH4Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done bythe firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;double p_ch4 = RoRT * yi[IP_CH4][IS_CH4]/mw[IP_CH4][IS_CH4] / 101325.;SolidFuel_Reactant(c, t, hr, &y_carbon, &mol_weight);if(C_VOF(c, ts) >= eps_s_small){*rr = rr_h2_gasif(c, t, ts, tp, p_h2, p_ch4, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction < 0.0) /* negative implies reverse steam gasification */*rr = 0.0;}}DEFINE_HET_RXN_RATE(Soot_H2_Gasif,c,t,r,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */*rr = 0;double rr_turb = 1e+20;double T_g = MIN((MAX(TMIN,C_T(c,tp))),TMAX);/*1/25 Soot + 2H2 ---> CH4Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;if (rp_ke)rr_turb = Turbulent_rr(c, t, r, yi);double prod = yi[IP_SOOT][IS_SOOT]*(C_R(c,tp)*1e-03)/mw[IP_SOOT][IS_SOOT]*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */*rr = A_soot_h2_gasification*exp(-E_soot_h2_gasification/Rgas/T_g)* Annealing_soot_h2_gasification * prod *pow(p_h2, N_soot_h2_gasification); /* mol/cm^3.s */*rr *= 1000.; /* kmol/(m^3 .s) */*rr = MIN(*rr, rr_turb);}DEFINE_HET_RXN_RATE(H2Gasif_Rev_MGAS,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */*rr = 0;double direction = 0.0, mol_weight, y_carbon, rr_turb = 1e+20;/*1/2 CH4 ---> H2 + (0.5)*1/25 SootThe reverse H2 gasification reaction, which is 1/2 CH4 ---> 1/25 Soot + H2 is written as the reactionshown above. So a negative rate means CH4 is consumed and H2 and Soot are generated. Note that noC(s) is generated, the stoich coeff for C(s) in the above reation is zero.Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if(MGAS_Gasif){double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;double p_ch4 = RoRT * yi[IP_CH4][IS_CH4]/mw[IP_CH4][IS_CH4] / 101325.;y_carbon = yi[IP_SOOT][IS_SOOT];mol_weight = mw[IP_SOOT][IS_SOOT];if(C_VOF(c, ts) >= eps_s_small){if (rp_ke)rr_turb = Turbulent_rr(c, t, hr, yi);*rr = rr_h2_gasif(c, t, ts, tp, p_h2, p_ch4, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */if( direction > 0.0) /* positive value implies 1/2 C(s) + H2 ---> 1/2 CH4 */*rr = 0.0;else /* negative value implies 1/2 CH4 ---> H2 + (0.5)*1/25 Soot */{*rr = abs(*rr);*rr = MIN(*rr, rr_turb);}}}}double rr_h2_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double p_h2, double p_ch4, double y_carbon, double mol_weight, double* direction){double rate = 0.0, prod;double T_g = MIN((MAX(TMIN,C_T(c,tp))), TMAX);double p_h2_star = pow ((p_ch4/(exp(-13.43 + 10999/T_g))), 0.5);prod = y_carbon*C_R(c,ts)*1.e-3/mol_weight * C_VOF(c,ts); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */if(MGAS_Gasif){*direction = p_h2-p_h2_star;if(*direction < 0.0) /* this implies reverse H2 gasification */prod = y_carbon*(C_R(c,tp)*1e-03)/mol_weight*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */rate = exp( -7.087 - 8078/T_g )* prod * *direction ; /* mol/cm^3.s */}if(PCCL_Gasif){*direction = p_h2;rate = A_h2_gasification*exp(-E_h2_gasification/Rgas/T_g)*Annealing_h2_gasification * prod * *direction; /* mol/cm^3.s */}rate *= 1000.; /* kmol/(m^3 .s) */return rate;}DEFINE_HET_RXN_RATE(coal_combustion,c,t,hr,mw,yi,rr,rr_t){Thread **pt = THREAD_SUB_THREADS(t);Thread *tp = pt[0]; /* gas phase */int index_phase = Get_Phase_Index(hr);Thread *ts = pt[index_phase]; /* solid phase */double mol_weight, y_carbon, y_ash;*rr = 0.0;/* Set the phase and species indices. Ash species index is initialized to zero, with all other indices.Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if( C_YI(c,tp,IS_O2) >= spe_small){SolidFuel_Reactant(c, t, hr, &y_carbon, &mol_weight);y_ash = yi[index_phase][IS_ASH];*rr = rr_combustion(c, t, ts, tp, yi[IP_O2][IS_O2], y_ash, y_carbon); /* mol/(cm^3 .s) */*rr *= 1000.; /* kmol/(m^3 .s) */}}double rr_combustion(cell_t c, Thread *t, Thread *ts, Thread *tp, double yi_O2, double y_ash,double y_carbon){double rd, k_f, k_r, factor, k_a, rate = 0.0, vrel;double Pt = MAX(0.1, (op_pres+C_P(c,t))/101325);double gas_constant = 82.06; /* atm.cm^3/mol.K */double T = C_T(c,tp), T_s = C_T(c,ts), D_p = C_PHASE_DIAMETER(c,ts)*100.;double p_o2 = C_R(c,tp)*UNIVERSAL_GAS_CONSTANT* T *yi_O2/mw[IP_O2][IS_O2] / 101325.; /* atm */if(fc_ar > 0.){if (y_ash > 0.){rd = pow( (y_carbon * ash_ar/100.)/(y_ash * fc_ar/100.), (1./3.) );rd = MIN(1., rd);}elserd = 1.;}elserd = 0.;double diff = MAX((4.26 * pow((T/1800.),1.75)/Pt), 1.e-10); /* cm^2/s */double Sc1o3 = pow(C_MU_L(c,tp)/(C_R(c,tp) * diff * 1.e-4), 1./3.);#if RP_2Dvrel = pow(( (C_U(c,tp)-C_U(c,ts))*(C_U(c,tp)-C_U(c,ts)) +(C_V(c,tp)-C_V(c,ts))*(C_V(c,tp)-C_V(c,ts))), 0.5);#endif#if RP_3Dvrel = pow(( (C_U(c,tp)-C_U(c,ts))*(C_U(c,tp)-C_U(c,ts)) +(C_V(c,tp)-C_V(c,ts))*(C_V(c,tp)-C_V(c,ts)) +(C_W(c,tp)-C_W(c,ts))*(C_W(c,tp)-C_W(c,ts)) ), 0.5);#endifdouble Re = C_VOF(c,tp) * D_p/100. * vrel * C_R(c,tp)/(C_MU_L(c,tp)+SMALL_S);double N_sherwood = (7. - 10. * C_VOF(c,tp) + 5. * C_VOF(c,tp) * C_VOF(c,tp) )*(1. + 0.7 * pow(Re, 0.2) * Sc1o3) +(1.33 - 2.4 * C_VOF(c,tp) + 1.2 * C_VOF(c,tp) * C_VOF(c,tp)) *pow(Re, 0.7) * Sc1o3;if ( rd <= 0. || C_VOF(c, ts) <= 0. ){rate = 0.;}else{k_f = diff * N_sherwood / (D_p * gas_constant/mw[IP_O2][IS_O2] * T ); /* g/(atm.cm^2.s) */k_r = A_c_combustion * exp( -E_c_combustion/Rgas/T_s ) * rd * rd;if ( rd >= 1.){rate = 1. / (1./k_f + 1./k_r);}else{k_a = 2. * rd * diff * f_ep_a / (D_p * (1.-rd) * gas_constant/mw[IP_O2][IS_O2] * T_s );rate = 1. / (1./k_f + 1./k_r + 1./k_a);}factor = y_carbon / (y_carbon + 1.e-6);rate *= p_o2 * 6. * C_VOF(c,ts) * factor / (D_p * 32.); /* mol/(cm^3 .s) */ }return rate;}#if !RP_NODE || !PARALLELvoid volatile_mass_fractions(){read_c3m_data();/* pan2 : Oct 2012 ... added CX_Messages for debugging */CX_Message("PCCL_Devol = %d\n",PCCL_Devol);CX_Message("MGAS_Devol = %d\n",MGAS_Devol);CX_Message("CPD_Devol = %d\n",CPD_Devol);CX_Message("FGDVC_Devol = %d\n",FGDVC_Devol);CX_Message("HPTR_Devol = %d\n",HPTR_Devol);CX_Message("MGAS_Moisture = %d\n",MGAS_Moisture);CX_Message("PCCL_Moisture = %d\n",PCCL_Moisture);CX_Message("MGAS_TarCracking = %d\n",MGAS_TarCracking);CX_Message("PCCL_2nd_Pyro = %d\n",PCCL_2nd_Pyro);CX_Message("MGAS_gasif = %d\n",MGAS_Gasif);CX_Message("PCCL_gasif = %d\n",PCCL_Gasif);CX_Message("PCCL_TarCracking = %d\n",PCCL_TarCracking);CX_Message("MGAS_WGS = %d\n",MGAS_WGS);CX_Message("PCCL_soot_gasif = %d\n",PCCL_soot_gasif);CX_Message("MGAS_char_combustion = %d\n",MGAS_char_combustion);CX_Message("PCCL_char_combustion = %d\n",PCCL_char_combustion);CX_Message("PCCL_soot_oxidation = %d\n",PCCL_soot_oxidation);CX_Message("TAR_oxidation = %d\n",TAR_oxidation);CX_Message("MGAS_gas_phase_oxidation = %d\n",MGAS_gas_phase_oxidation);CX_Message("fc_ar = %f\n",fc_ar);CX_Message("vm_ar = %f\n",vm_ar);CX_Message("ash_ar = %f\n",ash_ar);CX_Message("moist_ar = %f\n",moist_ar);CX_Message("a1_devolatilization = %f\n",A1_devolatilization);CX_Message("e1_devolatilization = %f\n",E1_devolatilization);CX_Message("a2_devolatilization = %f\n",A2_devolatilization);CX_Message("e2_devolatilization = %f\n",E2_devolatilization);CX_Message("a_tar_cracking = %f\n",A_tar_cracking);CX_Message("e_tar_cracking = %f\n",E_tar_cracking);CX_Message("A_steam_gasification = %f\n",A_steam_gasification);CX_Message("E_steam_gasification = %f\n",E_steam_gasification);CX_Message("K_steam_gasification = %f\n",K_steam_gasification);CX_Message("N_steam_gasification = %f\n",N_steam_gasification);CX_Message("Annealing_steam_gasification = %f\n",Annealing_steam_gasification);CX_Message("A_co2_gasification = %f\n",A_co2_gasification);CX_Message("E_co2_gasification = %f\n",E_co2_gasification);CX_Message("K_co2_gasification = %f\n",K_co2_gasification);CX_Message("N_co2_gasification = %f\n",N_co2_gasification);CX_Message("Annealing_co2_gasification = %f\n",Annealing_co2_gasification);CX_Message("A_h2_gasification = %f\n",A_h2_gasification);CX_Message("E_h2_gasification = %f\n",E_h2_gasification);CX_Message("N_h2_gasification = %f\n",N_h2_gasification);CX_Message("Annealing_h2_gasification = %f\n",Annealing_h2_gasification);CX_Message("A_soot_steam_gasification = %f\n",A_soot_steam_gasification);CX_Message("E_soot_steam_gasification = %f\n",E_soot_steam_gasification);CX_Message("K_soot_steam_gasification = %f\n",K_soot_steam_gasification);CX_Message("N_soot_steam_gasification = %f\n",N_soot_steam_gasification);CX_Message("Annealing_soot_steam_gasification= %f\n",Annealing_soot_steam_gasification);CX_Message("A_soot_co2_gasification = %f\n",A_soot_co2_gasification);CX_Message("E_soot_co2_gasification = %f\n",E_soot_co2_gasification);CX_Message("K_soot_co2_gasification = %f\n",K_soot_co2_gasification);CX_Message("N_soot_co2_gasification = %f\n",N_soot_co2_gasification);CX_Message("Annealing_soot_co2_gasification= %f\n",Annealing_soot_co2_gasification);CX_Message("A_soot_h2_gasification = %f\n",A_soot_h2_gasification);CX_Message("E_soot_h2_gasification = %f\n",E_soot_h2_gasification);CX_Message("N_soot_h2_gasification = %f\n",N_soot_h2_gasification);CX_Message("Annealing_soot_h2_gasification = %f\n",Annealing_soot_h2_gasification);CX_Message("A_soot_combustion = %f\n",A_Soot_Combustion);CX_Message("E_soot_combustion = %f\n",E_Soot_Combustion);CX_Message("A_c_combustion = %f\n",A_c_combustion);CX_Message("E_c_combustion = %f\n",E_c_combustion);CX_Message("N_c_combustion = %f\n",N_c_combustion);CX_Message("Annealing_c_combustion = %f\n",Annealing_c_combustion);CX_Message("A_moisture_release = %f\n",A_moisture_release);CX_Message("E_moisture_release = %f\n",E_moisture_release);CX_Message("wg3 = %f\n",wg3);CX_Message("moisture_flux = %f\n",Moisture_Flux);/* f_ep_a is used in shrinking core model, in coal combustion model */double ep_a = 0.25 + 0.75*(1-ash_ar/100.);f_ep_a = pow(ep_a,2.5);}/* pan c3m start */static void SetBooleanValue(char * var , char * svalue) /* pan : Oct 2012 ... new function */ {cxboolean value;if ( strcmp(svalue,"true") == 0) /* pan2 : Oct 2012 : correction */value = TRUE;elsevalue = FALSE;if (strcmp(var,"pccl_devol") == 0) PCCL_Devol = value;if (strcmp(var,"mgas_devol") == 0) MGAS_Devol = value;if (strcmp(var,"cpd_devol") == 0) CPD_Devol = value;if (strcmp(var,"fgdvc_devol") == 0) FGDVC_Devol = value;if (strcmp(var,"hptr_devol") == 0) HPTR_Devol = value;if (strcmp(var,"mgas_moisture") == 0) MGAS_Moisture = value;if (strcmp(var,"pccl_moisture") == 0) PCCL_Moisture = value;if (strcmp(var,"mgas_tarcracking") == 0) MGAS_TarCracking = value;if (strcmp(var,"pccl_2nd_pyro") == 0) PCCL_2nd_Pyro = value;if (strcmp(var,"mgas_gasif") == 0) MGAS_Gasif = value;if (strcmp(var,"pccl_gasif") == 0) PCCL_Gasif = value;if (strcmp(var,"pccl_tarcracking") == 0) PCCL_TarCracking = value;if (strcmp(var,"mgas_wgs") == 0) MGAS_WGS = value;if (strcmp(var,"pccl_soot_gasif") == 0) PCCL_soot_gasif = value;if (strcmp(var,"mgas_char_combustion") == 0) MGAS_char_combustion = value;if (strcmp(var,"pccl_char_combustion") == 0) PCCL_char_combustion = value;if (strcmp(var,"pccl_soot_oxidation") == 0) PCCL_soot_oxidation = value;if (strcmp(var,"tar_oxidation") == 0) TAR_oxidation = value;if (strcmp(var,"mgas_gas_phase_oxidation") == 0) MGAS_gas_phase_oxidation = value;}static void SetValue(char * var , char * svalue) /* pan : oct 2012 ... replace entire function */{char * pEnd;double value = strtod(svalue,&pEnd);if (strcmp(var,"fc_ar") == 0) fc_ar = value;if (strcmp(var,"vm_ar") == 0) vm_ar = value;if (strcmp(var,"ash_ar") == 0) ash_ar = value;if (strcmp(var,"moist_ar") == 0) moist_ar = value;/* NOTE:If the two stage devolatilization model is not used, A2 and E2 have to be set to zero*/if (strcmp(var,"a1_devolatilization") == 0) A1_devolatilization = value;if (strcmp(var,"e1_devolatilization") == 0) E1_devolatilization = value;if (strcmp(var,"a2_devolatilization") == 0) A2_devolatilization = value;if (strcmp(var,"e2_devolatilization") == 0) E2_devolatilization = value;/* if (strcmp(var,"c3m_aem") == 0) c3m_aem = value; should not be used pan : Oct 2012 */if (strcmp(var,"a_tar_cracking") == 0) A_tar_cracking = value;if (strcmp(var,"e_tar_cracking") == 0) E_tar_cracking = value;if (strcmp(var,"a_steam_gasification") == 0) A_steam_gasification = value;if (strcmp(var,"e_steam_gasification") == 0) E_steam_gasification = value;if (strcmp(var,"annealing_steam_gasification") == 0) Annealing_steam_gasification = value;if (strcmp(var,"k_steam_gasification") == 0) K_steam_gasification = value;if (strcmp(var,"n_steam_gasification") == 0) N_steam_gasification = value;if (strcmp(var,"a_co2_gasification") == 0) A_co2_gasification = value;if (strcmp(var,"e_co2_gasification") == 0) E_co2_gasification = value;if (strcmp(var,"annealing_co2_gasification") == 0) Annealing_co2_gasification = value;if (strcmp(var,"k_co2_gasification") == 0) K_co2_gasification = value;if (strcmp(var,"n_co2_gasification") == 0) N_co2_gasification = value;if (strcmp(var,"a_h2_gasification") == 0) A_h2_gasification = value;if (strcmp(var,"e_h2_gasification") == 0) E_h2_gasification = value;if (strcmp(var,"annealing_h2_gasification") == 0) Annealing_h2_gasification = value;if (strcmp(var,"n_h2_gasification") == 0) N_h2_gasification = value;if (strcmp(var,"a_soot_steam_gasification") == 0) A_soot_steam_gasification = value;if (strcmp(var,"e_soot_steam_gasification") == 0) E_soot_steam_gasification = value;if (strcmp(var,"annealing_soot_steam_gasification") == 0) Annealing_soot_steam_gasification = value;if (strcmp(var,"k_soot_steam_gasification") == 0) K_soot_steam_gasification = value;if (strcmp(var,"n_soot_steam_gasification") == 0) N_soot_steam_gasification = value;if (strcmp(var,"a_soot_co2_gasification") == 0) A_soot_co2_gasification = value;if (strcmp(var,"e_soot_co2_gasification") == 0) E_soot_co2_gasification = value;if (strcmp(var,"annealing_soot_co2_gasification") == 0) Annealing_soot_co2_gasification = value;if (strcmp(var,"k_soot_co2_gasification") == 0) K_soot_co2_gasification = value;if (strcmp(var,"n_soot_co2_gasification") == 0) N_soot_co2_gasification= value;if (strcmp(var,"a_soot_h2_gasification") == 0) A_soot_h2_gasification = value;if (strcmp(var,"e_soot_h2_gasification") == 0) E_soot_h2_gasification = value;if (strcmp(var,"annealing_soot_h2_gasification") == 0) Annealing_soot_h2_gasification = value;if (strcmp(var,"n_soot_h2_gasification") == 0) N_soot_h2_gasification = value;if (strcmp(var,"a_soot_combustion") == 0) A_Soot_Combustion = value;if (strcmp(var,"e_soot_combustion") == 0) E_Soot_Combustion = value;if (strcmp(var,"a_c_combustion") == 0) A_c_combustion = value;if (strcmp(var,"e_c_combustion") == 0) E_c_combustion = value;if (strcmp(var,"n_c_combustion") == 0) N_c_combustion = value;if (strcmp(var,"annealing_c_combustion") == 0) Annealing_c_combustion = value;if (strcmp(var,"a_moisture_release") == 0) A_moisture_release = value;if (strcmp(var,"e_moisture_release") == 0) E_moisture_release = value;if (strcmp(var,"c3m_wg3") == 0) wg3 = value;if (strcmp(var,"moisture_flux") == 0) Moisture_Flux = value;/* if (strcmp(var,"c3m_ae5") == 0) c3m_ae5 = value; pan : Oct 2012 ... should not be used */}void read_c3m_data(){CX_Message("start of read_c3m_data \n");FILE * pFile;char line[80];char field1[80];char field2[80];char *pch;int i , field_index;pFile = fopen("fluent_c3m_udf.inp","r");if (pFile != NULL){CX_Message("fopen OK \n");char * pEnd = line;while (pEnd != NULL){/* CX_Message("read a line - start \n"); */pEnd = fgets(line,80,pFile);if (pEnd != NULL){for (i=0; i<80; ++i) line[i] = tolower(line[i]);pch = strtok(line," ,\t\n=");field_index = 0;while (pch != NULL){if (field_index == 0){strcpy(field1,pch);field_index = 1;/* CX_Message("token %s \n",field1); */}else{strcpy(field2,pch);field_index = 0;SetValue(field1,field2);SetBooleanValue(field1,field2); /* pan : Oct 2012 *//*CX_Message("\n\n");CX_Message("token %s \n",field1);CX_Message("token %s \n",field2);*/}pch = strtok(NULL," ,\t\n=");}}}fclose(pFile);}。