




已阅读5页,还剩11页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第十四章14:CFX 表达式语言 (CEL)CFX Expression Language (CEL) is an interpreted, declarative language that has been developed to enable CFX users to enhance their simulations without recourse to writing and linking separate external Fortran routines.You can use CEL expressions anywhere a value is required for input in ANSYS CFX.CEL can be used to: Define material properties that depend on other variables. Specify complex boundary conditions. Add terms to the solved equations.You can also monitor the value of an expression during the solution using monitor points.Important: There is some CEL that works elsewhere in ANSYS CFX, but not in CFD-Post. Any expression created in CFX-Pre and used as a Design Exploration output parameter could potentially cause fatal errors during the Design Exploration run, so you should create all expressions for Design Exploration output parameters in CFD-Post.14.1.1.Values and ExpressionsCEL can be used to generate both values and expressions. Values are dimensional (that is, with units) or dimensionless constants. The simplest type of definition is the dimensionless value, for example:b = 3.743You can also specify a value with units, for example:g = 9.81 m s-2The dimensions of the quantities of interest for CFD calculations can be written in terms of mass, length, time, temperature and angle. The concept of units is fundamental to the behavior of values and expressions.Values can be used directly, or they can be used as part of an expression. For example, you can use an expression to add two values together:=+In this example, you may want to predefineand, but this is not required. However, in order to add two quantities together,they must have the same dimension; that is, it is meaningful to add a quantity in inches to one expressed in meters, but it is not meaningful to add one expressed in kilograms to one in square feet.Expressions can also be functions of other (predefined) expressions:=+Units follow the conventions in the rest of CFX, in that a calculation has a set of solution units (by default, SI units), and that any quantity can be defined either in terms of the solution units, or any other set of units with the correct form.An expression does not have its own units string, but if it references quantities that have dimensions, these will determine the resulting units for the expression. For example, if an expression depends inversely on the square of the xcoordinate, then it hasimplied dimensionsof length to the power -2.14.1.1.1.Using Locators in ExpressionsA CFX simulation has physics areas and mesh areas; physics areas are boundaries while mesh areas are regions. These two types of area can occupy completely different spaces in a simulation; however, there is no requirement that area names be unique between physics and mesh. This can lead to ambiguities when you use these names in expressions.To avoid these ambiguities, ANSYS CFX first checks to see if is a physics name; if this is not found, the name is checked in the list of mesh names. Thus if in1 is both the name of a physics area and the name of a mesh area, is taken to indicate the physics area.ANSYS CFX also has REGION CEL syntax so that you can identify a named area as being a mesh area. Thus to identify the mesh area in1, you would use the syntax:REGION:in1Note that if does not appear as a physics name or a mesh name, the expression fails.14.1.2.CFX Expression Language StatementsThe CFX Expression Language is declarative. You declare the name and definition of the expression using expression language statements. The statements must conform to a predefined syntax that is similar to Fortran mathematical statements and to C statements for logical expressions.The statement must consist of the following: a number, optionally with associated units. This defines aconstant. Constants without units are termeddimensionless. for mathematical expressions, one or more references to mathematical constants, system variables, or existing user variables, separated by+(addition),-(subtraction),*(multiplication),/(division) and(exponentiation), with optional grouping of these by parentheses. The syntax rules for these expressions are the same as those for conventional arithmetic. for logical expressions involving relational operators, one or more references to mathematical constants or results from mathematical expressions, separated by=(is less than or equal to),(is greater than) and=(is greater than or equal to) with optional grouping of these by parentheses. for logical expressions involving logical operators, one or more references to logical constants or results from relational operations separated by!(negation),&(logical AND) and|(logical OR), with optional grouping by parentheses.14.1.2.1.Use of ConstantsConstants do not need to be defined prior to being used in an expression. For example, you could choose to evaluate the expressionx + 5 m. Or, you could define a constant,b = 5 mand then create an expressionx + b.The logical constants arefalseandtrue. Results of logical expressions are either false or true, which are evaluated as0and1(corresponding tofalseandtrue, respectively) when a numerical representation is required.The use of constants may be of benefit in generating complicated expressions or if you have several expressions that use the same constants.14.1.2.2.Expression SyntaxAll numbers are treated as real numbers.The precedence of mathematical operators is as follows (from highest to lowest): The power operatoras inxy. The unary minus or negation operator-as in-x. Multiplication and division as inx*y/z. Addition and subtraction as inx+y-z.The precedence of logical and relational operators is as follows (from highest to lowest): The negation operator!as in!x. The relational operators involving less than or greater than (=,and=) as inx = y. The relational operator is equal to and is not equal to (=and!=) as inx != y. The logical AND operator (&) as inx & y. The logical OR operator (|) as inx | y.14.1.2.3.Multiple-Line ExpressionsIt is often useful, particularly with complex expressions, to use more than one line when creating your expression. CFX allows you to use multiple lines to generate an expression, provided each line is separated by an appropriate operator.For example, you may have an equation, A + B/C, that consists of three complex terms, A, B, and C. In this case, you could use three lines to simplify creating the expression:A +B/ CNote that the operator may be used at the end of a line (A +) or at the beginning of a line (/ C). You do not need to enter the operator twice.Once the expression has been created, it will appear in the Existing Definitions list box as if it were generated on a single line (A + B/C).14.2.1.CEL OperatorsCFX provides a range of mathematical, logical and operational operators as built-in functions to help you create complex expressions using theExpressiondetails view.Table14.1:CEL OperatorsOperatorFirst Operands Dimensions xSecond Operands Dimensions yOperands Values (Approx)aResults Dimensions-xAnyAnyxx+yAnyxAnyxx-yAnyxAnyxx*yAnyAnyAnyx*yx/yAnyAny0x/yxy (if y is a simple, constant, integer expression)AnyDimensionlessAnybxyxy (if y is any simple, constant, expression)AnyDimensionlessx 0xyxy (if y is not simple and constant)DimensionlessDimensionlessx 0Dimensionless!xDimensionlessfalse or trueDimensionlessx = yAnyxfalse or trueDimensionlessx yAnyxfalse or trueDimensionlessx = yAnyxfalse or trueDimensionlessx = yAnyxfalse or trueDimensionlessx != yAnyxfalse or trueDimensionlessx & yDimensionlessDimensionlessfalse or trueDimensionlessx | yDimensionlessDimensionlessfalse or trueDimensionlessaThe logical constants true and false are represented by 1 and 0 when a numerical representation is required.bFor y 0, 1/x, 1.0). In this case, whenx=0.0, a division by zero will still occur because the expression1/xis evaluated independent of whetherx0is satisfied or not.14.2.3.CEL ConstantsRight-click in theExpressiondetails view to access the following useful constants when developing expressions:Table14.2:CEL ConstantsConstantUnitsDescriptionRJK-1mol-1Universal Gas Constant: 8.314472avogadromol-16.02214199E+23boltzmannJ K-11.3806503E-23clightm s-12.99792458E+08eDimensionlessConstant: 2.7182817echargeA sConstant: 1.60217653E-19epspermo1./(clight*clight*mupermo)gms-2Acceleration due to gravity: 9.8066502mupermoN A-24*pi*1.E-07piDimensionlessConstant: 3.141592654planckJ s6.62606876E-34stefanW m-2 K-45.670400E-0814.2.4.Using ExpressionsThe interaction with CEL consists of two phases: a definition phase, and, a use phase.The definition phase consists of creating a set of values and expressions of valid syntax. The purpose of theExpressiondetails view is to help you to do this.14.2.4.1.Use of Offset TemperatureWhen using temperature values in expressions, it is generally safer to use units of K only. When units are used that posses an offset (for example, C), they are converted internally to K. For terms that have temperature to the power of unity, any unit conversion will include the offset between temperature scales. However, in all other cases the offset is ignored because this is usually the most appropriate behavior. You should therefore take care when specifying an expression involving non-unit powers of temperature. For example, each of the expressions below is equivalent:Temperature = 30 CTemperature = 303.15 KTemperature = 0 C + 30 KTemperature = 273.15 K + 30 KThese are only equivalent because all units are to the power of unity and units other than K appear no more than once in each expression. The following expression will not produce the expected result:Temperature = 0 C + 30 CThis is equivalent to576.30Kbecause each value is converted to K and then summed. The two expression below are equivalent (as expected) because the offset in scales is ignored for non-unit powers of temperature:Specific Heat = 4200 J kg-1 C-1Specific Heat = 4200 J kg-1 K-115.5.Quantitative Function ListThe available quantitative functions are outlined in the sections that follow.In the table that follows, applies to CFD-Post only. CFX-Pre and CFX-Solver can only accept variables as arguments to quantitative functions. Note that for CFX-Pre and CFX-Solver, an Additional Variable can be used to pass an expression indirectly into a quantitative function.The behavior of the functions in the table below depends on the type of . Typically: On domains and subdomains, the functions use vertex (node) values for the operand. On a boundary, the functions use conservative values for the operand unless this is overridden by theBoundconvariable operator in CFX-Pre. On user locations in CFD-Post, the functions use values interpolated from nodal values.Table15.4:CEL Functions in CFX-Pre/CFX-Solver and in CFD-PostFunction Name and Syntax OperationAvailabilityarea( )Area of a boundary or interface.Supports “”.Seearea.Allarea_x_( )area_y_( )area_z_( )The (signed) component of the normal area vector in the local x, y or z direction. The normal area vectors are always directed out of the domain, therefore you may obtain positive or negative areas depending on the orientation of your domain and the boundary you are operating on. The area of a closed surface will always be zero.Supports “”.AllaareaAve()Area-weighted average of on a boundary.Supports “”.SeeareaAve.AllareaAve_x_( )areaAve_y_( )areaAve_z_( )The (signed) component of the normal area vectorweighted averagein the local x, y or z direction. The normal area vectors are always directed out of the domain, therefore you may obtain positive or negative areas depending on the orientation of your domain and the boundary you are operating on. The area of a closed surface will always be zero.Supports “”.CFD-PostareaInt()Area-weighted integral of on a boundary.TheareaIntfunction projects the location onto a plane normal to the specified direction (if the direction is not set toNone) and then performs the calculation on the projected location (the direction specification can also beNone). The direction of the normal vectors for the location is important and will cancel out for surfaces such as closed surfaces.Supports “”.SeeareaInt.AllareaInt_x_( )areaInt_y_( )areaInt_z_( )The (signed) component of the normal area vectorweighted integralin the local x, y or z direction. The normal area vectors are always directed out of the domain, therefore you may obtain positive or negative areas depending on the orientation of your domain and the boundary you are operating on. The area of a closed surface will always be zero.Supports “”.Allave()Arithmetic average of over nodes within a domain or subdomain.Supports “”.Seeave.Allcount( )Counts the number of evaluation points (for example, nodes) on the named region.Seecount.AllcountTrue()Counts the number of nodes at which the Variable or logical expression evaluates to true.Supports “”.SeecountTrue.Allforce( )The magnitude of the force vector on a boundary.Supports “.” and “”.Seeforce.AllforceNorm _( )The length of the normalized force on a curve in the specified direction.Supports “.” and “”.SeeforceNorm.CFD-Postforce_x_( )force_y_( )force_z_( )The (signed) component of the force vector in the local x, y or z direction.Supports “.” and “”.Allainside()Similar to thesubdomainvariable, but allows a specific 2D or 3D location to be given.Supports “”.Seeinside.CFX-Pre, CFX-Solverlength()Length of a curve.Supports “”.Seelength.CFD-PostlengthAve()Length-weighted average.Supports “”.SeelengthAve.CFD-PostlengthInt()Length-weighted integration.Supports “”.SeelengthInt.CFD-Postmass()The total mass within a domain or subdomain. This is fluid-dependent.Supports “”.Seemass.CFX-Pre, CFX-SolvermassAve()Mass-weighted average of on a domain or subdomain.Supports “”.SeemassAve.CFX-Pre, CFX-SolvermassFlow()Mass flow through a boundary.Supports “.” and “”.SeemassFlow.AllmassFlowAve()Mass flow weighted average of on a boundary.Supports “.” and “”.SeemassFlowAve.AllmassFlowAveAbs()Absolute mass flow weighted average of on a boundary.Supports “.” and “”.SeemassFlowAveAbs.AllmassFlowInt()Mass flow weighted integration of on a boundary.Supports “.” and “”.SeemassFlowInt.AllmassInt()The mass-weighted integration of within a domain or subdomain.Supports “”.SeemassInt.CFX-Pre, CFX-SolvermaxVal()Maximum value of within a domain or subdomain.Supports “”.SeemaxVal.AllminVal()Minimum value of within a domain or subdomain.Supports “”.SeeminVal.Allprobe()Returns the value of the specified variable or expression on the specified Point object.Supports “”.Seeprobe.Allrbstate()Returns the position/velocity/acceleration or orientation/angular velocity/angular acceleration (or axis components of these) of a rigid body object or immersed solid that is governed
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025浙江舟山市定海区干览镇恒达残疾人之家招聘公益性岗位1人笔试模拟试题及答案解析
- 2025年新能源行业技术发展与市场前景研究报告
- 2025年内分泌科常见代谢性疾病诊治方案选择试卷答案及解析
- 妇科实习心得体会与病例分析
- 2025年地球科学行业气候变化影响与环境保护研究报告
- 2025年体育娱乐行业电竞产业发展与赛事规划研究报告
- 2025年医疗健康行业数字化转型与医疗智能化研究报告
- 小学新版教材主题教学设计与优化方案
- 2025年生活服务行业共享经济与线上服务研究报告
- 企业名称2021年度ESG报告绩效报告医疗器械
- 隧道施工应急预案方案
- 植物鉴赏课件
- 安徽省华师联盟2026届高三上学期9月开学质量检测物理试卷(含答案)
- 肿瘤热疗中国专家共识
- 2025年甘肃省药品检查员资格考试(药械化流通)历年参考题库含答案详解(5套)
- 2025年泸州职业技术学院招聘考试笔试试卷【附答案】
- 自来水企业内部管理规范
- 2025新热处理工程师考试试卷及答案
- 硬笔书法全册教案共20课时
- 工会兼职补助管理办法
- 纸箱不合格品管理制度
评论
0/150
提交评论