FieldExpressions#
- class ansys.aedt.core.visualization.post.field_calculator_expressions.FieldExpressions(calculator)#
Builder for AEDT Fields Calculator expressions.
The AEDT Fields Calculator is driven by a stack of string operations (reverse Polish notation), for example
Fundamental_Quantity('E'),Operation('Real'),Operation('Tangent'),Operation('Dot'). Assembling those strings by hand is error-prone and hides which operations are valid for a given quantity.This class wraps that operation grammar with four typed expression classes that mirror the calculator’s register kinds:
ScalarReal, a real scalar quantity.ScalarComplex, a complex scalar quantity.VectorReal, a real 3-vector quantity.VectorComplex, a complex 3-vector quantity.
The builder wraps the calculator operations:
input: fundamental and named quantities; real / complex scalar constants;
vector_constant;function(a design variable /Scalar_Function).general:
+ - * /and negation (numbers are accepted as operands, for exampleE * 2);real/imaginary/conjugate/magnitude/component_magnitude/phase/at_phase/smooth/absolute;as_complex_real/as_complex_imagand thecmplx()helper.scalar:
sqrt/power/ln/log10/sin/cos/tan/asin/acos/atan/derivative/gradientand forming a vector withas_vector_x/as_vector_y/as_vector_z.vector: components
scalar_x/scalar_y/scalar_z;dot/cross/curl/divergence; and the geometry unit vectorsFieldExpressions.tangent/FieldExpressions.normal(push a unit vector to dot a field against, for tangential / flux quantities).output:
integrate/maximum/minimum/mean/std/value/max_position/min_positionover aLine,Surface, orVolume.
Examples
>>> fx = FieldExpressions(calculator=None) >>> e_vector = fx.vector("E") >>> energy = (e_vector.magnitude() * e_vector.magnitude()).integrate(Surface("MySheet")) >>> energy.operations[-3:] ["EnterSurface('MySheet')", "Operation('SurfaceValue')", "Operation('Integrate')"]
Methods
FieldExpressions.complex_constant(real, imag)Create a complex scalar constant.
Create a scalar expression from a design variable or function.
FieldExpressions.named_expression(name[, ...])Start from a previously defined named expression.
Push the geometry unit normal vector.
FieldExpressions.scalar(quantity[, is_complex])Start from a fundamental scalar quantity.
Create a real scalar constant.
Push the geometry unit tangent vector.
FieldExpressions.vector([quantity, is_complex])Start from a fundamental vector quantity.
FieldExpressions.vector_constant(x, y, z)Create a constant real vector.
Attributes
Shortcut for dir(self).