Femtet Help/Manual
 

Home / Show Results / Result Field / User-Defined Field / Operator and Function List Usable in User-defined Field

Operator and Function List Usable in User-defined Field

The usable operators and functions are listed below.

* Both upper-case and lower-case letters can be used for them.

Operator

The calculation order of operators is the same as VB / VBA. In the table below, the operators in the upper rows have the higher priority than the ones in the lower rows.

Operator

Note

^

Power

*

/

Multiplication

Division
* Applicable to vector or tensor operations.

+

-

Addition

Subtraction
* Applicable to vector or tensor operations.

=

<>

<

<=

>

>=

Comparison

 

  • <> means "NOT equal".

  • The result will be -1 if it is true.

  • The result will be 0 if it is false.

And

Bitwise AND

(fractional parts are truncated)

Or

Bitwise OR

(fractional parts are truncated)

Vector/Tensor Operator

Operator

Note

+

Vector + Vector = Vector
Tensor + Tensor = Tensor
Calculates addition for each component.

-

Vector - Vector = Vector
Tensor - Tensor = Tensor
Calculates subtraction for each component.

*

Scalar * Vector = Vector
Scalar * Tensor = Tensor
Vector * Scalar = Vector
Tensor * Scalar = Tensor
Calculates multiplication for each component of a vector or tensor by a scalar.

 

Vector :* Vector = Scalar
Calculates the inner product of two vectors.

The same result is given as the function INNER_PRODUCT.

 

The following functions are provided to calculate the multiplication of vectors.

Function INNER_PRODUCT_CONJ (Inner product with complex conjugate)

Function OUTER_PRODUCT (Outer product)

Function OUTER_PRODUCT_CONJ (Outer product with complex conjugate)


Tensor * Vector = Vector

Calculates multiplication of a tensor and a vector.


Vector * Tensor = Vector

Calculates multiplication of a transposed tensor and a vector.

 

Tensor * Tensor = Tensor
Calculate multiplication of tensors,

 

The following functions are provided to calculate multiplication of tensors.

Tensor contraction can be calculated using the inner product function.

Function INNER_PRODUCT (Inner product)

Function INNER_PRODUCT_CONJ (Inner product with complex conjugate)

 

/

Vector / Scalar = Vector

Tensor / Scalar = Tensor

Calculates division of each component of a scalar, vector, or tensor by a scalar.

 

Other combinations are not supported.

 

Functions (Basic)

Function

Argument

Return value

Note

SIN

Scalar/Vector/Tensor (in radians)
Real Number

Argument: Scalar (in radians) -> Scalar
Argument: Vector (in radians) -> Vector
Argument: Tensor (in radians) -> Tensor
Real Number

Returns the sine of the argument.
In the case of a vector, returns the sine of each component.
In the case of a tensor, returns the tensor obtained by transforming the sine of the principal values back to the original coordinate system.

COS

Scalar/Vector/Tensor (in radians)
Real Number

Argument: Scalar (in radians) -> Scalar
Argument: Vector (in radians) -> Vector
Argument: Tensor (in radians) -> Tensor
Real Number

Returns the cosine of the argument.

In the case of a vector, returns the cosine of each component.
In the case of a tensor, returns the tensor obtained by transforming the cosine of the principal values back to the original coordinate system.

TAN

Scalar/Vector/Tensor (in radians)
Real Number

Argument: Scalar (in radians) -> Scalar
Argument: Vector (in radians) -> Vector
Argument: Tensor (in radians) -> Tensor
Real Number

Returns the tangent of the argument.

In the case of a vector, returns the tangent of each component.
In the case of a tensor, returns the tensor obtained by transforming the tangent of the principal values back to the original coordinate system.

ASIN

Scalar/Vector/Tensor
Real Number

Argument: Scalar -> Scalar (in radians)
Argument: Vector -> Vector (in radians)
Argument: Tensor -> Tensor (in radians)
Real Number

Returns the arcsine (in radians) of the argument.
In the case of a vector, returns the arcsine of each component.
In the case of a tensor, returns the tensor obtained by transforming the arcsine of the principal values back to the original coordinate system.

ACOS

Scalar/Vector/Tensor
Real Number

 

Argument: Scalar -> Scalar (in radians)
Argument: Vector -> Vector (in radians)
Argument: Tensor -> Tensor (in radians)
Real Number

Returns the arccosine (in radians) of the argument.
In the case of a vector, returns the arccosine of each component.
In the case of a tensor, returns the tensor obtained by transforming the arccosine of the principal values back to the original coordinate system.

ATN

Scalar/Vector/Tensor
Real Number

Argument: Scalar -> Scalar (in radians)
Argument: Vector -> Vector (in radians)
Argument: Tensor -> Tensor (in radians)
Real Number

Returns the arctangent (in radians) of the argument.
In the case of a vector, returns the arctangent of each component.
In the case of a tensor, returns the tensor obtained by transforming the arctangent of the principal values back to the original coordinate system.

LOG

Scalar/Vector/Tensor
Real Number

Argument: Scalar -> Scalar
Argument: Vector -> Vector
Argument: Tensor -> Tensor
Real Number

Returns the natural logarithm of the argument.
In the case of a vector, returns the natural logarithm of each component.
In the case of a tensor, returns the tensor obtained by transforming the natural logarithm of the principal values back to the original coordinate system.

LOG10

Scalar/Vector/Tensor
Real Number

Argument: Scalar -> Scalar
Argument: Vector -> Vector
Argument: Tensor -> Tensor
Real Number

Returns the common logarithm of the argument.
In the case of a vector, returns the common logarithm of each component.
In the case of a tensor, returns the tensor obtained by transforming the common logarithm of the principal values back to the original coordinate system.

 

SQR

Scalar/Vector/Tensor
Real Number

Argument: Scalar -> Scalar
Argument: Vector -> Vector
Argument: Tensor -> Tensor
Real Number

Returns the square root of the argument.
In the case of a vector, returns the square root of each component.
In the case of a tensor, returns a tensor obtained by transforming the square root of the principal values back to the original coordinate system.

POW

Argument 1:
Scalar/Vector/Tensor
Real Number

Argument 2:
Scalar
Real Number

Argument 1: Scalar -> Scalar
Argument 1: Vector -> Vector
Argument 1: Tensor -> Tensor
Real Number

Returns the Argument 1 raised to the power of the Argument 2. The delimiter between arguments is a comma.
If the Argument 1 is a vector, returns each component raised to the power.
If the Argument 1 is a tensor, returns a tensor obtained by transforming the principal values raised to the power back to the original coordinate system.

Example: POW(VEC_LENGTH(BERNOULLI_VELOCITY),2)
Returns the flow velocity raised to the power of 2.

EXP

Scalar/Vector/Tensor
Real Number

 

Argument: Scalar -> Scalar
Argument: Vector -> Vector
Argument: Tensor -> Tensor
Real Number

Returns Napier's constant raised to the power of the second argument
If Argument 1 is a vector, returns Napier's constant raised to the power of each component.
If Argument 1 is a tensor, returns a tensor obtained by transforming Napier's constant raised to the power of the principal value back to the original coordinate system.

F_IF

Argument 1:

Scalar
Real Number

Argument 2, Argument 3:
Scalar/Vector/Tensor
Complex Number/Real Number

Argument 2. 3: Scalar -> Scalar
Argument 2. 3: Vector -> Vector
Argument 2. 3: Tensor -> Tensor
Argument 2. 3: Complex Number -> Complex Number
Argument 2. 3: Real Number -> Real Number

This function changes the return value depending on the conditions.

 

It includes three arguments. If the result from the Argument 1 is not 0.0, returns the Argument 2,

and if the result is 0.0, returns the Argument 3. The delimiter between arguments is a comma.

  • Argument 1: Enter the comparisons, logical operations, or mathematical expressions.

  • Argument 2: The value to return if the first argument is not 0.0.

  • Argument 3: The value to return if the first argument is 0.0.

 

Example: F_IF(WATT_TEMPERATURE>50,1,0)

If the temperature is higher than 50, returns 1; otherwise, return 0.

ABS

Scalar/Vector/Tensor
Complex Number/Real Number

Argument: Scalar -> Scalar
Argument: Vector -> Vector
Argument: Tensor -> Tensor
Real Number

Returns the absolute value of the complex number.
Whether the argument is a complex or real number, returns a real number.

If the argument is a vector or tensor, calculates the absolute value of each component and returns a vector or tensor with these absolute values as components.

REAL

Scalar/Vector/Tensor
Complex Number/Real Number

Argument: Scalar -> Scalar
Argument: Vector -> Vector
Argument: Tensor -> Tensor
Real Number

Returns the real part of the complex number.
Whether the argument is a complex or real number, returns a real number.

If the argument is a vector or tensor, calculates the real part of each component and return a vector or tensor with these real parts as components.

IMAG

Scalar/Vector/Tensor
Complex Number/Real Number

Argument: Scalar -> Scalar
Argument: Vector -> Vector
Argument: Tensor -> Tensor
Real Number

Returns the imaginary part of the complex number.
Whether the argument is a complex or real number, returns a real number.

If the argument is a vector or tensor, calculates the imaginary part of each component and return a vector or tensor with these imaginary parts as components.

CONJ

Scalar/Vector/Tensor
Complex Number/Real Number

Argument: Scalar -> Scalar
Argument: Vector -> Vector
Argument: Tensor -> Tensor
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the complex conjugate of the complex number.
If the argument is a complex number, returns a complex number; if it is a real number, return a real number.

If the argument is a vector or tensor, calculates the complex conjugate of each component and return a vector or tensor with these complex conjugates as components.

PHASE

Argument 1:
Scalar (deg)

Real Number
Argument 2:

Scalar/Vector/Tensor
Complex Number/Real Number

Argument 2: Scalar -> Scalar
Argument 2: Vector -> Vector
Argument 2: Tensor -> Tensor
Real Number

Returns the magnitude of the complex number (Argument 2) at a particular phase (Argument 1 [deg]).
Whether Argument 2 is a complex or real number, returns a real number.

If Argument 2 is a vector or tensor, calculates the magnitude of each component at the phase of Argument 1 and return a vector or tensor with these magnitudes as components.

PHASE_VALUE

Scalar/Vector/Tensor
Complex Number/Real Number

Argument: Scalar -> Scalar (deg)
Argument: Vector -> Vector (deg)
Argument: Tensor -> Tensor (deg)
Real Number

Returns the phase [deg] of the complex number.
Whether Argument 2 is a complex or real number, returns a real number.

If the argument is a vector or tensor, calculates the phase of each component and return a vector or tensor with these phases as components.

COORD

No arguments required.

Vector

Real Number

Return the coordinates.
Represented as "COORD()."

GAS_CONSTANT

No arguments required.

Scalar

Real Number

Returns the gas constant, R = 8.314462618 [J/deg/mol].

AMBIENT_PRESSURE

No arguments required.

Scalar

Real Number

Returns the ambient pressure defined on the fluid analysis tab.

Functions (Vector/Tensor)

Function

Argument

Return Value

Note

VEC_X

Vector
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the X component of the vector argument.

VEC_Y

Vector
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the Y component of the vector argument.

VEC_Z

Vector
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the Z component of the vector argument.

VEC_LENGTH

Vector
Complex Number/Real Number

Scalar
Real Number

Returns the magnitude of the vector argument.

If the argument is a complex number, returns a real number

TEN_XX

Tensor
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the XX component of the tensor argument (X-direction normal component).

TEN_YY

Tensor
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the YY component of the tensor argument (Y-direction normal component).

TEN_ZZ

Tensor
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the ZZ component of the tensor argument (Z-direction normal component).

TEN_YZ

Tensor
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the YZ component of the tensor argument (Shear component).

TEN_ZX

Tensor
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the ZX component of the tensor argument (Shear component).

TEN_XY

Tensor
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the XY component of the tensor argument (Shear component).

TEN_ZY

Tensor
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the ZY component of the tensor argument (Shear component).

TEN_XZ

Tensor
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the XZ component of the tensor argument (Shear component).

TEN_YX

Tensor
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the YX component of the tensor argument (Shear component).

TEN_P1

Tensor
Complex Number/Real Number

Scalar
Real Number

 

Returns the maximum principal value of the tensor argument (if the display type is stress type, maximum principal stress; if it is strain type, maximum principal strain).

If the argument is a complex number, returns a real number

 

TEN_P2

Tensor
Real Number

Scalar
Real Number

 

Returns the intermediate principal value of the tensor argument (if the display type is stress type, intermediate principal stress; if it is strain type, intermediate principal strain).

If the argument is a complex number, unable to output.

 

TEN_P3

Tensor
Complex Number/Real Number

Scalar
Real Number

 

Returns the minimum principal value of the tensor argument (if the display type is stress type, minimum principal stress; if it is strain type, minimum principal strain).

If the argument is a complex number, returns a real number

 

TEN_XZ_P1

Tensor
Complex Number/Real Number

Scalar
Real Number

 

Returns the XZ in-plane maximum principal value of the tensor argument (if the display type is stress type, maximum principal stress; if it is strain type, maximum principal strain).

If the argument is a complex number, returns a real number

 

TEN_XZ_P2

Tensor
Real Number

Scalar
Real Number

 

Returns the XZ in-plane minimum principal value of the tensor argument (if the display type is stress type, minimum principal stress; if it is strain type, minimum principal strain).

If the argument is a complex number, returns a real number

 

TEN_XY_P1

Tensor
Complex Number/Real Number

Scalar
Real Number

 

Returns the XY in-plane maximum principal value of the tensor argument (if the display type is stress type, maximum principal stress; if it is strain type, maximum principal strain).

If the argument is a complex number, returns a real number

 

TEN_XY_P2

Tensor
Real Number

Scalar
Real Number

 

Returns the XY in-plane minimum principal value of the tensor argument (if the display type is stress type, minimum principal stress; if it is strain type, minimum principal strain).

If the argument is a complex number, returns a real number

 

TEN_VOLUME

Tensor
Complex Number/Real Number

Scalar
Argument: Complex Number -> Complex Number
Argument: Real Number -> Real Number

Returns the volumetric value of the tensor argument (if the display type is stress type, hydrostatic pressure; if it is strain type, volume strain).

TEN_EQUIV

Tensor
Complex Number/Real Number

Scalar
Real Number

 

Returns the equivalent value of the tensor argument (if the display type is stress type, von Mises equivalent stress; if it is strain type, equivalent strain).

If the argument is a complex number, returns a real number

 

TEN_R

Tensor
Complex Number/Real Number

Scalar
Real Number

 

Returns the difference between the maximum and minimum principal values (if the display type is stress type, maximum shear stress; if it is strain type, maximum shear strain).

If the argument is a complex number, returns a real number

 

MAKE_VEC

Arguments 1 to 3:
Scalar
Complex Number/Real Number

Vector
Arguments 1 to 3: Complex Number -> Complex Number
Arguments 1 to 3: Real Number -> Real Number

Constructs a vector from three arguments.

Example: MAKE_VEC(1,2,3)

MAKE_TEN

Arguments 1 to 9:
Scalar
Complex Number/Real Number

Tensor
Arguments 1 to 3: Complex Number -> Complex Number
Arguments 1 to 3: Real Number -> Real Number

Constructs a tensor from nine arguments.

Example: MAKE_TEN(1.2, 3.4, 5.6, 1,2,9)

UNIT_TEN

No arguments required.

Tensor
Real Number

Creates a unit tensor (diagonal elements are 1, and all other elements are 0).

INNER_PRODUCT

Argument 1, Argument 2:
Scalar/Vector/Tensor
Complex Number/Real Number

Scalar
Complex Number -> Complex Number
Real Number -> Real Number

Calculates the inner product of two scalar arguments, vector arguments, and tensor arguments. For a vector or tensor argument, sum the products of their respective components.

If the argument is a complex number, returns a real number

 

Example: 0.5*INNER_PRODUCT(GALILEO_STRAIN_E,GALILEO_STRESS)

Calculates the strain energy density (static analysis).

INNER_PRODUCT_CONJ

Argument 1:
Scalar/Vector/Tensor
Complex Number/Real Number

Argument 2:
Scalar/Vector/Tensor
Complex Number/Real Number

Scalar
Real Number

Calculates the inner product of two scalar arguments, vector arguments, and tensor arguments. For a vector or tensor argument, sum the products of their respective components.

If the arguments are complex numbers, returns a real number calculated using the complex conjugate of the second argument.

 

Example: 0.25*INNER_PRODUCT(GALILEO_STRAIN_E,GALILEO_STRESS)

Calculates the strain energy density (average).

CROSS_PRODUCT

Argument 1:
Vector
Complex Number/Real Number

Argument 2:
Vector
Complex Number/Real Number

Vector
Complex Number -> Complex Number
Real Number -> Real Number

Calculates the outer product of two vector arguments.

 

Example: 0.5*CROSS_PRODUCT(HERTZ_ELECTRIC_FIELD,HERTZ_MAGNETIC_FIELD)

Calculates the poynting vector (vibration).

CROSS_PRODUCT_CONJ

Argument 1:
Vector
Complex Number/Real Number

Argument 2:
Vector
Complex Number/Real Number

Vector
Real Number

Calculates the outer product of two vector arguments.

If the arguments are complex numbers, returns a real number calculated using the complex conjugate of the second argument.

 

Example: 0.5*CROSS_PRODUCT(HERTZ_ELECTRIC_FIELD,HERTZ_MAGNETIC_FIELD)

Calculates the poynting vector (average).

TRANS

Tensor
Complex Number/Real Number

Tensor
Complex Number -> Complex Number
Real Number -> Real Number

Converts the tensor argument to a transposed matrix.

INVERSE

Tensor
Complex Number/Real Number

Tensor
Complex Number -> Complex Number
Real Number -> Real Number

Converts the tensor argument to an inverse matrix.

DET

Tensor
Complex Number/Real Number

Scalar
Complex Number -> Complex Number
Real Number -> Real Number

Calculates the determinant of the tensor argument.