Navigation:  »No topics above this level«

Expression Builder

 

The Expression Builder allows you to build and evaluate complex expressions on a variety of objects in Flex. The expressions can include basic arithmetic operations, mathematical functions, and distributed values from surfaces and horizons.  

 

Scope

Expressions can be evaluated for the following objects in Visual MODFLOW Flex:

Data Explorer Object Operations:

oPoint, Polyline, and Polygon Elevations

oSurface Elevations

oMap Elevations

oEdit Properties
 

Model Explorer Objects

oModel Properties (Edit Properties Dialog)

oBoundary Conditions (Edit Boundary Conditions Dialog)

oSurface Water (Edit Surface Water Network Dialog)

 

For Data Explorer Objects, the Expression Builder can be accessed by right-clicking on the object, selecting Settings... and clicking on the Operations node.  For objects in the Model Explorer (like model properties and boundary condition objects), you can enter expressions directly in the Calculation toolbar (similar to what is shown in red below) or you can build expressions with the assistance of the Expression Builder (button):

 

 

Building Expressions

The Expression Builder can be used to construct mathematical expressions to specify variable property values (e.g. Kx, initial heads, Kd), boundary condition values (e.g. river conductance, constant head, etc.), or attribute values for shapes (e.g. points features in the Data Explorer).  The Expression Builder is shown below for editing conductivity values. The Expression builder consists of five components:

1.Expression workspace: a workspace to build expressions;

2.Operators:  basic arithmetic operators (e.g. addition, subtraction, multiplication, division, parentheses, and exponents);

3.Variables & Constants: a list of variables associated with the current model cell and constants

4.Data Objects: a list of supported data objects from the data explorer and model explorer windows

5.Functions: a list of supported mathematical, logical, and vector functions

 

 

Please Note: The expression builder is case sensitive.

 

Operators

The following operators are always available in the Expression Builder:

Operator

Button

Example

Result

Add

1+2

3

Subtract

4-3

1

Multiply

2*5

10

Divide

2/4

0.5

Open bracket

3*(5+2)

21

Close bracket

Less Than

5<2

False

Greater Than

5>2

True

Equals

5=5

True

Power

5^3

125

 

Please Note: The expression builder does not support spaces between operators

 

Variables & Constants

The expression builder includes a list of applicable model properties or boundary condition values as well as standard constants as described below.

 

Grid Geometry Variables

The following grid-based variables are always available in the Expression Builder:

Variable

Description

$BOT

cell bottom elevation

$DX1

cell width in the x-direction

$DY1

cell length in the y-direction

$DZ

cell thickness

$MBOT

model bottom elevation

$X

x-coordinate of grid cell centroid

$Y

y-coordinate of grid cell centroid

Notes:

1 - finite difference grids only

 

Editing Model Properties

The following variables are available in the Expression Builder during Model Property editing sessions:

Variable

Description

$OLD{fieldname}

initial value of the specified field {fieldname} at the start of the edit session
(e.g. $OLDINITIALHEADS for the initial heads property field)

 

Assigning Boundary Conditions By Geometry

The following variables are available in the Expression Builder when assigning Boundary Conditions using polylines or polygons or using a (polyline or polygon) data object:

Variable

Description

$FACEAREA_NORTH

area of the current cell projected onto the model-coordinate XZ plane

$FACEAREA_TOP

area of the current cell projected onto the XY plane (i.e. plan area)

$FACEAREA_WEST

area of the current cell projected onto the model-coordinate YZ plane

$RCHLNG1

length of the intersection between the current cell and the input polyline

$LENGTH1

percentage along the length of the polyline from the beginning of the polyline to the exit point of the polyline from the current cell

$SEGMENT1

ID of the polyline intersecting the cell

$UCTOCOND

unit conversion factor for converting the length and time units used for hydraulic conductivity to the length and time units used for conductance

Notes:

1 - polyline features only

 

Editing Boundary Conditions

The following variables are available in the Expression Builder during Boundary Condition editing sessions:

Variable

Description

$KX

horizontal conductivity along X-axis

$KY

horizontal conductivity along Y-axis

$KZ

vertical conductivity

$MBOT

model bottom elevation

$OLD{fieldname}

initial value of the specified field {fieldname} at the start of the edit session
(e.g. $OLDCOND for river conductance values)

 

Constants

The following constants are always available in the Expression Builder:

 

 Keyword

Constant

Example

Result

false

False (constant)

false

0

pi

Pi (π) (constant)

pi

cos(pi)

3.14159265358979

-1

true

True (constant)

true

1

 

Data Objects

The Data Objects component of the Expression Builder includes a list of objects from the Data Explorer and the Model Explorer windows that can be included in expressions. Surfaces and horizons are currently supported.  Values from the surface/horizon are bilinearly interpolated to the location of the cell centroid (in the case of finite difference grid and quadtree grids) and to the interior cell node (in the case of Voronoi grids).  Note that bilinear interpolation is exptrapolated beyond the extents of a given surface.

The syntax to use a surface is $`object_name` where object_name is the name of the surface in the Data Explorer or the name of the horizon in the Model Explorer, as applicable.  Surfaces may be used in expressions:

Examples

The expression $`Ground`($X $Y)-1 would result in a value of 1 unit of length below ground surface. This may be useful when defining features such as the bottom elevation of a river.

 

The expression pmin($`Ground`($X $Y) $'Pit Elev'($X $Y)) would result in the lower elevation between ground surface and a surface representing the elevation of an excavated pit.

 

The expression ifgaps($`local`($X $Y) $`regional`($X $Y)) compares local surface with a regional surface and uses the regional values where there are gaps in the local surface - this is useful with two surfaces have differing extents

 

Functions

The following functions are always available in the Expression Builder:

 

Function

Description

Example

Result

abs

Absolute Value

abs(-1.2)

1.2

average

Average

average({1 2 3})

2

cif

Conditional If

cif(true 23 24)

cif(false 23 24)

cif(1 23 24)

cif(0 23 24)

cif(1-1 23 24)

23

24

23

24

24

cos

Cosine

cos(0)

1

dot

Dot Product

dot({1 2 3} {1 2 3})

14

equal

Equality

equal(2+2 4)

equal(2+2 5)

cif(equal(2+2 5) 23 24)

1

0

24

exp

Exponential

exp(1)

2.71828182845905

ifgaps

Conditional If for  noData values in a  surface

ifgaps(surfA surfB)

returns surfA where it has valid values and surfB where it is absent or has noData values. surfA can be an expression

ln

Natural logarithm

ln(2.718218)

1

log

Logarithm

log(16 4)

2

log10

Base-10 logarithm

log10(100)

2

max

Maximum Value

max({10 2.2 34})

34

min

Minimum Value

min({10 2.2 34})

2.2

mod

Modulo

(10)mod(3)

1

mult

Multiplication

mult({2.0 3.0 4.0})

24

not

Negation

not(true)

not(false)

not(1)

not(0)

not(2)

not(1-1)

0

1

0

1

0

1

pmax

Maximum Value

(pairwise)

pmax({10 2.2 34} {2 3 0.5})

{10 3 34}

pmin

Minimum Value

(pairwise)

pmin({10 2.2 34} {2 3 0.5})

{2 2.2 0.5}

round

Round to

Decimal Place

round(1.523 2)

round(5.523 0)

1.52

10

sigdig

Round to

significant digit

sigdig(1523 2)

sigdig(1.523E+3 1)

1500

2000

sin

Sine

sin(pi/2)

1

sqrt

Square Root

sqrt(4)

2

sum

Sum

sum({1 2 3})

6

tan

Tangent

tan(pi/4)

1

vector

Vector

vector({3 2})

{2.0 2.0 2.0}

vequal

Vector Equality

vequal({1 2 3} {1 2 3})

 

cif(vequal({4 5 6}
           {4 6 6}) 10 20)

true

 

 

20

 

Examples are also provided in the help text, which you can view by hovering the mouse pointer over a given function. Note that surfaces and horizons are treated as vectors { } in the expressions.

 

 


Page url:http://www.waterloohydrogeologic.com/help/vmod-flex/index.html?vm_field-calculator.htm