计算流体力学(CFD)文档——4. The scalar-transport equation
- 格式:pdf
- 大小:586.79 KB
- 文档页数:29
计算流体力学的求解步骤
计算流体力学(Computational Fluid Dynamics,简称 CFD)是通过计算机数值计算和图像显示,对包含有流体流动和热传导等相关物理现象的系统所做的分析。
其求解步骤通常包括以下几个方面:
1. 建立物理模型:根据实际问题建立相应的物理模型,包括流动区域、边界条件、流体性质等。
2. 数学模型:将物理模型转化为数学模型,通常使用 Navier-Stokes 方程等流体动力学基本方程来描述流体的运动和行为。
3. 网格生成:将计算区域划分为离散的网格单元,以便在每个网格点上进行数值计算。
4. 数值方法:选择合适的数值方法,如有限差分法、有限体积法或有限元法等,对数学模型进行离散化,将其转化为代数方程组。
5. 求解算法:使用适当的求解算法,如迭代法或直接解法,求解代数方程组,得到各个网格点上的流体变量的值。
6. 结果可视化:将计算得到的结果以图形或图表的形式展示出来,以便对流体的流动情况进行分析和评估。
7. 结果验证:将计算结果与实验数据或其他可靠的参考数据进行比较,验证计算结果的准确性和可靠性。
8. 优化与改进:根据结果验证的情况,对物理模型、数学模型、网格生成、数值方法或求解算法等进行优化和改进,以提高计算精度和效率。
需要注意的是,计算流体力学的求解步骤可能因具体问题和应用领域的不同而有所差异。
在实际应用中,还需要根据具体情况选择合适的软件工具和计算平台来执行上述步骤。
一、计算流体力学的基本介绍一、什么是计算流体力学(CFD)?计算流体力学(Computational Fluid Dynamics)是流体力学的一个新兴的分支,是一个采用数值方法利用计算机来求解流体流动的控制偏微分方程组,并通过得到的流场和其它物理场来研究流体流动现象以及相关的物理或化学过程的学科。
事实上,研究流动现象就是研究流动参数如速度、压力、温度等的空间分布和时间变化,而流动现象是由一些基本的守恒方程(质量、动量、能量等)控制的,因此,通过求解这些流动控制方程,我们就可以得到流动参数在流场中的分布以及随时间的变化,这听起来似乎十分简单。
但遗憾的是,常见的流动控制方程如纳维一斯托克斯(Navier-Stokes)方程或欧拉(Euler)方程都是复杂的非线性的偏微分方程组,以解析方法求解在大多数情况下是不可能的.实际上,对于绝大多数有实际意义的流动,其控制方程的求解通常都只能采用数值方法的求解。
因此,采用CFD方法在计算机上模拟流体流动现象本质上是流动控制方程(多数情况下是纳维一斯托克斯方程或欧拉方程)的数值求解,而CFD软件本质上就是一些求解流动控制方程的计算机程序。
二、计算流体力学的控制方程计算流体力学的控剖方程就是流体流动的质量、动量和能量守恒方程。
守恒方程的常见的推导方法是基于流体微元的质量、动量和能量衡算.通过质量衡算可以得到连续性方程,通过动量守恒可以得到动量方程,通过能量衡算可以得到能量方程。
式(1)一(3)是未经任何简化的流动守恒微分方程,即纳维一斯托克斯方程(N—S方程)。
N-S方程可以表示成许多不同形式,上面的N—S方程是所谓的守恒形式,之所以称为守恒形式,是因为这种形式的N—S方程求解的变量p、pu、pv、pw、pE是守恒型的,是质量、动量和能量的守恒变量。
事实上也可以直接求解u、v、w、T等原始变量,这种形式的方程被称为非守恒形式,因为这些变量并不守恒.也可以根据具体的流动状况进行简化。
计算流体动力学(CFD)分析概述No BoundariesANSYS/FLOTRAN分析指南第一章 FLOTRAN 计算流体动力学(CFD)分析概述FLOTRAN CFD 分析的概念ANSYS程序中的FLOTRAN CFD分析功能是一个用于分析二维及三维流体流动场的先进的工具,使用ANSYS中用于FLOTRAN CFD分析的FLUID 141和FLUID 142 单元,可解决如下问题:, 作用于气动翼(叶)型上的升力和阻力, 超音速喷管中的流场, 弯管中流体的复杂的三维流动同时,FLOTRAN还具有如下功能:, 计算发动机排气系统中气体的压力及温度分布, 研究管路系统中热的层化及分离, 使用混合流研究来估计热冲击的可能性, 用自然对流分析来估计电子封装芯片的热性能, 对含有多种流体的(由固体隔开)热交换器进行研究FLOTRAN 分析的种类FLOTRAN可执行如下分析:, 层流或紊流, 传热或绝热, 可压缩或不可压缩, 牛顿流或非牛顿流, 多组份传输这些分析类型并不相互排斥,例如,一个层流分析可以是传热的或者是绝热的,一个紊流分析可以是可压缩的或者是不可压缩的。
层流分析层流中的速度场都是平滑而有序的,高粘性流体(如石油等)的低速流动就通常是层流。
紊流分析紊流分析用于处理那些由于流速足够高和粘性足够低从而引起紊流波动的流体流动情况,ANSYS中的二方程紊流模型可计及在平均流动下的紊流速度波动的影响。
如果流体的密度在流动过程中保持不变或者当流体压缩时只消耗很少的能量,该流体就可认为是不可压缩的,不可压缩流的温度方程将忽略流体动能的变化和粘性耗散。
热分析流体分析中通常还会求解流场中的温度分布情况。
如果流体性质不随温度而变,就可不解温度方程。
在共轭传热问题中,要在同时包含流体区域和非流体区域(即固1No BoundariesANSYS/FLOTRAN分析指南体区域)的整个区域上求解温度方程。
在自然对流传热问题中,流体由于温度分布的不均匀性而导致流体密度分布的不均匀性,从而引起流体的流动,与强迫对流问题不同的是,自然对流通常都没有外部的流动源。
计算流体力学作业答案问题1:什么是计算流体力学?计算流体力学(Computational Fluid Dynamics,简称CFD)是研究流体力学问题的一种方法,它使用数值方法对流体流动进行数值模拟和计算。
主要包括求解流体运动的方程组,通过空间离散和时间积分等计算方法,得到流体在给定条件下的运动和相应的物理量。
问题2:CFD的应用领域有哪些?CFD的应用领域非常广泛,包括但不限于以下几个方面:1.汽车工业:CFD可以用于汽车流场的模拟和优化,包括空气动力学性能和燃烧过程等。
2.航空航天工业:CFD可以用于飞机、火箭等流体动力学性能的预测和优化,包括机身、机翼的设计和改进等。
3.能源领域:CFD可以用于燃烧、热交换等能源领域的流体力学问题求解和优化。
4.管道流动:CFD可以用于石油、化工等行业的管道流动模拟和流体输送优化。
5.空气净化:CFD可以用于大气污染物的传输和分布模拟,以及空气净化设备的设计和改进。
6.生物医药:CFD可以用于生物流体输送和生物反应过程的模拟和分析,包括血液流动、药物输送等。
问题3:CFD的数值方法有哪些?CFD的数值方法一般包括以下几种:1.有限差分法(Finite Difference Method,FDM):将模拟区域划分为网格,并在网格上离散化流体运动的方程组,利用有限差分近似求解。
2.有限体积法(Finite Volume Method,FVM):将模拟区域划分为有限体积单元,通过对流体流量和通量的控制方程进行离散化,求解离散化方程组。
3.有限元法(Finite Element Method,FEM):将模拟区域划分为有限元网格,通过对流体运动方程进行弱形式的变分推导,将流动问题转化为求解线性方程组。
4.谱方法(Spectral Method):采用谱方法可以对流体运动方程进行高精度的空间离散,通常基于傅里叶变换或者基函数展开的方式进行求解。
5.计算网格方法(Meshless Methods):不依赖网格的数值方法,主要包括粒子方法(Particle Methods)、网格自适应方法(Gridless Method)等。
第1章 CFD 基 础计算流体动力学(computational fluid dynamics ,CFD)是流体力学的一个分支,它通过计算机模拟获得某种流体在特定条件下的有关信息,实现了用计算机代替试验装置完成“计算试验”,为工程技术人员提供了实际工况模拟仿真的操作平台,已广泛应用于航空航天、热能动力、土木水利、汽车工程、铁道、船舶工业、化学工程、流体机械、环境工程等 领域。
本章介绍CFD 一些重要的基础知识,帮助读者熟悉CFD 的基本理论和基本概念,为计算时设置边界条件、对计算结果进行分析与整理提供参考。
1.1 流体力学的基本概念1.1.1 流体的连续介质模型流体质点(fluid particle):几何尺寸同流动空间相比是极小量,又含有大量分子的微元体。
连续介质(continuum/continuous medium):质点连续地充满所占空间的流体或固体。
连续介质模型(continuum/continuous medium model):把流体视为没有间隙地充满它所占据的整个空间的一种连续介质,且其所有的物理量都是空间坐标和时间的连续函数的一种假设模型:u =u (t ,x ,y ,z )。
1.1.2 流体的性质1. 惯性惯性(fluid inertia)指流体不受外力作用时,保持其原有运动状态的属性。
惯性与质量有关,质量越大,惯性就越大。
单位体积流体的质量称为密度(density),以r 表示,单位为kg/m 3。
对于均质流体,设其体积为V ,质量为m ,则其密度为m Vρ= (1-1) 对于非均质流体,密度随点而异。
若取包含某点在内的体积V ∆,其中质量m ∆,则该点密度需要用极限方式表示,即0lim V m Vρ∆→∆=∆ (1-2) 2. 压缩性作用在流体上的压力变化可引起流体的体积变化或密度变化,这一现象称为流体的可压缩性。
压缩性(compressibility)可用体积压缩率k 来量度d /d /d d V V k p pρρ=-= (1-3) 式中:p 为外部压强。
cfd计算流体力学CFD计算流体力学————————计算流体力学(Computational Fluid Dynamics,CFD)是一门研究和分析流体运动特性的计算方法。
它利用数学模型和计算机技术来模拟流体运动的物理过程,以获取流体运动的温度、压力、流速和其他变量的解决方案。
CFD技术在航空、航天、电力、水处理、食品加工、冶金、石油化工、医学、化学和机械制造等领域有广泛应用。
## 什么是CFDCFD是一个复杂的计算技术,它可以帮助我们理解流体运动的物理原理,以及它们在一定环境中的行为。
它是通过建立数学模型,利用计算机技术,根据流体的物理运动原理,对其运动过程进行模拟,以获得其运动特性及其影响的变量。
## CFD的工作原理CFD的工作原理是利用数学方法和计算机技术,对流体在某一特定时间内的行为进行数学模拟。
CFD根据流体的物理运动原理,建立数学模型,通过计算机程序对其运动过程进行模拟,以获得其运动特性及其影响的变量。
CFD的工作方式一般分为三个步骤:1. 首先,需要对流体流动的物理场进行划分,将其分成一些小部分,即将流体场分割成一些小的方格子,称为“单元格”。
2. 然后,根据流体物理学原理,建立数学模型,对各个单元格的变量进行计算,得出不同时间步骤的变量数值。
3. 最后,将各个单元格的变量数值合成一个整体,并通过图形可视化来显示出来,从而得出整个流体场的行为特征。
## CFD的应用CFD在航空、航天、电力、水处理、食品加工、冶金、石油化工、医学、化学和机械制造等领域有广泛应用。
例如:- 航空航天领域:可以用CFD来预测飞行器的性能,如飞行速度、飞行高度、飞行载荷等;- 电力领域:可以用CFD来优化发电厂的效率;- 水处理领域:可以用CFD来优化水处理厂的设计布局;- 食品加工领域:可以用CFD来优化食品加工厂的流程设计和布局;- 冶金领域:可以用CFD来优化冶金厂的冶炼工艺;- 其他工业领域也有广泛应用。
计算流体力学的数学模型与方法计算流体力学(Computational Fluid Dynamics,简称CFD)是研究流体运动的力学现象而采用的计算方法。
它结合了数学模型和计算方法,通过数值计算和模拟的手段,来解决流体问题。
本文将从数学模型和计算方法两个方面,探讨计算流体力学的基本原理与应用。
一、数学模型数学模型是计算流体力学的基础,它描述了流体运动的基本方程和边界条件。
常用的数学模型包括Navier-Stokes方程、动量守恒方程、质量守恒方程和能量守恒方程等。
1. Navier-Stokes方程Navier-Stokes方程是描述流体的速度和压力随时间和空间变化的方程。
其一般形式为:\[\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \mathbf{v}) = 0\]其中,$\rho$表示流体的密度,$\mathbf{v}$表示流体的速度。
2. 动量守恒方程动量守恒方程描述了流体运动中动量的变化。
它可以表示为:\[\frac{\partial (\rho \mathbf{v})}{\partial t} + \nabla \cdot (\rho\mathbf{v} \mathbf{v}) = -\nabla p + \nabla \cdot \mathbf{\tau}\]其中,$p$表示压力,$\mathbf{\tau}$表示粘性应力张量。
3. 质量守恒方程质量守恒方程描述了流体质量的守恒。
它可以表示为:\[\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \mathbf{v}) = 0\]4. 能量守恒方程能量守恒方程描述了流体能量的守恒。
它可以表示为:\[\frac{\partial (\rho e)}{\partial t} + \nabla \cdot (\rho e \mathbf{v}) =\nabla \cdot (\lambda \nabla T) + \nabla \cdot (\mathbf{\tau \cdot v}) + \rho \mathbf{v} \cdot \mathbf{g}\]其中,$e$表示单位质量流体的总能量,$T$表示温度,$\lambda$表示热导率。
计算流体力学(CFD)中的迭代法及其并行计算方法何有世 副教授 袁寿其王大承丛小青(江苏大学)(五邑大学)(江苏大学)学科分类与代码:62015020基金项目:江苏省应用基础基金项目(基金号:BJ2000006)。
【摘 要】 应用计算流体力学(CFD)方法分析事故原因已被广泛采用,笔者针对事故理论分析和流体计算过程中,运用CFD方法所存在计算量大的问题,分析和讨论了几种古典迭代法及其并行计算方法。
【关键词】 计算流体力学(CFD) 迭代法 并行计算Iteration and Its Parallel Computation in Computational Fluid DynamicsH e Youshi,Assoc.Prof1 Yuan Shouqi W ang Dachen Cong Xiaoqing(Jiangsu University)(Wuyi University)(Jiangsu University)Abstract: Computational fluid dynamics(CFD)has been widely applied to analyze the causation of accidents.In view of the large amount of computation in accident theoretical analysis and in the process of fluid computation by CFD,some classic iterations and their parallel computations are analyzed and discussed.K ey w ords: Computational fluid dynamics(CFD) Iteration Parallel computation1 引 言在安全科学的众多领域,例如,爆炸压力场的分布计算中,都广泛地使用CFD(Computational Fluid Dynamics,计算流体力学)技术。
计算流体力学简介计算流体力学(Computational Fluid Dynamics,简称CFD)是现代科技中的一个重要领域,它利用计算机仿真和计算等技术,对流体力学问题进行数值求解,以达到预测和优化流体现象的目的。
本文将简要介绍CFD的发展过程、应用范围、数值模拟方法等方面。
一、CFD的发展CFD的发展源于20世纪50年代,当时的计算机技术还非常有限,CFD的应用范围很窄。
到了20世纪70年代,随着计算机的高速发展和应用,CFD得以迅速发展,越来越多地应用于航空航天、能源、环境等领域。
随着CFD标准化和工具的发展,越来越多的人开始使用CFD来预测流体现象,优化产品设计。
二、CFD的应用范围CFD的应用涉及到许多领域。
在航空航天领域中,CFD 可以用来预测飞机的空气动力学特性、燃烧炉的热力学特性、火箭发动机的燃烧过程等。
在汽车工业中,CFD可以用来模拟车辆的气动特性,优化车身结构和排放系统的设计,提高燃油经济性。
在能源领域中,CFD可以用来模拟煤热电联产的燃烧过程,预测钻井液在油井中的流动和携带油气的能力等。
在环境领域中,CFD可以用来预测气象和大气污染的传播,优化建筑物的设计和施工等。
三、CFD的基本数值模拟方法CFD的数值模拟方法可以分为欧拉法和纳维-斯托克斯NS (Navier-Stokes)方程法两种。
欧拉法是通过施加边界条件和初始条件来解决流体力学问题的,简单、快速,但只适用于高速简单流动。
NS方程法是采用角动量守恒定律、质量守恒定律和动量守恒定律来分析复杂流体流动问题,更准确地预测流体动力学特性,但需要更高的计算能力和更长的计算时间。
四、CFD的软件CFD的数值求解需要大量的计算能力和高度优化的计算机软件。
目前市场上较为常用的CFD软件有Fluent、OpenFOAM、StaMINA等,这些软件通过预测流体动力学特性,优化流体现象,提高产品质量和效率。
五、CFD的应用前景CFD的应用前景十分广阔,尤其随着计算机技术的不断发展,CFD预测和优化流体现象的能力将逐渐提高。
第1章 CFD 基 础计算流体动力学(computational fluid dynamics ,CFD)是流体力学的一个分支,它通过计算机模拟获得某种流体在特定条件下的有关信息,实现了用计算机代替试验装置完成“计算试验”,为工程技术人员提供了实际工况模拟仿真的操作平台,已广泛应用于航空航天、热能动力、土木水利、汽车工程、铁道、船舶工业、化学工程、流体机械、环境工程等 领域。
本章介绍CFD 一些重要的基础知识,帮助读者熟悉CFD 的基本理论和基本概念,为计算时设置边界条件、对计算结果进行分析与整理提供参考。
1.1 流体力学的基本概念1.1.1 流体的连续介质模型流体质点(fluid particle):几何尺寸同流动空间相比是极小量,又含有大量分子的微元体。
连续介质(continuum/continuous medium):质点连续地充满所占空间的流体或固体。
连续介质模型(continuum/continuous medium model):把流体视为没有间隙地充满它所占据的整个空间的一种连续介质,且其所有的物理量都是空间坐标和时间的连续函数的一种假设模型:u =u (t ,x ,y ,z )。
1.1.2 流体的性质1. 惯性惯性(fluid inertia)指流体不受外力作用时,保持其原有运动状态的属性。
惯性与质量有关,质量越大,惯性就越大。
单位体积流体的质量称为密度(density),以r 表示,单位为kg/m 3。
对于均质流体,设其体积为V ,质量为m ,则其密度为m Vρ= (1-1) 对于非均质流体,密度随点而异。
若取包含某点在内的体积V ∆,其中质量m ∆,则该点密度需要用极限方式表示,即0lim V m Vρ∆→∆=∆ (1-2) 2. 压缩性作用在流体上的压力变化可引起流体的体积变化或密度变化,这一现象称为流体的可压缩性。
压缩性(compressibility)可用体积压缩率k 来量度d /d /d d V V k p pρρ=-= (1-3) 式中:p 为外部压强。
CFD计算流体力学或计算流体动力学,英文Computational Fluid Dynamics,简称CFD,是用电子计算机和离散化的数值方法对流体力学问题进行数值模拟和分析的一个分支。
计算流体力学是目前国际上一个强有力的研究领域,是进行传热、传质、动量传递及燃烧、多相流和化学反应研究的核心和重要技术,广泛应用于航天设计、汽车设计、生物医学工业、化工处理工业、涡轮机设计、半导体设计、HAVC&R 等诸多工程领域,板翅式换热器设计是CFD 技术应用的重要领域之一。
商业软件自从1981 年英国CHAM 公司首先推出求解流动与传热问题的商业软件PHOENICS以来,迅速在国际软件产业中形成了通称为CFD 软件的产业市场。
到今天,全世界至少已有50余种这样的流动与传热问题的商业软件,在促进CFD技术应用于工业实际中起了很大的作用。
下面介绍当今世界上应用较广的CFD商业软件。
(1) CFX该软件采用有限容积法、拼片式块结构化网络,在非正交曲线坐标(适体坐标) 系上进行离散,变量的布置采用同位网格方式。
对流项的离散格式包括一阶迎风、混合格式、QUICK、CONDIF、MUSCI及高阶迎风格式。
压力与速度的耦合关系采用SIMPLE系列算法(SIMPLEC),代数方程求解的方法中包括线迭代、代数多重网络、ICCG、STONE 强隐方法及块隐式(BIM)。
软件可计算不可压缩及可压缩流动、耦合传热问题、多相流、化学反应、气体燃烧等问题。
(2) FIDAP这是英语Fluid Dynamics Analysis Package 的缩写,系于1983年由美国Fluid Dynamics International Inc. 推出,是世界上第一个使用有限元法(FEM) 的CFD软件。
可以接受如I-DEAS、PATRAN、ANSYS和ICEMCFD 等著名生成网格的软件所产生的网格。
该软件可以计算可压缩及不可压缩流、层流与湍流、单相与两相流、牛顿流体及非牛顿流体的流动问题。
气体动力学1.理想气体运动的基本方程组理想气体:无粘性、无导热性雷诺数:度量粘性效应的相对大小的量纲一的数R e=ρVLμ=惯性力粘性力●要确定理想气体的流场,一般需要知道六个参数:速度V的三个分量,压力p,密度ρ和温度T。
因此理想气体动力学要建立六个独立的基本方程,连同初边值条件,以构成定解问题。
●基本方程所依据的是三个方面的物理定律,即运动学方面的质量守恒定律,动力学方面的牛顿定律和热力学方面的第一、第二定律以及气体热状态方程。
●建立基本方程时首先面临着这么一个问题:怎样选取流体物质形态的模型作为研究对象。
有两种流体模型可供选择。
一种是随体观点的模型,它认定某个有确定质量的流体团,称为封闭系统,其特点是:(1) 系统的体积τ(t)和界面积σ(t)随流体运动而随时变化;(2) 在系统的界面上,只有能量交换,没有质量交换。
一种是当地观点的模型,它在流体空间认定一个固定的控制面所包围的区域,称为开口系统,其特点是:(1) 系统的体积τ和界面积σ是固定不变的;(2) 在系统的界面上,既有能量交换,也有质量交换。
对于上述两种流体模型,即封闭系统和开口系统,还有两种数学表达形式。
一种是选取有限质量(体积)的系统,写成积分形式的基本方程。
另一种是选取微元质量(体积)的系统,写成微分形式的基本方程。
微分形式的方程适用于连续流程,便于探讨流场各处的参数分布规律。
积分形式的方程便于从总体上研究问题,而且可以用来求解系统中有间断面存在的情况。
综上所述,理想气体运动的基本方程组的要点可归为:六个方程、三个方面、两种观点、两种形式。
1.1 连续性方程质量守恒方程(当地观点、微分形式)微元体的质量平衡式:微元体内质量的增加率=进入微元体的质量净流率微元体内质量的增加率:ððt (ρδxδyδz)=ðρðtδxδyδz进入微元体的质量流率的净变化率:通过微元体每一个表面的质量流率等于密度、速度分量和面积的乘积。
ANSYS CFD 入门指南计算流体力学基础及应用简介计算流体力学(Computational Fluid Dynamics, CFD)是一种应用数值方法来求解流体动力学方程的方法,通过数值模拟流体运动、热传导和传质过程,可以获取流场各个位置的速度、压力、温度等物理量的数值解,从而分析和预测流体中的流动行为。
ANSYS CFD 是一套强大的计算流体力学软件,它提供了丰富的分析工具和解算器,用于模拟各种复杂流动和换热问题。
本文档将介绍 ANSYS CFD 的基础知识和应用实例,帮助读者掌握使用 ANSYS CFD 进行计算流体力学分析的方法。
第一章 ANSYS CFD 概述1.1 ANSYS CFD 软件简介ANSYS CFD 是美国 ANSYS 公司开发的一款流体力学分析软件。
它基于有限体积法和有限元法,能够求解各种流动和传热问题。
1.2 ANSYS CFD 的功能特点•提供多种模型和物理现象的建模与仿真功能;•支持多种求解器和网格生成工具;•提供丰富的后处理功能,可用于流场可视化和数据分析;•具备良好的可扩展性和并行计算能力。
第二章计算流体力学基础2.1 流体力学基本方程CFD 的基础是流体力学的方程组,包括质量守恒方程、动量方程和能量方程。
本节将介绍这些方程的推导和应用。
2.2 数值离散化方法为了求解流体力学方程组,需要将其离散化为代数方程组。
本节将介绍常用的离散化方法,如有限体积法和有限元法。
2.3 网格生成网格是进行 CFD 计算的基础,合适的网格能够提高计算效果。
本节将介绍常见的网格生成方法和工具。
第三章 ANSYS CFD 基本操作3.1 ANSYS CFD 的界面介绍本节将介绍ANSYS CFD 的主要界面,包括菜单栏、工具栏、工作区等,帮助读者熟悉软件的操作界面。
3.2 模型建立与几何处理在进行 CFD 分析之前,需要建立相应的几何模型,并进行几何处理,例如加工、修复和简化模型。
4. THE SCALAR-TRANSPORT EQUATION SPRING 20114.1 The scalar-transport equation 4.2 Control-volume notation4.3 The steady-state 1-d advection-diffusion equation 4.4 Discretising diffusion4.5 Discretising the source term4.6 Assembling the algebraic equations 4.7 Extension to 2 and 3 dimensions 4.8 Discretising advection (part 1) 4.9 Discretisation properties4.10 Discretising advection (part 2)4.11 Implementation of advanced advection schemes 4.12 Implementation of boundary conditions 4.13 Solution of the algebraic equations Summary Examples4.1 The Scalar-Transport EquationThis is a generic equation for transported physical quantities (momentum, energy,...) For an arbitrary control volume V := + inside V y of boundar out inside V SOURCE FLUX CHANGE OF RATEThe total flux comprises advection (transport with the flow) and diffusion (molecular, or due to turbulent fluctuations). The resulting advection-diffusion equation for concentration φ may be written, for each computational control volume (or “cell”) as:sourcediffusion advection change of rate SV A C V t faces=−φ+φ∑)()(d d(Any non-advective fluxes not described by gradient diffusion are assumed to be incorporated in the source term – see Section 2.2.5.)4.2 Control-Volume NotationThe commonest configurations are cell-centred storage or cell-vertex storage.nThis course focuses on structured meshes using cell-centred storage. (Unstructured meshes will be discussed briefly at the end of the course, but the 2nd edition of Versteeg and Malalasekera’s book gives a much better description.)A typical 3-d control volume is shown right. Relativeto the cell centre (point P) the coordinate directions Array are commonly denoted west, east, south, north,bottom, top with:•lower case w, e, s, n, b, t used for cell faces;•upper case W, E, S, N, B, T for adjacent nodes.For a Cartesian mesh these would usually correspondto ±x, ±y, ±z directions respectively.Cell-face areas will be denoted A w, A e, A s, A n, A b, A t.Cell volumes will be denoted V. In 2 dimensions onecan think of a single layer of cells with unit depth.When referring to the entire set of control volumes (as opposed to looking at a representative one) it is common to switch between geographic and ijk notation, so thatφP≡φijk, φE≡φi+1 jk , etc.4.3 The Steady-State 1-D Advection-Diffusion EquationConsider first the steady-state, 1-d advection-diffusion equation. This is worthwhile because: • it greatly simplifies the analysis; • it permits a hand solution of the discretised equations; • subsequent generalisation to 2 and 3 dimensions is straightforward; • in practice, discretisation of fluxes is generally carried out coordinate-wise; • many important theoretical problems are 1-d.Integral (Control-Volume) FormConservation for one control volume givessource flux flux w e =− (1) where “flux ” means the rate at which something passesthrough a given area (here, a cell face).If φ is the amount per unit mass, then the total flux hasadvective and diffusive parts:advection:φ)(uA diffusion: xA d d φ−If S is the source per unit length then the advection-diffusion equation for φ isx S x A uA x A uA w e d d d d = φ−φ−φ−φ(2)Conservative Differential FormDividing by x and taking the limit as x → 0 gives a corresponding differential equation:S xA uA x =φ−φ)d d (d d(3)Non-Conservative Differential FormMass conservation implies that uA = constant and hence (3) can also be writtenS xA x x uA =φ−φd d (d d d d (4)Note : • This system is quasi-1-d in the sense that the cross-sectional area A may vary. Tosolve a truly 1-d problem, set A = 1. The differential equation is thenS u x =−φ(d d• In this instance, , u , and S are assumed to be known. In the general CFD problem,u is itself the subject of a separate transport equation.eflux4.4 Discretising DiffusionGradient diffusion is usually discretised by central differencing :−→φ−A x A e e )(d dor)(d d P E e eD x A φ−φ−→φ− where D ≡(6)D is a diffusive transfer coefficientA similar expression is used for the west face:)(d d W P w wD x A φ−φ−→φ−Note : • In the finite-volume method, fluxes are required at cell faces , not nodes. • This approximation for (d φ/d x )e is second-order accurate in x (see later). • If the diffusivity varies then its cell-face value must be obtained by interpolation. • Equal weighting is applied to the two nodes on either side of the cell face, consistentwith diffusion acting equally in all directions. Later on, we shall see that this contrasts with advection, which has a directional bias.4.5 Discretising the Source TermWhen the source is proportional to the amount of fluid, the total source strength for the cell is (source per unit volume ) × (volume ) V S ×=(In 1-d problems V is the cell length, x ).S may depend on the solution φ as in the example above. The source term is conveniently broken down into solution-independent and solution-dependent parts in the linear form,≤φ+=P P P P s s b source (7) The reason for this particular form will become apparent later.4.6 Assembling the Algebraic EquationsAs seen in the above classroom examples, when there is no flow (u = 0) the steady-state diffusion problem discretises as follows.p P P W P w P E e w e s b D D sourceflux flux φ+=φ−φ+φ−φ−=−)()( or, collecting multiples of φP , φE and φW together: P E e P p e w W w b D s D D D =φ−φ−++φ−)(This is commonly written P E E P P W w b a a a =φ−φ+φ−or, in a notation that generalises to 2 and 3 dimensions (and to the case with flow): ∑=φ−φnodesadjacentP F F P P b a a(8)(8) is a canonical form for the discretised scalar-transport equation.There will be a discretised equation of this form for each variable and for each control volume. For one variable φ, if the nodal values are assembled into a vector then the set of algebraic equations takes the form= φ−−M M M M M M M M O O O O O O O O OO P P EP W b a a a 00 orFor a 1-d system this is tri-diagonal . If the coefficients are constants then it can be solved directly by Gaussian elimination or very efficiently on a computer by the tri-diagonal matrix algorithm (see the Appendix). If the elements of the matrix are dependent on the solution then it must be solved iteratively.4.7 Extension to 2 and 3 Dimensions For a multi-dimensional flow the net flux out of a cell can be obtained by summing the outward fluxes through all faces. For quadrilateral elements (in 2d) or hexahedral elements (in 3d) then the net flux out of a cell is simply the sum of the net fluxes through opposing sides and the general conservation equation may be written: source flux flux flux flux flux flux b t s n w e =−+−+−)()()( (9)The discretised equations are still assembled in the same matrix formP FF F P P b a a =φ−φ∑(10) with the summation extended to include nodes in the other directions.Combining the individual equations (10) from all control volumes gives a matrix equation for the set of nodal values. In two dimensions this gives the banded matrix system shown. Further bands appear in three dimensions.Thus, (8) or (10) has the same form in 1-, 2- or 3-d problems, but in multiple dimensions the summation is extended to the other (S , N , B , T ) nodes and there is a corresponding increase in the number of non-zero diagonals in the assembled matrix equation. This makes the matrix equation much harder to solve (see Section 4.13).Equation (10) formally describes the discretisation for a single control volume in an unstructured mesh. However, since the nodes do not have a simple ijk indexing, the resulting matrix and solution method for unstructured meshes are much more complex.ΦbΦbe flux s4.8 Discretising Advection (Part 1)Purely diffusive problems (u = 0) are of passing interest only. In typical engineering flow problems, advection fluxes far exceed diffusive fluxes because the Reynolds number (Re UL / = ratio of inertial forces [mass × acceleration] to viscous forces) is very large.The 1-d steady-state advection-diffusion equation issource flux flux w e =− where, with mass flux C (= uA ):xA C flux d d φ−φ= .Discretising the diffusion and source terms as before, the equation becomessourcediffusion advection s b D D C C PP P W P w P E e w w e e φ+=φ−φ−φ−φ−φ−φ)]()([][ (11)φe and φw have yet to be approximated. The problem is … how to approximate these face values in terms of the values at adjacent nodes . A method of specifying these face values in order to calculate advective fluxes is called an advection scheme or advection-differencing scheme .4.8.1 Central DifferencingIn central differencing the cell-face value is approximated by the average of values at the nodes on either side:)(21E P e φ+φ=φThis is second-order accurate for φe in terms of ∆x (see later). Substituting into (11) (with a similar expression for φw ) givesP P P W P w P E e P W w E P e s b D D C C φ+=φ−φ+φ−φ−φ+(φ−φ+(φ)()())2121 or, collecting terms,P E e e P P w e w e W w w b D C s D D C C D C =φ+−−)φ−++−+)φ+−)(((21212121In out canonical notation: P FF F P P b a a =φ−φ∑where, in one dimension:)(2121w e P W E P ee E w w W C C s a a a D C a D C a −+−+=+−=+= (12)(By mass conservation, C e – C w = 0, so that the expression for a P can be simplified.)The graphs below show the solution of an advection-diffusion problem with no sources and constant diffusivity for the two combinationsPe = 1/2 (advection « diffusion) (equation: 024345=φ−φ+φ−E P W )Pe = 4 (advection » diffusion)(equation: 023=φ+φ+φ−E P W )where the Peclet number Pe is defined byi.e.Pe diffusion advection D C ==(13)Pe = 1/2Pe = 4In the first case the solution is good (consistent with second-order accuracy).In the second case there are pronounced “wiggles” in what should be a perfectly smoothsolution. What is wrong?eMathematically, when the cell Peclet number Pe is bigger than 2, the a E coefficient becomes negative ,meaning that, for example, an increase in φE wouldlead to a decrease in φP . This is impossible for a quantity that is simply advected and diffused.Physically, the advection process is directional ; ittransports properties only in the direction of the flow.However, the central-differencing formula assigns equal weight to both upwind and downwind nodes.4.8.2 Upwind DifferencingIn upwind differencing φface is taken as the value at whichever is the upwind node; i.e. in one dimension:<φ>φ=φ)0if ()0if (u u EP eThis is only first-order accurate in x (see later) but acknowledges the directional nature of advection. The alternatives can be summarised as U face φ=φwhere subscript U denotes whichever is the upwind node for that face.With this scheme, the algebraic equation for each control volume takes the canonical form∑=φ−φFP F F P P b a a where:PW E P w w W ee E s a a a D C a D C a −+=+=+−=)0,max()0,max((14)If the “max” bit confuses you, consider separately the two cases where the mass flux is positive (flow from left to right) or negative (flow from right to left).When applied to the same advection-diffusion problem as the central-differencing scheme it is found that: • when Pe = ½ the upwind-differencing scheme is not as accurate as centraldifferencing; this is to be expected from its order of accuracy; • when Pe = 4 the upwind-differencing solution is not particularly accurate, but the“wiggles” have disappeared.In all cases, however, both a W and a E are unconditionally positive.So there is a pay-off – accuracy versus boundedness (absence of wiggles). The next sections examine the desirable properties of discretisation schemes, the constraints that they impose upon the matrix coefficients and more advanced advection schemes that are both accurate andbounded.diffusion only advection+diffusionφφe4.9 Discretisation Properties(i) ConsistencyAn approximation is consistent if the discretised equations are equivalent to the continuum equations in the limit as the grid size tends to zero. e.g. by the definition of a derivative,is a consistent approximation forx∂φ∂.(ii) ConservativenessA scheme is conservative if fluxes are associated with faces, not particularcells, so that what goes out of one cell goes into the adjacent cell;This is automatically built into the finite-volume method.(iii) TransportivenessAn advection scheme is transportive if it is upstream-biased. In practice this means higher weighting to nodes on the upstream side of a face.(iv) BoundednessA flux-differencing scheme is bounded if, in an advection-diffusion problem without sources: •the value of φ at a node always lies between the maximum and minimum values at surrounding nodes;•φ = constant is a possible solution.This imposes conditions on the matrix coefficients a P, a W, a E, ... If there are no sources then=φ−φ∑F FPPaa(15) Suppose that φ is only non-zero at one adjacent node, F. Then=φ−φFFPPaa orFPFP aaφ=φSince φP must lie between 0 and φF, this requires that10≤≤PFaaHence, a F and a P must have the same sign (invariably positive in practice). Thus, we require: FaFallfor≥ (“positive coefficients”) (16) (It is the contravening of the positivity condition that leads the central-differencing scheme to produce “wiggles”.)If (15) is also to admit the solution φ = constant then this can be divided out to yield ∑=FPaa (“sum of neighbouring coefficients”) (17)(v) StabilityA solution method (not advection scheme) is stable if small errors do not grow in the course of the calculation. This determines whether it is possible to obtain a converged solution – it says nothing about its accuracy or whether it contains wiggles. Stability is heavily influenced by how the source term is discretised.Any source term should be linearised as P P P s b φ+; the complete equation for one cell is then P P P F F P P s b a a φ+=φ−φ∑ If the solution-dependent part of the source (s P φP ) is transferred to the LHS then the diagonal coefficient is modified to read P F P s a a −=∑ Numerical stability requires negative feedback ; otherwise, an increase in φ would lead to an increase in the source, which would lead to a further increase in φ and so on. Thus: s P ≤ 0 (“negative-slope linearisation of the source term ”) If this condition and the positivity of the a F is maintained then ∑≥F P a a (“diagonal dominance ”)The last condition is, in fact, a necessary requirement of many matrix solution algorithms.In summary, boundedness and stability place the following constraints on the discretisation of flux and source terms:positive coefficients : F a F all for 0≥ negative-slope linearisation of the source term : 0,≤φ+=P P P P s s b source sum of neighbouring coefficients : ∑−=FP F P s a a(vi) OrderOrder is a measure of accuracy. Formally, it defines how fast the error in a numerical approximation diminishes as the grid spacing gets smaller.If, on a uniform grid of spacing x , the truncation error is proportional to x n as x 0 then that scheme is said to be of order n .Order can be established formally by a Taylor-series expansion about a cell face . e.g. for the nodes either side of the east face:L +∂φ∂1+ ∂φ∂+∂φ∂+φ=φ333222!3!21x x x e e e e E (18)(a)L +∂φ∂1− ∂φ∂+∂φ∂−φ=φ333222!3!21x x x e e e eP (18)(b)Subtracting (18)(a) – (b) gives:L +∂φ∂1++∂φ∂+=φ−φ333300x x x e e P E whence, dividing by x :)(2x O x e+∂φ∂=As the leading error term is O (∆x 2is a second-order approximation for ex∂φ∂.Alternatively, adding (18)(a) – (b) gives:L +∂φ∂++φ=φ+φ22202x e e E P whence:)()(221x O e E P +φ=φ+φAs the error term is O (x 2), the central differencing formula )(21E P φ+φ is a second-order approximation for φe . On the other hand, the Upwind-differencing approximations φP or φE (depending on the direction of the flow) are formally first-order accurate.Higher accuracy can be obtained by using more nodes in an approximation – one node permits schemes of at most first-order accuracy, two permit second-order accuracy and so on.Schemes of low-order accuracy – e.g. Upwind – lead to substantial numerical diffusion in 2- and 3-d calculations when the velocity vector is not aligned with the grid lines.Notes . (1) Order is an asymptotic concept; i.e. it refers to behaviour as x 0. In this limit onlythe first non-zero truncation term in the Taylor series is important. However, the full expansion includes terms of higher order which may be non-negligible for finite x . (2) Order refers to the theoretical truncation error in the approximation, not thecomputer’s round-off error (the accuracy with which it can store floating-point numbers). (3) The more accurate a scheme then, in principle, the greater the reduction in numericalerror as the grid is made finer or, conversely, the less nodes required for a given accuracy. However, high-order schemes tend to require more computational calculations and often have boundedness or stability problems. Also, the law of diminishing returns applies when the truncation error becomes of similar size to the floating-point round-off error.4.10 Discretising Advection (Part 2)With an understanding of the desirable properties of a flux-differencing scheme it is now possible to examine more advanced schemes.4.10.1 Exponential SchemeThe 1-d advection diffusion equation issource flux flux w e ≡− or, equivalently,S xA uA x =φ−φ)d d (d d (19) If there are no sources (S = 0) then the total flux must be constant:constant xA uA flux =φ−φ=d dIf , u , A and are constant this equation can be solved exactly, with boundary conditions φ = φP and φ = φE at adjacent nodes, to give (see the Examples):−φ−φ=1P P e E P e e e e Cflux wheret coefficien transfer diffusive fluxmass ====D uA C Pe DC==.With a similar expression for the west face, one obtains ∑φ−φ=−F F P P w e a a flux flux where:W E P E W a a a e Ca e Ce a +=−=−=,1,1Pe Pe Pe (20)Assessment • Conservative by construction. • Transportive, because there is a larger weighting on the upwind node. • Bounded: all a F are positive and a P is the sum of the neighbouring coefficients.To see the last two of these you will have to consider separately the cases C > 0 (for which e Pe > 1) and C < 0 (for which e Pe < 1).This scheme – by construction – gives the exact solution for zero sources and constant velocity and diffusivity , but this is something we could have found analytically anyway. The scheme has never really found favour because: • the scheme isn’t exact when u or vary, or if there are sources, or in 2-d or 3-d flow; • exponentials are extremely expensive to compute.eflux4.10.2 Hybrid Scheme (Spalding (1972)This is based on a piecewise-linear approximation to the exponential scheme. It amounts to: • central differencing if 2Pe ≤;• upwind differencing (with zero diffusion!) if 2Pe >. ∑φ−φ=−F F P P w e a a flux fluxwhere (if u > 0 and the mass flux C and diffusive transport coefficient D are constant):WE P E W E W a a a a C a D C DC aD C a +=>==≤≡+−=+=2Pe if 0,2/Pe if ,2121 (21)AssessmentThe scheme is conservative, transportive and bounded.The hybrid scheme remained extremely popular in commercial codes for a long time because it was stable and robust. However, most flows of interest operate in the high-advection/low-diffusion regime, where this scheme amounts to first-order upwinding (with no diffusion). Modern CFD practitioners seek much higher accuracy.Patankar also developed a power-law approximation to the exponential scheme, to overcome the heavy-handed switch-off of diffusion at Pe = 2. However, “powers” are as computationally expensive as exponentials.4.10.3 QUICK (QUadratic Interpolation for Convective Kinematics – Leonard, 1979)Fits a quadratic polynomial through 3 nodes to get 3rd -order accuracy.For each cell face, QUICK uses the nodes either side of thecell face, plus a further upwind node depending on thedirection of the flow as shown right.To emphasise the conservation property which associates fluxes with cell faces , notnodes, we shall, in future, for all such three-point schemes use the notation φD , φU and φUUfor the Downwind, Upwind and Upwind-Upwind nodes at any particular face.By fitting a quadratic polynomial to these nodes (see the Examples) the QUICK scheme gives:D UUU face φ+φ+φ−=φ834381 (22)u>0u<0For example, if u > 0 on the east face then:E P W e φ+φ+φ−=φ834381 whereas, if u < 0:P E E e φ+φ+φ−=φ834381Assessment • 3rd -order accurate. • Conservative by construction. • Transportive (upwind bias in the selection of the third node and relative weightings). • Not bounded; (for example, if u > 0 then a E is negative – see the Examples).Despite boundedness not being guaranteed (which can be a major problem in turbulent flows, where k and ε are required to be positive – see later) the high-order accuracy of the QUICK scheme make it popular and widely-used.4.10.4 Flux-Limited SchemesHitherto we have only seen schemes where the matrix coefficients a F are constants (i.e. independent of the solution φ). The only unconditionally-bounded scheme of this type is first-order upwind differencing. Schemes such as QUICK, which fit a polynomial through several points, are prone to generate cell-face values which lie outside the interpolating values φD , φU , φUU . To prevent this, modern schemes employ solution-dependent limiters , which enforce boundedness whilst trying to retain high-order accuracy wherever possible.For three-point schemes, φ is said to be: monotonic increasing if D U UU φ<φ<φ, monotonic decreasing if D U UU φ>φ>φ. A necessary condition for boundedness is that the schemes must default to first-order upwinding (i.e. φface = φU ) if φ is not locallymonotonic (either increasing or decreasing).Monotonic variation in φ may be gauged by whether the changes in φ between successive pairs of nodes have the same sign; i.e. 0))((>φ−φφ−φ⇔UU U U D monotonicSuch schemes can then be written (in the notation of Versteeg and Malalasakera) as the sum of the upstream value (φU ) and a solution-dependent fraction of the difference between downstream and upstream nodal values:φφ−φ+φ=φotherwise monotone if ))(UU D U face rwhere r is the ratio of successive differences (>0 where monotonic):U D UU U r φ−φφ−φ=monotonicThe limiter (r ) is given below for various schemes used at the University of Manchester.(r ) is taken as 0 if non-monotonic (i.e., r < 0).The choice of these examples is (obviously!) parochial. Many other equally-good schemes exist (see Versteeg and Malalasekera, 2nd edition, for a list). The important points about these schemes are that they are (a) bounded, and (b) non-linear (i.e. the resulting matrix elements depend on, and hence change with, the solution φ). The last property means that an iterative numerical solution is inevitable.4.11 Implementation of Advanced Advection SchemesThe general steady-state scalar transport equation issourcediffusion advection SV A C faces=−φ∑)( (23)If C and D are the outward mass flux and diffusive transport coefficient on each cell face, then, with the standard discretisation for diffusion and sources, (23) becomes P P P facesF P face s b D C φ+=φ−φ+φ∑)]([where F denotes an adjacent node and P is the index of the cell-centre node. Since 0=∑C by mass conservation, it is convenient to subtract P C φ∑ (which is 0) from both sides:P P P facesF P P faces b D C φ+=φ−φ+φ−φ∑)]()([(24)An advection scheme (Upwind, Central, QUICK, …) is needed to specify the cell-face value φface . Because many matrix-solution algorithms require positive coefficients and diagonal dominance, it is common practice to separate φface into the Upwind part plus a correction; i.e. )(U face U face φ−φ+φ=φThen, for the advective flux:)())(0,max()()()(U face F P correctionU face upwindP U P face C C C C C φ−φ+φ−φ−=φ−φ+φ−φ=φ−φ443442143421 (25)The first part of (25) gives rise to a positive matrix coefficient D C a F +−=)0,max(whilst the latter part is transferred to the RHS of the equation as what is called a deferred correction ; (“deferred” because it won’t be updated until the next iteration): 444344421correctiondeferred faces U face P P P FF P F C s b a ∑∑φ−φ−φ+=φ−φ)()(4.12 Implementation of Boundary ConditionsThe most common types of boundary condition are: • value φ specified (Dirichlet boundary conditions); e.g. φ = 0: velocity at a wall, or temperature fixed at some surface; • gradient ∂φ/∂n specified (Neumann boundary conditions). e.g. ∂φ/∂n = 0 on a symmetry plane, or at an outflow boundary.In the finite-volume method, both types of boundary condition can be implemented by transferring the boundary flux to the source term .For a cell abutting a boundary: source flux flux boundary boundarynot=+∑⇓boundary P F F boundarynot P P flux b a a −=φ−φ∑Thus, there are two modifications:• the a F coefficient in the direction of the boundary is set to zero; • the outward boundary flux is subtracted from the source terms.If flux (φ) is specified on the boundary, then this is immediate. If φ itself is fixed on the boundary node B then, with x the width of the cell:)(2)(P B D A flux φ−φ−=−=φTo subtract this flux from the source term requires a simple change of coefficients: D s s D b b P P B P P 2,2−→φ+→ (26)(You should revisit the classroom examples of Sections 4.4 and 4.5 to see this in action.)b o u n d a r yboundary4.13 Solution of the Algebraic EquationsThe discretisation of a single scalar-transport equation over a single control volume produces an algebraic equation of the form P F F P P b a a =φ−φ∑where the summation is over adjacent nodes. Combining the equations for all control volumes produces a set of simultaneous equations, i.e. a matrix equation b A =Φwhere Φ is the vector of nodal values. Matrix A is sparse (i.e. has only a few non-zero elements). Many algebraic methods have been used to tackle this problem; a few that are suitable for structured grids are mentioned below.4.13.1 Matrix Solution AlgorithmsGaussian EliminationThis is a direct (i.e. non-iterative) method. It consists of a sequence of row operations to obtain zeros below the main diagonal (upper-triangular matrix), followed by back-substitution.In general, it is inefficient because it tends to fill in sparse matrices (tridiagonal systems are an important exception), whilst for fluid-flow problems the matrix elements vary with the solution, so that an iterative solution is necessary anyway.Gaussian elimination is OK for small hand calculations, but not recommended for large systems of equations.Gauss-SeidelRearrange the equation foreach control volume as aniterative update for thecentral node:)*(1∑φ+=φF F P PP a b a(the asterisk * denotes the current value). Thenrepeatedly cycle through the entire set of equationsuntil convergence is achieved.Gauss-Seidel is very simple to code and is often used for unstructured grids. However, it tends to converge slowly for large matrices and may require substantial under-relaxation (see below).。