CFX-4
Introductory Training (Dec 1999)
0-1
CFX-4.3 V4.3.1H
CFX-4
培训教材
ATE北京办事处
CFX-4
Introductory Training (Dec 1999)
0-2
CFX-4.3 V4.3.1H 2
CFD分析过程
? 定义问题
几何
> 范围:流体流动区域
> 结构:多块结构化
网格
> 几何体被划分为许多网格单元
> 在每一个网格单元上求解质量、动量、能量等方程,
> U,V,W,P,T,等各个变量定义在每个网格单元中心
> CFX-4 网格是“多块结构化网格”和“贴体网格”
CFX-4
Introductory Training (Dec 1999)
0-3
CFX-4.3 V4.3.1H 3
CFD分析过程
边界条件
物理现象
> 流体属性,诸如密度、粘度等
> 模型的选择,诸如湍流模型、燃烧模型等,
多块结构网格
CFX-4
Introductory Training (Dec 1999)
0-4
CFX-4.3 V4.3.1H 4
CFD分析过程
? 求解
定义求解器控制参数
求解控制方程
动态监视求解过程
收敛后获得结果,
CFX-4
Introductory Training (Dec 1999)
0-5
CFX-4.3 V4.3.1H 5
CFD分析过程
? 结果显示
文本和图形两种格式,
CFX-4
Introductory Training (Dec 1999)
0-6
CFX-4.3 V4.3.1H 6
用 CFX-4进行 CFD分析
前处理 后处理求解器
CFX-Build
CFX-Setup
.geo
.fcSolver
.dmp
.fo
CFX-4
Introductory Training (Dec 1999)
0-7
CFX-4.3 V4.3.1H 7
CFX-4 结构框图
CFX-
Build
Command
File
restartGeometry
File
FORTRAN
(optional)
Dump
File
Output
File
CFX-
Visualise
CFX-
Setup
CFX-
Meshimport
CFX-4
CFX-
Analyse
CFX-4
Introductory Training (Dec 1999)
0-8
CFX-4.3 V4.3.1H 8
CFX-4中的物理模型
? 稳态流动 /瞬态流动
? 层流
? 湍流
k-e
Low Re k-e
Low Re K-omega
RNG k-e
Algebraic Reynolds stress
Differential Reynolds stress
Reynolds flux
? ( 藕合)传热问题
? 压缩流
弱可压缩流
完全可压缩流
? 浮力流
Boussinesq approx.
Full buoyancy for
compressible flow
? 标量传输
? 非牛顿流模型
Power law
Bingham plastic
Bird-Carreau
Cross
Herschel-Bulkley
CFX-4
Introductory Training (Dec 1999)
0-9
CFX-4.3 V4.3.1H 9
CFX-4中的物理模型
? 直角坐标 /柱坐标
? 旋转坐标
? 滑移网格
? 多流体模型
Homogeneous
> Free surface,surface
tension
Multi-fluid
> MUSIG
Solidification
? 颗粒输送模型
喷雾干燥模型
煤或油燃烧模型
? 燃烧问题
混合燃烧模型
> Coal combustion
> Oil combustion
> NOx model
旋涡破碎模型
> Magnussen soot model
? 化学动力学模型
Link with PFDReaction
? 多孔介质
? 辐射问题(可选)
离散传输模型
Monte Carlo模型
CFX-4
Introductory Training (Dec 1999)
0-10
CFX-4.3 V4.3.1H 10
CFX-4 求解器特点
? 有限体积法,同位网格,
? SIMPLE,SIMPLEC,或 PISO 法用于压力 -速度
修正。
? 时间导数项的离散
全隐式向后差分(缺省设置)
Crank-Nicolson
固定或自适应时间步长,
? 对流项有不同的差分格式,
? 线形求解方法
代数多重网格 (AMG),耦合梯度 (ICCG),块迭代,
线迭代
CFX-4
Introductory Training (Dec 1999)
0-11
CFX-4.3 V4.3.1H 11
CFX-4中边界条件
? Walls - temperature,heat flux,no slip,free slip.
? Flow boundaries:
Pressure,mass flow rate,velocity.
? Symmetry planes.
? Periodic planes.
? Internal baffles (thin surfaces).
? Solids,conducting solids,porous regions.
CFX-4
Introductory Training (Dec 1999)
0-12
CFX-4.3 V4.3.1H
第二讲
BUILD
(一)
CFX-4
Introductory Training (Dec 1999)
0-13
CFX-4.3 V4.3.1H
CFX-BUILD的目标
? 几何建模 /模型读入
? 创建多块结构体
? 创建 patches
? 划分网格
? 创建 geo 文件,
应该学会以下几个方面的功能
CFX-4
Introductory Training (Dec 1999)
0-14
CFX-4.3 V4.3.1H
多块结构化网格
? 几何由一组六面体组成
? 每一个体叫做一个 ‘ solid’.
? 几何体中的每一个‘ solid’可以是流体流动区域
、多孔介质区域或固体区域,
CFX-4
Introductory Training (Dec 1999)
0-15
CFX-4.3 V4.3.1H
多块结构化网格
? 两个相邻的体若有一个公共面,其网格自动匹
配,
? 两个相邻的体若没有一个公共面, 需要用约束
Constraints
? Constraints 可以使网格强制匹配
CFX-4
Introductory Training (Dec 1999)
0-16
CFX-4.3 V4.3.1H 16
多块结构化网格
? 多块结构,
多块合起来形成流动区域,
每一块有 6个面,8个点,12条边
每一块的网格为结构化网格,
每一块由一系列网格单元组成
CFX-4
Introductory Training (Dec 1999)
0-17
CFX-4.3 V4.3.1H
T-Junction Example
CFX-4
Introductory Training (Dec 1999)
0-18
CFX-4.3 V4.3.1H
Square to Circular Duct Example
CFX-4
Introductory Training (Dec 1999)
0-19
CFX-4.3 V4.3.1H 19
多块结构的优点
? 比单块网格用更少的网格单元、内存和 CPU时

Single block Two blocks
CFX-4
Introductory Training (Dec 1999)
0-20
CFX-4.3 V4.3.1H 20
多块结构的优点
? 减少网格扭曲度,使结果更加精确
One block Five blocks
CFX-4
Introductory Training (Dec 1999)
0-21
CFX-4.3 V4.3.1H 21
多块结构的优点
? 网格局部加密
CFX-4
Introductory Training (Dec 1999)
0-22
CFX-4.3 V4.3.1H 22
多块结构的优点
? 复杂结构,
CFX-4
Introductory Training (Dec 1999)
0-23
CFX-4.3 V4.3.1H
与 BUILD有关的文件
BUILD
CAD Data
Session File:
cfxbuild4.ses.*
list of commands
from last
session
Journal File:
name.db.jou
contains all
session files
Database file
name.db
Geo file:
m01.geo -
CFX-4
input
Iges,Patran neutral
ProE,Catia,Euclid
CFX-4
Introductory Training (Dec 1999)
0-24
CFX-4.3 V4.3.1H
主窗口
CFX-4
Introductory Training (Dec 1999)
0-25
CFX-4.3 V4.3.1H
? Entity
? Multiple Picking
(shift click)
? Rectangle
(click & drag)
? Polygonal
? Deselect
? Cycle Picking
? Model
Manipulation
Ctrl
?Shift
Cursor Picking
?Shift
CFX-4
Introductory Training (Dec 1999)
0-26
CFX-4.3 V4.3.1H
BUILD的操作过程
- 通过点、线、面、体进行几何建模,
- 对不匹配的相邻体用约束,
- 定义边界条件的名字与类型 (inlet,outlet,walls).
- 划分表面网格,
-生成体网格和 geo文件,
Geometry
Constraints
Patches
Mesh
Analysis
CFX-4
Introductory Training (Dec 1999)
0-27
CFX-4.3 V4.3.1H
Geometry Building
? points (cyan).
? curves (yellow)
? simple surfaces (green) are composed of 4
edges and 4 vertices
? solids (blue)
characterized by a bounding set of surfaces
6 surfaces,8 vertices
parametric function of 3 variables (I,J,K)
meshed with the isomesher
non-parametric solids (B-rep) cannot be used to
create a structured grid.
CFX-4
Introductory Training (Dec 1999)
0-28
CFX-4.3 V4.3.1H
Methodology
ACTION OBJECT METHOD
Create
Edit
Delete
Transform
Point
Curve
Surface
Solid
Coordinate
XYZ
Revolve
Scale
Extrude
Glide
.
.
.
CFX-4
Introductory Training (Dec 1999)
0-29
CFX-4.3 V4.3.1H
Geometry Form Actions
? the Action selected determines the choice of
Objects,
? the Object selected determines the choice
of Methods.
CFX-4
Introductory Training (Dec 1999)
0-30
CFX-4.3 V4.3.1H
Action Commands
? create
creates an object.
? edit
modifies original object.
? show
provides information about object.
? transform
creates new objects by modifying the original.
? delete
removes object from viewport.
CFX-4
Introductory Training (Dec 1999)
0-31
CFX-4.3 V4.3.1H
Create/Point/XYZ
? create a point
using cartesian,
cylindrical,or
spherical
coordinates.
CFX-4
Introductory Training (Dec 1999)
0-32
CFX-4.3 V4.3.1H
Create/Curve/Point
? creates a curve
based on 2,3,
or 4 points.
CFX-4
Introductory Training (Dec 1999)
0-33
CFX-4.3 V4.3.1H
Create/Curve/Project
? new curves are
projected to a
surface.
? projection direction
specified as:
normal to plane
normal to surface
along a vector
along a viewfactor
of the viewport.
CFX-4
Introductory Training (Dec 1999)
0-34
CFX-4.3 V4.3.1H
Create/Curve/Intersect
? new curves created
by intersecting a
surface with
another surface (2-
surface option)
flat plane defined
normal to the surface
(plane-surface
option).
CFX-4
Introductory Training (Dec 1999)
0-35
CFX-4.3 V4.3.1H
Create/Surface/Curve
? creates surfaces
between a list of
2 or more
curves.
CFX-4
Introductory Training (Dec 1999)
0-36
CFX-4.3 V4.3.1H
Create/Surface/Edge
? creates a new
surface by using 4
edges.
CFX-4
Introductory Training (Dec 1999)
0-37
CFX-4.3 V4.3.1H
Create/Solid/Surface
? create a solid
between a list of
2 or more
surfaces.
CFX-4
Introductory Training (Dec 1999)
0-38
CFX-4.3 V4.3.1H
Create/Solid/Face
? create a solid
based on 6 exterior
faces.
? boundary faces
must be simple
surfaces (green).
CFX-4
Introductory Training (Dec 1999)
0-39
CFX-4.3 V4.3.1H
Transform/Point/Translate
? creates points by
specifiying an off-
set.
CFX-4
Introductory Training (Dec 1999)
0-40
CFX-4.3 V4.3.1H
Transform/Curve/Translate
? creates a new
curve by specifying
translation vector.
CFX-4
Introductory Training (Dec 1999)
0-41
CFX-4.3 V4.3.1H
Transform/Surface/Scale
CFX-4
Introductory Training (Dec 1999)
0-42
CFX-4.3 V4.3.1H
Edit/Curve/Merge
? combines existing
curves to form one or
more new curves.
CFX-4
Introductory Training (Dec 1999)
0-43
CFX-4.3 V4.3.1H
Edit/Curve/Break
? creates two curves
by breaking an
original curve with a
point,or at a
parametric position.
? parametric
directions may be
viewed using
Display/Geometry/S
how_Parametric_Di
rection.
CFX-4
Introductory Training (Dec 1999)
0-44
CFX-4.3 V4.3.1H
Coordinate Frame
? cartesian,cylindrical,and spherical
Create Delete Show TransformAction
Object
Method
Coord Coord Coord Coord
Attributes Translate
Rotate
3 point
Axis
Euler
Normal
CFX-4
Introductory Training (Dec 1999)
0-45
CFX-4.3 V4.3.1H
Show Command
Point Curve Solid Coord Plane Vector Surface
Locat,
Dist.
Node
Node
Lth.Rg
Angle
Arc
Attrib,Attrib,
Node
Normal
Ar,Rng.
Attrib,
ShowAction
Object
Method
CFX-4
Introductory Training (Dec 1999)
0-46
CFX-4.3 V4.3.1H
Deleting Geometry
Delete
Solid Curve Point Any Surf,Coord
Action
Object
CFX-4
Introductory Training (Dec 1999)
0-47
CFX-4.3 V4.3.1H
第三讲
BUILD
(二)
CFX-4
Introductory Training (Dec 1999)
0-48
CFX-4.3 V4.3.1H
BUILD的操作过程
- 通过点、线、面、体进行几何建模,
- 对不匹配的相邻体用约束,
- 定义边界条件的名字与类型 (inlet,outlet,walls).
- 划分表面网格,
-生成体网格和 geo文件,
Geometry
Constraints
Patches
Mesh
Analysis
CFX-4
Introductory Training (Dec 1999)
0-49
CFX-4.3 V4.3.1H
Constraints
? 当两个相邻的体其交接
面大小不相等时,需要
用约束( Constraints),
? 约束的目的是使相邻体
之间的网格匹配
Parent Face
Child Face
CFX-4
Introductory Training (Dec 1999)
0-50
CFX-4.3 V4.3.1H
Constraints
在 CFX Build 中有两种类型的 constraints.
1,Simple
2,Advanced
? Simple constraints- 用于有一个父面和一个子面,并
且子面完全包含在父面内部的情况
? Advanced constraints-用于有一个父面,子面可以有
一个或多个,并且子面的边可以在父面的边上。
CFX-4
Introductory Training (Dec 1999)
0-51
CFX-4.3 V4.3.1H
Creating Constraints
? 定义相对应的父面和
子面的起点。
? 定义相对应的父面和
子面的方向点。
? 定义两个方向上的网
格比率。
CFX-4
Introductory Training (Dec 1999)
0-52
CFX-4.3 V4.3.1H
Parent/Child Points
? parent points:
any of four
points
surrounding the
parent face.
? child points
any of four
points
surrounding the
child face.
12
3 4
56
7 8
CFX-4
Introductory Training (Dec 1999)
0-53
CFX-4.3 V4.3.1H
Alignment of Points
? 确保父面和子面的对应边在一个方向上,
? 若不在一个方向上,则需旋转子面,
Wrong Right
CFX-4
Introductory Training (Dec 1999)
0-54
CFX-4.3 V4.3.1H
方向的对应关系
? 定义父面和子面的第一个方向,
? 父面和子面的第一个方向应当相同
S1
C1
E1
S2 C2 E2
First
Direction
Second Direction
CFX-4
Introductory Training (Dec 1999)
0-55
CFX-4.3 V4.3.1H
网格比率的确定
R1 = 2/(2+2) = 0.5
R2 = 2/(2+2) = 0.5
R1 = 2/(2+2) = 0.5
R2 = 3/(3+1) = 0.75
2
1
2
1
CFX-4
Introductory Training (Dec 1999)
0-56
CFX-4.3 V4.3.1H
Advanced Constraints
? 创建一系列子面,完全覆盖父面,
Patch 1
Patch 2
Patch 3
CFX-4
Introductory Training (Dec 1999)
0-57
CFX-4.3 V4.3.1H
Advanced Constraint Creation
? 在 geometry 窗口,设 Action/Object/Method 为
Associate/Curve/Curve 。 对每一条父面的边和在其上的子面的
边做关联
? 在划分网格时,应先对子面划分,然后对其它面划分,
? Constraints只有当 analysis时才执行,
? 建议最好用多块结构而不用 Constraints
CFX-4
Introductory Training (Dec 1999)
0-58
CFX-4.3 V4.3.1H
Examples of Constraints
child
faces
parent
face
Advanced Constraint
child
face
parent
face
Simple Constraint
child
face
parent
face
CFX-4
Introductory Training (Dec 1999)
0-59
CFX-4.3 V4.3.1H
Example of Constraints
? Simple constraints may not be used for
adjacent surfaces on which advanced
constraints are defined,Rather both must be
advanced constraints.
Advanced
Constraint
Advanced
Constraint
CFX-4
Introductory Training (Dec 1999)
0-60
CFX-4.3 V4.3.1H
BUILD的操作过程
- 通过点、线、面、体进行几何建模,
- 对不匹配的相邻体用约束,
- 定义边界条件的名字与类型 (inlet,outlet,walls).
- 划分表面网格,
-生成体网格和 geo文件,
Geometry
Constraints
Patches
Mesh
Analysis
CFX-4
Introductory Training (Dec 1999)
0-61
CFX-4.3 V4.3.1H
Patches
? 定义区域和边界类型,
? 通过名字确定类型,
? 2-D
inlet,press,outlet,wall,symmet,cndbdy,user2d.
? 3-D
solid,solcon,porous,user3d.
? valid inlet patch names:
inlet_1,inlet1,inlet,etc.
CFX-4
Introductory Training (Dec 1999)
0-62
CFX-4.3 V4.3.1H
BUILD的操作过程
- 通过点、线、面、体进行几何建模,
- 对不匹配的相邻体用约束,
- 定义边界条件的名字与类型 (inlet,outlet,walls).
- 划分表面网格,
-生成体网格和 geo文件,
Geometry
Constraints
Patches
Mesh
Analysis
CFX-4
Introductory Training (Dec 1999)
0-63
CFX-4.3 V4.3.1H
Meshing
? number of elements per edge is based on the
following priority:
mesh seeds
adjoining mesh regions which are topologically
congruent
global edge length.
CFX-4
Introductory Training (Dec 1999)
0-64
CFX-4.3 V4.3.1H
Mesh Seeds
? Explicitly specify the number of elements for an
edge,
? Inconsistent mesh seeding may cause errors.
? Use Ensure Consistent Seeding toggle when
specifying mesh seeds.
CFX-4
Introductory Training (Dec 1999)
0-65
CFX-4.3 V4.3.1H
Global Edge Length
? When no mesh seeds or adjoining mesh
occurs in a path,the Global Edge Length and
the longest edge in the mesh path determines
the number of elements per edge.
length of longest geometrical edge in path
Global Edge Length# of elements =
CFX-4
Introductory Training (Dec 1999)
0-66
CFX-4.3 V4.3.1H
Meshing Surfaces
? Mesh must be 4 sided (displayed with green
lines).
? If there are any magenta colored surfaces,
decomposition of the surface is necessary.
CFX-4
Introductory Training (Dec 1999)
0-67
CFX-4.3 V4.3.1H
BUILD的操作过程
- 通过点、线、面、体进行几何建模,
- 对不匹配的相邻体用约束,
- 定义边界条件的名字与类型 (inlet,outlet,walls).
- 划分表面网格,
-生成体网格和 geo文件,
Geometry
Constraints
Patches
Mesh
Analysis
CFX-4
Introductory Training (Dec 1999)
0-68
CFX-4.3 V4.3.1H
Analysis
? Last stage of the mesh generation process.
? Several options
equivalencing
reblocking
2d axisymmetric problem set up
calculate mesh quality.
? Specify solids for internal volume meshing
? VOLMSH starts batch creation of the geo file.
CFX-4
Introductory Training (Dec 1999)
0-69
CFX-4.3 V4.3.1H
Analysis Options
? application of constraints and equivalencing
scaling of geometry
coordinate system
volume mesh generator and parameters
mesh quality checking
orthogonality,grid expansion,cell volume,skew ratio,...
CFX-4
Introductory Training (Dec 1999)
0-70
CFX-4.3 V4.3.1H
第四讲
COMMAND FILE
CFX-4
Introductory Training (Dec 1999)
0-71
CFX-4.3 V4.3.1H
CFX Command File
? A command file (m##.fc) is required to run
CFX-4
The command file defines
> Problem characteristics
> Physical models and parameters
> Material properties
> Equation solvers
> Convergence criteria
> Boundary conditions
> Output options.
CFX-4
Introductory Training (Dec 1999)
0-72
CFX-4.3 V4.3.1H
CFX Command File
? The Command Language
Uses commands (starting with >>)
Commands may have subcommands
Keywords qualify the command
Keywords may be followed by integers,real
numbers,characters.
CFX-4
Introductory Training (Dec 1999)
0-73
CFX-4.3 V4.3.1H
CFX Command File
? The top level commands are
>>CFX4
>>MODEL TOPOLOGY (may be not necessary)
>>MODEL DATA
>>SOLVER DATA
>>CREATE GRID (may be not necessary)
>>MODEL BOUNDARY CONDITIONS
>>OUTPUT OPTIONS
>>STOP
CFX-4
Introductory Training (Dec 1999)
0-74
CFX-4.3 V4.3.1H
Case Study
/* This command file has been set up */
/* for the T junction example */
>>CFX4
>>OPTIONS
THREE DIMENSIONS
BODY FITTED GRID
CARTESIAN COORDINATES
TURBULENT FLOW
HEAT TRANSFER
INCOMPRESSIBLE FLOW
STEADY STATE
USE DATABASE
>>MODEL DATA
>>MATERIALS DATABASE
>>SOURCE OF DATA
PCP
>>FLUID DATA
FLUID 'AIR'
MATERIAL TEMPERATURE 2.8800E+02
MATERIAL PHASE 'GAS'
>>TITLE
PROBLEM TITLE 'MY FIRST CFX-4 COMMAND FILE'
CFX-4
Introductory Training (Dec 1999)
0-75
CFX-4.3 V4.3.1H
Case Study
>>SOLVER DATA
>>PROGRAM CONTROL
MAXIMUM NUMBER OF ITERATIONS 200
OUTPUT MONITOR POSITION 0.107 0.0476 0.0275
MASS SOURCE TOLERANCE 1.0000E-06
>>MODEL BOUNDARY CONDITIONS
>>INLET BOUNDARIES
PATCH NAME 'INLET1'
/* NORMAL VELOCITY 4.0000E-01 */
W VELOCITY 4.0000E-01
K 3.2000E-04
EPSILON 1.5260E-05
TEMPERATURE 3.0500E+02
>>INLET BOUNDARIES
PATCH NAME 'INLET2'
/* NORMAL VELOCITY 6.0000E-01 */
W VELOCITY -6.0000E-01
K 7.2000E-04
EPSILON 5.1520E-05
TEMPERATURE 2.9500E+02
>>WALL BOUNDARIES
PATCH NAME 'WALL1'
TEMPERATURE 2.8800E+02
>>STOP
CFX-4
Introductory Training (Dec 1999)
0-76
CFX-4.3 V4.3.1H
CFX-Setup
A command file can be created & edited by
? Using CFX-Setup
? Using an editor.
CFX-4
Introductory Training (Dec 1999)
0-77
CFX-4.3 V4.3.1H
? CFX-Setup is accessed within the
Environment.
? 3 levels to tailor the complexity of the program
to your experience and need
Beginner (default),Intermediate,Advanced.
? Files can be read in & displayed
Command file,geometry file.
? Select Active Keywords to toggle on or off
keywords.
? Order of working
From left to right,relevant options become
available later on.
CFX-Setup
CFX-4
Introductory Training (Dec 1999)
0-78
CFX-4.3 V4.3.1H
第五讲
求解器
CFX-4
Introductory Training (Dec 1999)
0-79
CFX-4.3 V4.3.1H
CFX-4 基本概念
? CFX-4求解方程的通用形式
? 在控制体上进行积分
transient convection diffusion source
SUt ????????? )()( ????? ? ? ?
? ? ?
? ?? ?t dV U n dA n dA SdV? ???? ? ? ? ?
? ? ???,
CFX-4
Introductory Training (Dec 1999)
0-80
CFX-4.3 V4.3.1H
CFX-4 基本概念
? 各项在时间和空间上离散,得到线形方程
Discretization
> Transient term,backward difference,Crank-Nicolson
> Convection term,Hybrid,HUW,QUICK,CCCT,etc.
> Diffusion term,2nd order central differencing.
线形方程组是耦合的,直接的矩阵解法不经济,因
此采用迭代解法
> ICCG,AMG,Stone,line relaxation,etc.
A A Sp p nb
nb nb u
? ?? ?? p N C E L L? 1 2,,,?
CFX-4
Introductory Training (Dec 1999)
0-81
CFX-4.3 V4.3.1H
CFX-4 基本概念
? CFX-4 使用 SIMPLE系列迭代算法,求解过程如
下。
initial guess
final solution
U momentum equation
V momentum equation
W momentum equation
pressure (mass) equation
…,..
sweeps
(inner
iterations)nonlinearouter
iterations
convergence
CFX-4
Introductory Training (Dec 1999)
0-82
CFX-4.3 V4.3.1H
如何得到收敛结果
? 低松弛 Under- relaxation:
可以改进收敛性,
加入低松弛因子的输运方程改变为,
式中低松弛因子 URF =< 1.0。
Φ0 为当前迭代步的变量值,
0)0.1(
ppunb
nb
nbp
p A
U R F
U R FSA
U R F
A ??? ???? ?
CFX-4
Introductory Training (Dec 1999)
0-83
CFX-4.3 V4.3.1H
如何得到收敛结果
? 假时间步长,
加入低松弛因子的输运方程改变为,
一般在浮力流和多相流时有用,
在计算开始可以采用较小的时间步以改善收敛性,
需要知道物理问题的时间尺度,
0
punb
nb
nbpp t
VSA
t
VA ?????
??????
??
?
?
?? ?
CFX-4
Introductory Training (Dec 1999)
0-84
CFX-4.3 V4.3.1H
如何得到收敛结果
? Courant false time-steps,
不需要知道物理问题的时间尺度,
根据网格尺寸和当地速度确定时间尺度
可以对不同的变量设不同的时间步长,
同时起到采用低松弛因子和加时间步长的效果。
CFX-4
Introductory Training (Dec 1999)
0-85
CFX-4.3 V4.3.1H
如何得到收敛结果
? How to modify the
underrelaxation factors.
>>SOLVER DATA
>>UNDER RELAXATION FACTORS
U VELOCITY 0.65
V VELOCITY 0.65
W VELOCITY 0.65
PRESSURE 1.0
ENTHALPY 1.0
? How to modify the linear
equation solvers.
>>SOLVER DATA
>>EQUATION SOLVERS
U VELOCITY ‘STONE’
V VELOCITY ‘STONE’
W VELOCITY ‘STONE’
PRESSURE ‘ICCG’
ENTHALPY ‘AMG’
CFX-4
Introductory Training (Dec 1999)
0-86
CFX-4.3 V4.3.1H
如何得到收敛结果
? Deferred Correction,
非正交网格在湍流计算中容易引起发散,
DEFERRED CORRECTION能减少 k 和 ε 方程中的扩
散项,促进收敛,
For example:
>>SOLVER OPTIONS

>>DEFERRED CORRECTION
K START 1
K END 100
EPSILON START 1
EPSILON END 100
CFX-4
Introductory Training (Dec 1999)
0-87
CFX-4.3 V4.3.1H
如何得到收敛结果
? 如仍有收敛问题,检查以下方面
check the command file
> fluid properties
> model data
> boundary conditions.
check user Fortran.
check the output file
> warning or error messages
> default values.
CFX-4
Introductory Training (Dec 1999)
0-88
CFX-4.3 V4.3.1H
如何得到收敛结果
check the initial guess
> complex problems need more reasonable initial flow
field,so restart from simplified calculations.
check the linear solver performance
> average reduction factors
> SOLVER DEBUG PRINTING
> for poor linear solver performance,decrease the target
reduction factors and increase the maximum number of
sweeps.
CFX-4
Introductory Training (Dec 1999)
0-89
CFX-4.3 V4.3.1H
如何得到收敛结果
check the grid quality
> orthogonality,grid stretch (<2 in general),etc.
> residuals in the whole field.
> to improve you may need to re-build the block structure
or re-mesh the geometry.
poor good
CFX-4
Introductory Training (Dec 1999)
0-90
CFX-4.3 V4.3.1H
如何得到收敛结果
reduce the under-relaxation factors if the
residuals display unstable oscillations.
use AMG linear solver for complicated block
structures.
? See chapter 6 of CFX-4,Solver manual for
more details.
? Contact CFX Support line.
CFX-4
Introductory Training (Dec 1999)
0-91
CFX-4.3 V4.3.1H
第六讲
User FORTRAN
CFX-4
Introductory Training (Dec 1999)
0-92
CFX-4.3 V4.3.1H
User FORTRAN
? The user FORTRAN 用于
不能通过 command file设立的复杂特性,如
> 如非均匀的速度分布,变化的物性参数,移动网格等 …
方便
灵活,
? User FORTRAN 大大增强了 CFX-4的功能,
? 从 CFX-Environment 中可以获得 user
FORTRAN routines.
CFX-4
Introductory Training (Dec 1999)
0-93
CFX-4.3 V4.3.1H
常用 User FORTRAN
? USRBCS
> 允许用户设立非均匀分布的边界条件,
? USRBF
> 允许用户设立体积力,
? USRCND
> 允许用户设立变化的导热系数,
? USRSRC
> 允许用户加入源项
? USRVIS
> 允许用户设立粘性,
CFX-4
Introductory Training (Dec 1999)
0-94
CFX-4.3 V4.3.1H
常用 User FORTRAN
? USRDEN
> 允许用户设立密度和密度随压力的导数项,
? USRGRD
> 允许用户设立特定的网格,
? USRINT
> 允许用户设立初场,
? USRPBC
> 允许用户设立颗粒边界条件
CFX-4
Introductory Training (Dec 1999)
0-95
CFX-4.3 V4.3.1H
常用子程序
GETVAR
> 对一个变量,允许用户找到其方程序列号,
IPALL
> 返回体( block) 或面( patch) 上网格的地址,
IPREC
> 返回体( block) 或面( patch) 上网格的地址,仅用于单个
体或面
SETWRK,DELWRK
> 分配或释放临时空间,
CFX-4
Introductory Training (Dec 1999)
0-96
CFX-4.3 V4.3.1H
如何使用 FORTRAN
? 要用 FORTRAN routine
Obtain the template by
clicking on User Fortran
within the Environment,
and Get Fortran.
Edit the FORTRAN
routine and ensure the
IUSED flag is set to 1.
Include the routine in the
command file
? OPTIONS
...,..
? USER FORTRAN
USRSRC
Specify the user
FORTRAN file when
running the solver.
CFX-4
Introductory Training (Dec 1999)
0-97
CFX-4.3 V4.3.1H
Case Study - Adding a Source
? In the command file
>>OPTIONS

>>USER FORTRAN
USRSRC

? In the fortran
file IUSED=1.
? Run the solver.
CFX-4
Introductory Training (Dec 1999)
0-98
CFX-4.3 V4.3.1H
Adding a Heat Source
? Numerical consideration
> the source terms can be linearized in different ways
> Sp, contribution of the source terms to the diagonal of
the coefficient matrix
> Su, remaining source terms.
To retain diagonal dominance of the linear
equation system (for numerical stability &
accuracy)
> Sp, should be negative,otherwise put into Su.
A A S Sp p nb
nb nb u p p
? ? ?? ? ??
CFX-4
Introductory Training (Dec 1999)
0-99
CFX-4.3 V4.3.1H
Adding a Heat Source
User FORTRAN:
SUBROUTINE USRSRC(IEQN,ICALL,CNAME,CALIAS,AM,SP,SU,CONV
+,U,V,W,P,VFRAC,DEN,VIS,TE,ED,RS,T,H,RF,SCAL
+,XP,YP,ZP,VOL,AREA,VPOR,ARPOR,WFACT,IPT
+,IBLK,IPVERT,IPNODN,IPFACN,IPNODF,IPNODB,IPFACB
+,WORK,IWORK,CWORK)
C
C**********************************************************************
C
C UTILITY SUBROUTINE FOR USER-SUPPLIED SOURCES
C
C >>> IMPORTANT <<<
C >>> <<<
C >>> USERS MAY ONLY ADD OR ALTER PARTS OF THE SUBROUTINE WITHIN <<<
C >>> THE DESIGNATED USER AREAS <<<
C
C**********************************************************************
C
C THIS SUBROUTINE IS CALLED BY THE FOLLOWING SUBROUTINES
C CUSR SCDF SCDS SCED SCENRG SCHF SCMOM SCPCE SCSCAL
C SCTE SCVF
C
C***********************************************************************
CFX-4
Introductory Training (Dec 1999)
0-100
CFX-4.3 V4.3.1H
Adding a Heat Source
C***********************************************************************
C CREATED
C 08/03/90 ADB
C MODIFIED
C 04/03/91 ADB ALTERED ARGUMENT LIST.
C 28/08/91 IRH NEW STRUCTURE
C 28/09/91 IRH CHANGE EXAMPLE + ADD COMMON BLOCKS
C 10/02/92 PHA UPDATE CALLED BY COMMENT,ADD RF ARGUMENT,
C CHANGE LAST DIMENSION OF RS TO 6 AND IVERS TO 2
C 03/06/92 PHA ADD PRECISION FLAG AND CHANGE IVERS TO 3
C 23/11/93 CSH EXPLICITLY DIMENSION IPVERT ETC.
C 07/12/93 NSW INCLUDE CONV IN ARGUMENT LIST AND CHANGE IVERS
C TO 4
C 03/02/94 PHA CHANGE FLOW3D TO CFDS-FLOW3D
C 03/03/94 FHW CORRECTION OF SPELLING MISTAKE
C 08/03/94 NSW CORRECT SPELLING
C 09/08/94 NSW CORRECT SPELLING.
C MOVE 'IF(IUSED.EQ.0) RETURN' OUT OF USER AREA.
C INCLUDE COMMENT ON MASS SOURCES.
C 19/12/94 NSW CHANGE FOR CFX-F3D
C
C***********************************************************************
CFX-4
Introductory Training (Dec 1999)
0-101
CFX-4.3 V4.3.1H
Adding a Heat Source
C***********************************************************************
C
C SUBROUTINE ARGUMENTS
C
C IEQN - EQUATION NUMBER
C ICALL - SUBROUTINE CALL
C CNAME - EQUATION NAME
C CALIAS - ALIAS OF EQUATION NAME
C AM - OFF DIAGONAL MATRIX COEFFICIENTS
C SU - SU IN LINEARISATION OF SOURCE TERM
C SP - SP IN LINEARISATION OF SOURCE TERM
C CONV - CONVECTION COEFFICIENTS
C U - U COMPONENT OF VELOCITY
C V - V COMPONENT OF VELOCITY
C W - W COMPONENT OF VELOCITY
C P - PRESSURE
C VFRAC - VOLUME FRACTION
C DEN - DENSITY OF FLUID
C VIS - VISCOSITY OF FLUID
C TE - TURBULENT KINETIC ENERGY
C ED - EPSILON
C RS - REYNOLD STRESSES
C T - TEMPERATURE
C H - ENTHALPY
CFX-4
Introductory Training (Dec 1999)
0-102
CFX-4.3 V4.3.1H
Adding a Heat Source
C RF - REYNOLD FLUXES
C SCAL - SCALARS (THE FIRST 'NCONC' OF THESE ARE MASS FRACTIONS)
C XP - X COORDINATES OF CELL CENTRES
C YP - Y COORDINATES OF CELL CENTRES
C ZP - Z COORDINATES OF CELL CENTRES
C VOL - VOLUME OF CELLS
C AREA - AREA OF CELLS
C VPOR - POROUS VOLUME
C ARPOR - POROUS AREA
C WFACT - WEIGHT FACTORS
C
C IPT - 1D POINTER ARRAY
C IBLK - BLOCK SIZE INFORMATION
C IPVERT - POINTER FROM CELL CENTERS TO 8 NEIGHBOURING VERTICES
C IPNODN - POINTER FROM CELL CENTERS TO 6 NEIGHBOURING CELLS
C IPFACN - POINTER FROM CELL CENTERS TO 6 NEIGHBOURING FACES
C IPNODF - POINTER FROM CELL FACES TO 2 NEIGHBOURING CELL CENTERS
C IPNODB - POINTER FROM BOUNDARY CENTERS TO CELL CENTERS
C IPFACB - POINTER FROM BOUNDARY CENTERS TO BOUNDARY FACESS
C
C WORK - REAL WORKSPACE ARRAY
C IWORK - INTEGER WORKSPACE ARRAY
C CWORK - CHARACTER WORKSPACE ARRAY
C
CFX-4
Introductory Training (Dec 1999)
0-103
CFX-4.3 V4.3.1H
Adding a Heat Source
C SUBROUTINE ARGUMENTS PRECEDED WITH A '*' ARE ARGUMENTS THAT MUST
C BE SET BY THE USER IN THIS ROUTINE.
C
C NOTE THAT WHEN USING MASS SOURCES,THE FLOWS THROUGH MASS FLOW
C BOUNDARIES ARE UNCHANGED,THE USER SHOULD THEREFORE INCLUDE AT
C LEAST ONE PRESSURE BOUNDARY FOR SUCH A CALCULATION.
C
C NOTE THAT OTHER DATA MAY BE OBTAINED FROM CFX-F3D USING THE
C ROUTINE GETADD,FOR FURTHER DETAILS SEE THE VERSION 4
C USER MANUAL.
C
C***********************************************************************
C
LOGICAL LDEN,LVIS,LTURB,LTEMP,LBUOY,LSCAL,LCOMP
+,LRECT,LCYN,LAXIS,LPOROS,LTRANS
C
CHARACTER*(*) CWORK
CHARACTER CNAME*6,CALIAS*24
C
C+++++++++++++++++ USER AREA 1 +++++++++++++++++++++++++++++++++++++++++
C---- AREA FOR USERS EXPLICITLY DECLARED VARIABLES
C
C+++++++++++++++++ END OF USER AREA 1 ++++++++++++++++++++++++++++++++++
CFX-4
Introductory Training (Dec 1999)
0-104
CFX-4.3 V4.3.1H
Adding a Heat Source
C
COMMON
+ /ALL/ NBLOCK,NCELL,NBDRY,NNODE,NFACE,NVERT,NDIM
+ /ALLWRK/ NRWS,NIWS,NCWS,IWRFRE,IWIFRE,IWCFRE
+ /ADDIMS/ NPHASE,NSCAL,NVAR,NPROP
+,NDVAR,NDPROP,NDXNN,NDGEOM,NDCOEF,NILIST,NRLIST,NTOPOL
+ /CHKUSR/ IVERS,IUCALL,IUSED
+ /DEVICE/ NREAD,NWRITE,NRDISK,NWDISK
+ /IDUM/ ILEN,JLEN
+ /LOGIC/ LDEN,LVIS,LTURB,LTEMP,LBUOY,LSCAL,LCOMP
+,LRECT,LCYN,LAXIS,LPOROS,LTRANS
+ /MLTGRD/ MLEVEL,NLEVEL,ILEVEL
+ /SGLDBL/ IFLGPR,ICHKPR
+ /SPARM/ SMALL,SORMAX,NITER,INDPRI,MAXIT,NODREF,NODMON
+ /TRANSI/ NSTEP,KSTEP,MF,INCORE
+ /TRANSR/ TIME,DT,DTINVF,TPARM
C
C+++++++++++++++++ USER AREA 2 +++++++++++++++++++++++++++++++++++++++++
C---- AREA FOR USERS TO DECLARE THEIR OWN COMMON BLOCKS
C THESE SHOULD START WITH THE CHARACTERS 'UC' TO ENSURE
C NO CONFLICT WITH NON-USER COMMON BLOCKS
C
C+++++++++++++++++ END OF USER AREA 2 ++++++++++++++++++++++++++++++++++
C
CFX-4
Introductory Training (Dec 1999)
0-105
CFX-4.3 V4.3.1H
Adding a Heat Source
DIMENSION AM(NCELL,6,NPHASE),SP(NCELL,NPHASE),SU(NCELL,NPHASE)
+,CONV(NFACE,NPHASE)
C
DIMENSION
+ U(NNODE,NPHASE),V(NNODE,NPHASE),W(NNODE,NPHASE),P(NNODE,NPHASE)
+,VFRAC(NNODE,NPHASE),DEN(NNODE,NPHASE),VIS(NNODE,NPHASE)
+,TE(NNODE,NPHASE),ED(NNODE,NPHASE),RS(NNODE,NPHASE,6)
+,T(NNODE,NPHASE),H(NNODE,NPHASE),RF(NNODE,NPHASE,4)
+,SCAL(NNODE,NPHASE,NSCAL)
C
DIMENSION
+ XP(NNODE),YP(NNODE),ZP(NNODE)
+,VOL(NCELL),AREA(NFACE,3),VPOR(NCELL),ARPOR(NFACE,3)
+,WFACT(NFACE)
+,IPT(*),IBLK(5,NBLOCK)
+,IPVERT(NCELL,8),IPNODN(NCELL,6),IPFACN(NCELL,6),IPNODF(NFACE,4)
+,IPNODB(NBDRY,4),IPFACB(NBDRY)
+,IWORK(*),WORK(*),CWORK(*)
C
C+++++++++++++++++ USER AREA 3 +++++++++++++++++++++++++++++++++++++++++
C---- AREA FOR USERS TO DIMENSION THEIR ARRAYS
C
C---- AREA FOR USERS TO DEFINE DATA STATEMENTS
C
C+++++++++++++++++ END OF USER AREA 3 ++++++++++++++++++++++++++++++++++
CFX-4
Introductory Training (Dec 1999)
0-106
CFX-4.3 V4.3.1H
Adding a Heat Source
C
C---- STATEMENT FUNCTION FOR ADDRESSING
IP(I,J,K)=IPT((K-1)*ILEN*JLEN+(J-1)*ILEN+I)
C
C----VERSION NUMBER OF USER ROUTINE AND PRECISION FLAG
C
IVERS=4 !!! DO NOT MODIFY
ICHKPR = 1
C
C+++++++++++++++++ USER AREA 4 +++++++++++++++++++++++++++++++++++++++++
C---- TO USE THIS USER ROUTINE FIRST SET IUSED=1
C
IUSED=1 MODIFY
C
C+++++++++++++++++ END OF USER AREA 4 ++++++++++++++++++++++++++++++++++
C
IF (IUSED.EQ.0) RETURN
C
C---- FRONTEND CHECKING OF USER ROUTINE
IF (IUCALL.EQ.0) RETURN
C
C---- ADD TO SOURCE TERMS
IF (ICALL.EQ.1) THEN
C
CFX-4
Introductory Training (Dec 1999)
0-107
CFX-4.3 V4.3.1H
Adding a Heat Source
C+++++++++++++++++ USER AREA 5 +++++++++++++++++++++++++++++++++++++++++
C
C---- EXAMPLE (HEAT SOURCE) ADD 100W PER UNIT VOLUME IN BLOCK
C 'BLOCK-NUMBER-2'
C
C USE IPREC TO FIND ADDRESSES
C
CALL IPREC('BLOCK-NUMBER-2','BLOCK','CENTRES',IPT,ILEN,JLEN,KLEN,
+ CWORK,IWORK)
C
C FIND VARIABLE NUMBER FOR ENTHALPY
CALL GETVAR('USRSRC','H ',IVAR)
C IF ENTHALPY EQUATION ADD SOURCE TERMS
IF (IVAR.EQ.IEQN) THEN
C LOOP OVER PATCH
DO 103 K = 1,KLEN
DO 102 J = 1,JLEN
DO 101 I = 1,ILEN
C USE STATEMENT FUNCTION IP TO GET ADDRESSES
INODE = IP(I,J,K)
C ADD HEAT SOURCE
SU(INODE,1)=SU(INODE,1)+100.0*VOL(INODE)
101 CONTINUE
102 CONTINUE
103 CONTINUE
MODIFY EXAMPLE
CODE TO LOOP
OVER CELLS AND
ADD HEAT SOURCE
CFX-4
Introductory Training (Dec 1999)
0-108
CFX-4.3 V4.3.1H
Adding a Heat Source
ENDIF
C
C---- END OF EXAMPLE
C+++++++++++++++++ END OF USER AREA 5 ++++++++++++++++++++++++++++++++++
ENDIF
RETURN
END
CFX-4
Introductory Training (Dec 1999)
0-109
CFX-4.3 V4.3.1H
CFX - Analyse
第七讲
CFX-4
Introductory Training (Dec 1999)
0-110
CFX-4.3 V4.3.1H
后处理
? 图形显示
图形对象
照相机
? 区域( Regions)
? 标量场
? ACL 参数,
? 宏( Macros)
? 计算器( Calculator)
CFX-4
Introductory Training (Dec 1999)
0-111
CFX-4.3 V4.3.1H
CFX-Analyse GUI
CFX-4
Introductory Training (Dec 1999)
0-112
CFX-4.3 V4.3.1H
Visualizer
? 产生图形对象,
网格图 (grid)
等值线图 (contour)
云图 (fringe)
速度矢量图 (vector)
x-y图 (X-Y graph)
流线图 (streak line)
? 一般需要指定绘图区域
(region)
? 一般需要指定绘图所需标量
场 (scalar field)
CFX-4
Introductory Training (Dec 1999)
0-113
CFX-4.3 V4.3.1H
图形对象
? 染色控制
self
scalar
colour
time/distance (streakline).
? 图形属性
打光 (lighting)
线图 (lines)
面图 (faces)
显示 /不显示 (visibility)
CFX-4
Introductory Training (Dec 1999)
0-114
CFX-4.3 V4.3.1H
Region 管理器
? 允许进行如下 Regions操作
> 选择 (Select)
> 创建 (Create)
> 编辑 (Edit)
> 显示 (Display)
? Regions类型
节点区域 (Nodal regions)
> [ib:ie,jb:je,kb:ke],
gridname
> i4 ( [4,,]的缩写 )
> [1,3,:7] ( [1,3,1:7]的缩写 )
> [1,,], grid2
(full j and k range of grid2)
物理区域 (Physical regions)
> (1,0,0) (1,1,0) (1,0,1)
定义物理平面 x=1
CFX-4
Introductory Training (Dec 1999)
0-115
CFX-4.3 V4.3.1H
Regions
? 不同的图形对象可接受不同的区域类型
contour,fringe,and relief 图形操作只可在 2-D
(planar) regions (physical or nodal)上进行
graph图形操作只可在 1-D (line) regions (physical or
nodal)上进行
grid,vector图形操作可在如下 regions上进行
> 1-D,2-D and 3-D nodal regions
> planar physical regions
etc.
CFX-4
Introductory Training (Dec 1999)
0-116
CFX-4.3 V4.3.1H
标量场( Scalar Field) 管理器
? 混合( Hybrid) 与控制体( control volume) 值
混合值
> 缺省设置
> 网格边界处为边界条件值
控制体值( C.V,Value)
> 流场计算值
? 网格坐标
X,Y,Z
? 流场计算产生多个标量场,

U,V,W
P,PTOTAL,T
TKE,EPSILON...
CFX-4
Introductory Training (Dec 1999)
0-117
CFX-4.3 V4.3.1H
用户标量
? 用户定义标量在主菜单下产生
方式
Post-Process/Calculator
在弹出的菜单中进行标量计算,
对话框输入格式如下
variable name =
math_expression
parameter; p_ref = 14.7*144
scalar; p_psi = (p-
p_ref)*144
标量名称将被自动加入到标量
列表中或覆盖已有同名标量场
CFX-4
Introductory Training (Dec 1999)
0-118
CFX-4.3 V4.3.1H
Tools
? 命令行窗口
? ACL 参数
? 宏管理器
? 照相机管理器
CFX-4
Introductory Training (Dec 1999)
0-119
CFX-4.3 V4.3.1H
命令行窗口
? 顶级菜单进入方式
Tools/Command Line,..
? 允许用户直接键入并执行命令
? 定量计算命令, calc
格式,calc variable_name = mathematical
expression
计算结果可以是数字(参数)
例如, calc minpres = min(p[1,,])
show parameter minpres or
echo $minpres or
eval minpres
如果计算结果是标量场变量,User Defined Field
类型的新标量场将被产生,并可以被用在其他任意
标量场运算命令中
CFX-4
Introductory Training (Dec 1999)
0-120
CFX-4.3 V4.3.1H
数学表达式
? 语法与 Fortran类似
+,-,*,/,^,
sqrt(x),
sin(x),cos(x),tan(x),( x 单位为弧度)
asin(x),acos(x),atan(x) 反三角函数
exp(x),log(x),log10(x)
int(x),nint(x),abs(x).
? 标量场变量算子
SUM(arg),AVRG(arg),MIN(arg),MAX(arg)
IMAX (arg),IMIN (arg),returns the I index value of the
node with max (or min) value of scalar arg.
JMAX (arg),JMIN (arg),
KMAX (arg),KMIN (arg).
CFX-4
Introductory Training (Dec 1999)
0-121
CFX-4.3 V4.3.1H
实例
CFX-4
Introductory Training (Dec 1999)
0-122
CFX-4.3 V4.3.1H
宏管理器
? 宏
一组 ACL命令列表
能进行量化计算,图形化
处理的操作
后处理操作的自动链接执

CFX-4
Introductory Training (Dec 1999)
0-123
CFX-4.3 V4.3.1H
照相机 ( CAMERA) 管理器
? 照相机,
每个名称对应一定的视角,缩放和全景位置。用于指定
视图属性。
创建和删除
修改
显示
Write, 允许用户将一组照相
机保存到文件中,
Read:允许用户读入一组照相
机,
CFX-4
Introductory Training (Dec 1999)
0-124
CFX-4.3 V4.3.1H
鼠标功能
平移旋转
放大
缩小
CFX-4
Introductory Training (Dec 1999)
0-125
CFX-4.3 V4.3.1H
快捷键
x/X 键, 设置视图方向 +X/-X 轴向
y/Y +Y/-Y轴向
z/Z +Z/-Z轴向
, Page Up”,缩小
, Page Down”,放大
, a”,设定显示 /不显示轴
, n”,设定投影为正射图 (orthographic) or 透视图
(perspective).