Cfd Pro 14.5 l13 Cel Av

  • View
    232

  • Download
    8

Embed Size (px)

DESCRIPTION

CFD

Text of Cfd Pro 14.5 l13 Cel Av

  • 2013 ANSYS, Inc. December 12, 2013 1 Release 14.5

    14. 5 Release

    Introduction to ANSYS CFD Professional

    Lecture 13 CFX Expression Language (CEL) & Additional Variables (AVs)

  • 2013 ANSYS, Inc. December 12, 2013 2 Release 14.5

    It is possible to create user variables, expressions and functions with which to customize a CFD model, e.g. physical properties of fluids, physical models. This lecture covers:

    How to set up equations and functions using CFX Expression Language (CEL) How to create Additional Variables (user variables)

    Introduction

  • 2013 ANSYS, Inc. December 12, 2013 3 Release 14.5

    CEL CEL - CFX Expression Language

    Allows the user to create equations (can be functions of solution/system variables) that can be used in CFX-Pre and CFD-Post

    Example:

  • 2013 ANSYS, Inc. December 12, 2013 4 Release 14.5

    CEL Rules

    The syntax rules are the same as those for conventional arithmetic. Operators are written as: + (addition) - (subtraction) * (multiplication)

    / (division) ^ (exponentiation)

    Variables and expressions are case sensitive Expressions must be dimensionally consistent for addition and subtraction

    operations (example: 1.0 [mm] + 0.45 [yds] is OK)

    Fractional and decimal powers are allowed (example: a^(1/2) + 1.0^0.5) Some constants are also available in CEL for use in expressions: e Constant: 2.7182818

    g Acceleration due to gravity: 9.806 [m s^-2]

    pi Constant: 3.1415927

    R Universal Gas Constant: 8314.5 [m^2 s^-2 K^-1]

  • 2013 ANSYS, Inc. December 12, 2013 5 Release 14.5

    Creating Expressions - Expression Editor

  • 2013 ANSYS, Inc. December 12, 2013 6 Release 14.5

    Creating Expressions - Directly

  • 2013 ANSYS, Inc. December 12, 2013 7 Release 14.5

    CEL Example

    Using an if function

    Set inlet temperature to 300 K for the first 19 iterations then raise it to 320 K after 20 iterations

    Solver variable

    accessed with the

    right mouse button

    Note: On the 20th iteration

    inlet temp = 310 K

  • 2013 ANSYS, Inc. December 12, 2013 8 Release 14.5

    User Functions

    You can also define your own 1-D linear, or 3-D cloud of points interpolation functions

    Import

    data

    points or

    add

    manually

  • 2013 ANSYS, Inc. December 12, 2013 9 Release 14.5

    User Functions: Example Example: Physical timescale changes

    with iteration number as shown here

    Timescale is in seconds

    Iteration Number is

    dimensionless

  • 2013 ANSYS, Inc. December 12, 2013 10 Release 14.5

    Integrated Quantities

    Integrated quantities can be used in expressions to evaluate variables over a location:

    Calculate the area average of Cp on an isosurface: areaAve(Cp)@iso1

    Available in CFX-Pre and CFD-Post but usage is more strict in CFX-Pre, e.g.

    the argument supplied to the function must be a variable, not an expression

    @ syntax must use a named location used in the physics definition

    - A boundary condition name, a domain name, a monitor point name, etc.

    or to reference general mesh regions use the syntax @REGION:

  • 2013 ANSYS, Inc. December 12, 2013 11 Release 14.5

    Integrated Quantities

    Some functions allow an x, y or z operator: area_x()@boundary gives the area projected in the x-direction

    force_z()@wall gives the z component of the force on the wall

    See documentation for a full list

    These functions also allow an optional coordinate frame: force_z_MyCoord()@wall gives the z component of the force on the wall using the

    coordinate frame MyCoord

    Each function requires either 0 or 1 arguments areaAve requires 1 argument: areaAve(Temperature)@Wall

    massFlow requires 0 arguments: massFlow()@Inlet

    Return value units depend on the argument units areaAve(Temperature)@Wall will return a value with units of Temperature

  • 2013 ANSYS, Inc. December 12, 2013 12 Release 14.5

    Additional Variables Additional Variables (AVs) are non-reacting scalar components that may

    be transported through the flow

    They do not have any direct influence on the flow solution

    Examples: A tracer such as a dye or smoke

    This is an example of a Transport Additional Variable. The AV is transported with the flow, but does not influence the flow

    Age of the fluid to identify stagnant regions of flow This is done by creating a transport AV Age with units of [s]

    Inlet and initial values should be zero

    An AV source term with a value of 1 should be set throughout the domain

  • 2013 ANSYS, Inc. December 12, 2013 13 Release 14.5

    Additional Variables: Examples

    Additional Variables can be used to work-around some limitations: In CFX-Pre, you must pass a variable to the integrated CEL functions

    (areaAve(), volumeInt(), etc). The following is not valid: areaAve(Velocity * Density)@Inlet because Velocity * Density is an expression, not a variable

    As a work-around you can create an Algebraic AV equal to the expression and then pass the AV to the CEL function

  • 2013 ANSYS, Inc. December 12, 2013 14 Release 14.5

    Additional Variables Additional Variables (AVs) are created by right-clicking on Expressions,

    Functions and Variables > Additional Variables, or using the toolbar

    Variable Type

    Specific: The AV is solved on a per-unit-mass basis Volumetric: The AV is solved on a per-unit-volume basis Unspecified: The AV is defined in terms of an algebraic expression

    Units: the units that describe the additional variable

    Tensor Type: Scalar or Vector as necessary

    For a vector you will need to provide expressions to define the three components

  • 2013 ANSYS, Inc. December 12, 2013 15 Release 14.5

    Additional Variables

    Once an AV has been created it must be included in the domain

    Enable the AV on the Domain > Fluid Models panel Set the Option to Transport Equation or Algebraic Equation

    For transported AVs, initial conditions and boundary conditions must be provided

    For algebraic AVs, provide an expression